[FFmpeg-cvslog] ffplay: replace opaque/params for buffersinks

Michael Niedermayer git at videolan.org
Fri Apr 12 20:41:15 CEST 2013


ffmpeg | branch: master | Michael Niedermayer <michaelni at gmx.at> | Fri Apr 12 20:28:34 2013 +0200| [e87c1cdbb5486497b7df2bf7f62f2c8cbe2bcac7] | committer: Michael Niedermayer

ffplay: replace opaque/params for buffersinks

This fixes a regression caused by droping opaque.

Signed-off-by: Michael Niedermayer <michaelni at gmx.at>

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=e87c1cdbb5486497b7df2bf7f62f2c8cbe2bcac7
---

 ffplay.c |   50 ++++++++++++++++++++++++--------------------------
 1 file changed, 24 insertions(+), 26 deletions(-)

diff --git a/ffplay.c b/ffplay.c
index a9fef72..85e80a8 100644
--- a/ffplay.c
+++ b/ffplay.c
@@ -1758,14 +1758,10 @@ static int configure_video_filters(AVFilterGraph *graph, VideoState *is, const c
     char sws_flags_str[128];
     char buffersrc_args[256];
     int ret;
-    AVBufferSinkParams *buffersink_params = av_buffersink_params_alloc();
     AVFilterContext *filt_src = NULL, *filt_out = NULL, *filt_crop;
     AVCodecContext *codec = is->video_st->codec;
     AVRational fr = av_guess_frame_rate(is->ic, is->video_st, NULL);
 
-    if (!buffersink_params)
-        return AVERROR(ENOMEM);
-
     av_opt_get_int(sws_opts, "sws_flags", 0, &sws_flags);
     snprintf(sws_flags_str, sizeof(sws_flags_str), "flags=%"PRId64, sws_flags);
     graph->scale_sws_opts = av_strdup(sws_flags_str);
@@ -1784,13 +1780,15 @@ static int configure_video_filters(AVFilterGraph *graph, VideoState *is, const c
                                             graph)) < 0)
         goto fail;
 
-    buffersink_params->pixel_fmts = pix_fmts;
     ret = avfilter_graph_create_filter(&filt_out,
                                        avfilter_get_by_name("buffersink"),
-                                       "ffplay_buffersink", NULL, buffersink_params, graph);
+                                       "ffplay_buffersink", NULL, NULL, graph);
     if (ret < 0)
         goto fail;
 
+    if ((ret = av_opt_set_int_list(filt_out, "pix_fmts", pix_fmts,  AV_PIX_FMT_NONE, AV_OPT_SEARCH_CHILDREN)) < 0)
+        goto fail;
+
     /* SDL YUV code is not handling odd width/height for some driver
      * combinations, therefore we crop the picture to an even width/height. */
     if ((ret = avfilter_graph_create_filter(&filt_crop,
@@ -1807,7 +1805,6 @@ static int configure_video_filters(AVFilterGraph *graph, VideoState *is, const c
     is->out_video_filter = filt_out;
 
 fail:
-    av_freep(&buffersink_params);
     return ret;
 }
 
@@ -1819,7 +1816,6 @@ static int configure_audio_filters(VideoState *is, const char *afilters, int for
     int channels[2] = { 0, -1 };
     AVFilterContext *filt_asrc = NULL, *filt_asink = NULL;
     char asrc_args[256];
-    AVABufferSinkParams *asink_params = NULL;
     int ret;
 
     avfilter_graph_free(&is->agraph);
@@ -1841,29 +1837,32 @@ static int configure_audio_filters(VideoState *is, const char *afilters, int for
     if (ret < 0)
         goto end;
 
-    if (!(asink_params = av_abuffersink_params_alloc())) {
-        ret = AVERROR(ENOMEM);
+
+    ret = avfilter_graph_create_filter(&filt_asink,
+                                       avfilter_get_by_name("abuffersink"), "ffplay_abuffersink",
+                                       NULL, NULL, is->agraph);
+    if (ret < 0)
+        goto end;
+
+    if ((ret = av_opt_set_int_list(filt_asink, "sample_fmts", sample_fmts,  AV_SAMPLE_FMT_NONE, AV_OPT_SEARCH_CHILDREN)) < 0)
+        goto end;
+    if ((ret = av_opt_set_int(filt_asink, "all_channel_counts", 1, AV_OPT_SEARCH_CHILDREN)) < 0)
         goto end;
-    }
-    asink_params->sample_fmts = sample_fmts;
 
-    asink_params->all_channel_counts = 1;
     if (force_output_format) {
         channel_layouts[0] = is->audio_tgt.channel_layout;
-        asink_params->channel_layouts = channel_layouts;
-        asink_params->all_channel_counts = 0;
-        channels[0] = is->audio_tgt.channels;
-        asink_params->channel_counts = channels;
-        asink_params->all_channel_counts = 0;
-        sample_rates[0] = is->audio_tgt.freq;
-        asink_params->sample_rates = sample_rates;
+        channels       [0] = is->audio_tgt.channels;
+        sample_rates   [0] = is->audio_tgt.freq;
+        if ((ret = av_opt_set_int(filt_asink, "all_channel_counts", 0, AV_OPT_SEARCH_CHILDREN)) < 0)
+            goto end;
+        if ((ret = av_opt_set_int_list(filt_asink, "channel_layouts", channel_layouts,  -1, AV_OPT_SEARCH_CHILDREN)) < 0)
+            goto end;
+        if ((ret = av_opt_set_int_list(filt_asink, "channel_counts" , channels       ,  -1, AV_OPT_SEARCH_CHILDREN)) < 0)
+            goto end;
+        if ((ret = av_opt_set_int_list(filt_asink, "sample_rates"   , sample_rates   ,  -1, AV_OPT_SEARCH_CHILDREN)) < 0)
+            goto end;
     }
 
-    ret = avfilter_graph_create_filter(&filt_asink,
-                                       avfilter_get_by_name("abuffersink"), "ffplay_abuffersink",
-                                       NULL, asink_params, is->agraph);
-    if (ret < 0)
-        goto end;
 
     if ((ret = configure_filtergraph(is->agraph, afilters, filt_asrc, filt_asink)) < 0)
         goto end;
@@ -1872,7 +1871,6 @@ static int configure_audio_filters(VideoState *is, const char *afilters, int for
     is->out_audio_filter = filt_asink;
 
 end:
-    av_freep(&asink_params);
     if (ret < 0)
         avfilter_graph_free(&is->agraph);
     return ret;



More information about the ffmpeg-cvslog mailing list