From c4415f6ec980d1a5f3ddda79395258150747e97f Mon Sep 17 00:00:00 2001 From: Stefano Sabatini Date: Thu, 18 Aug 2011 16:21:47 +0200 Subject: lavfi: unify asink_buffer and vsink_buffer API The new API is more generic (no distinction between audio/video for pulling frames), and avoids code duplication. A backward compatibility layer is kept for avoiding tools ABI breaks (only for the video binary interface, audio interface was never used in the tools). --- ffplay.c | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) (limited to 'ffplay.c') diff --git a/ffplay.c b/ffplay.c index 02d3988d28..d46001d34e 100644 --- a/ffplay.c +++ b/ffplay.c @@ -1685,6 +1685,7 @@ static int configure_video_filters(AVFilterGraph *graph, VideoState *is, const c char sws_flags_str[128]; int ret; enum PixelFormat pix_fmts[] = { PIX_FMT_YUV420P, PIX_FMT_NONE }; + AVBufferSinkParams *buffersink_params = av_buffersink_params_alloc(); AVFilterContext *filt_src = NULL, *filt_out = NULL; snprintf(sws_flags_str, sizeof(sws_flags_str), "flags=%d", sws_flags); graph->scale_sws_opts = av_strdup(sws_flags_str); @@ -1692,8 +1693,16 @@ static int configure_video_filters(AVFilterGraph *graph, VideoState *is, const c if ((ret = avfilter_graph_create_filter(&filt_src, &input_filter, "src", NULL, is, graph)) < 0) return ret; - if ((ret = avfilter_graph_create_filter(&filt_out, avfilter_get_by_name("buffersink"), "out", - NULL, pix_fmts, graph)) < 0) +#if FF_API_OLD_VSINK_API + ret = avfilter_graph_create_filter(&filt_out, avfilter_get_by_name("buffersink"), "out", + NULL, pix_fmts, graph); +#else + buffersink_params->pixel_fmts = pix_fmts; + ret = avfilter_graph_create_filter(&filt_out, avfilter_get_by_name("buffersink"), "out", + NULL, buffersink_params, graph); +#endif + av_freep(&buffersink_params); + if (ret < 0) return ret; if(vfilters) { @@ -1768,7 +1777,7 @@ static int video_thread(void *arg) last_w = is->video_st->codec->width; last_h = is->video_st->codec->height; } - ret = av_vsink_buffer_get_video_buffer_ref(filt_out, &picref, 0); + ret = av_buffersink_get_buffer_ref(filt_out, &picref, 0); if (picref) { avfilter_fill_frame_from_video_buffer_ref(frame, picref); pts_int = picref->pts; -- cgit v1.2.3