avfilter: avoid direct access to AVFrame.channels
authorMichael Niedermayer <michaelni@gmx.at>
Fri, 15 Mar 2013 15:13:53 +0000 (16:13 +0100)
committerMichael Niedermayer <michaelni@gmx.at>
Fri, 15 Mar 2013 15:13:53 +0000 (16:13 +0100)
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
libavfilter/af_aconvert.c
libavfilter/af_afade.c
libavfilter/af_amerge.c
libavfilter/af_apad.c
libavfilter/af_aresample.c
libavfilter/af_biquads.c
libavfilter/af_pan.c

index 2cf12e3..c05e571 100644 (file)
@@ -147,7 +147,7 @@ static int  filter_frame(AVFilterLink *inlink, AVFrame *insamplesref)
                         (void *)insamplesref->extended_data, n);
 
     av_frame_copy_props(outsamplesref, insamplesref);
-    outsamplesref->channels       = outlink->channels;
+    av_frame_set_channels(outsamplesref, outlink->channels);
     outsamplesref->channel_layout = outlink->channel_layout;
 
     ret = ff_filter_frame(outlink, outsamplesref);
index 0e660a3..1134849 100644 (file)
@@ -256,7 +256,7 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *buf)
     if ((!afade->type && (cur_sample + nb_samples < afade->start_sample)) ||
         ( afade->type && (afade->start_sample + afade->nb_samples < cur_sample))) {
         av_samples_set_silence(out_buf->extended_data, 0, nb_samples,
-                               out_buf->channels, out_buf->format);
+                               av_frame_get_channels(out_buf), out_buf->format);
     } else {
         int64_t start;
 
@@ -266,7 +266,7 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *buf)
             start = afade->start_sample + afade->nb_samples - cur_sample;
 
         afade->fade_samples(out_buf->extended_data, buf->extended_data,
-                            nb_samples, buf->channels,
+                            nb_samples, av_frame_get_channels(buf),
                             afade->type ? -1 : 1, start,
                             afade->nb_samples, afade->curve);
     }
index b26141d..28c3682 100644 (file)
@@ -263,7 +263,7 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *insamples)
 
     outbuf->nb_samples     = nb_samples;
     outbuf->channel_layout = outlink->channel_layout;
-    outbuf->channels       = outlink->channels;
+    av_frame_set_channels(outbuf, outlink->channels);
 
     while (nb_samples) {
         ns = nb_samples;
index b3a4b95..b4a0fc8 100644 (file)
@@ -122,7 +122,7 @@ static int request_frame(AVFilterLink *outlink)
 
         av_samples_set_silence(outsamplesref->extended_data, 0,
                                n_out,
-                               outsamplesref->channels,
+                               av_frame_get_channels(outsamplesref),
                                outsamplesref->format);
 
         outsamplesref->pts = apad->next_pts;
index be1e4b7..80351c3 100644 (file)
@@ -188,7 +188,7 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *insamplesref)
 
     av_frame_copy_props(outsamplesref, insamplesref);
     outsamplesref->format                = outlink->format;
-    outsamplesref->channels              = outlink->channels;
+    av_frame_set_channels(outsamplesref, outlink->channels);
     outsamplesref->channel_layout        = outlink->channel_layout;
     outsamplesref->sample_rate           = outlink->sample_rate;
 
index 6384090..0bd61fd 100644 (file)
@@ -409,7 +409,7 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *buf)
         out_buf->pts = buf->pts;
     }
 
-    for (ch = 0; ch < buf->channels; ch++)
+    for (ch = 0; ch < av_frame_get_channels(buf); ch++)
         p->filter(buf->extended_data[ch],
                   out_buf->extended_data[ch], nb_samples,
                   &p->cache[ch].i1, &p->cache[ch].i2,
index 9a3c10c..ae2e0aa 100644 (file)
@@ -364,7 +364,7 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *insamples)
     swr_convert(pan->swr, outsamples->data, n, (void *)insamples->data, n);
     av_frame_copy_props(outsamples, insamples);
     outsamples->channel_layout = outlink->channel_layout;
-    outsamples->channels       = outlink->channels;
+    av_frame_set_channels(outsamples, outlink->channels);
 
     ret = ff_filter_frame(outlink, outsamples);
     av_frame_free(&insamples);