aboutsummaryrefslogtreecommitdiffstats
path: root/ffmpeg.c
diff options
context:
space:
mode:
authorStefano Sabatini <stefano.sabatini-lala@poste.it>2011-08-18 16:21:47 +0200
committerStefano Sabatini <stefano.sabatini-lala@poste.it>2011-09-06 18:47:04 +0200
commitc4415f6ec980d1a5f3ddda79395258150747e97f (patch)
treed46d96fc5ec9633224cdd2bf9100ad6ad131e7fb /ffmpeg.c
parentbe7eed72c89368de70dbf8749eca1dac7443e51a (diff)
downloadffmpeg-c4415f6ec980d1a5f3ddda79395258150747e97f.tar.gz
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).
Diffstat (limited to 'ffmpeg.c')
-rw-r--r--ffmpeg.c10
1 files changed, 9 insertions, 1 deletions
diff --git a/ffmpeg.c b/ffmpeg.c
index b29089bc60..1d15e8cdec 100644
--- a/ffmpeg.c
+++ b/ffmpeg.c
@@ -419,6 +419,7 @@ static int configure_video_filters(InputStream *ist, OutputStream *ost)
AVCodecContext *codec = ost->st->codec;
AVCodecContext *icodec = ist->st->codec;
enum PixelFormat pix_fmts[] = { codec->pix_fmt, PIX_FMT_NONE };
+ AVBufferSinkParams *buffersink_params = av_buffersink_params_alloc();
AVRational sample_aspect_ratio;
char args[255];
int ret;
@@ -438,8 +439,15 @@ static int configure_video_filters(InputStream *ist, OutputStream *ost)
"src", args, NULL, ost->graph);
if (ret < 0)
return ret;
+#if FF_API_OLD_VSINK_API
ret = avfilter_graph_create_filter(&ost->output_video_filter, avfilter_get_by_name("buffersink"),
"out", NULL, pix_fmts, ost->graph);
+#else
+ buffersink_params->pixel_fmts = pix_fmts;
+ ret = avfilter_graph_create_filter(&ost->output_video_filter, avfilter_get_by_name("buffersink"),
+ "out", NULL, buffersink_params, ost->graph);
+#endif
+ av_freep(&buffersink_params);
if (ret < 0)
return ret;
last_filter = ost->input_video_filter;
@@ -1814,7 +1822,7 @@ static int output_packet(InputStream *ist, int ist_index,
while (frame_available) {
if (ist->st->codec->codec_type == AVMEDIA_TYPE_VIDEO && ost->output_video_filter) {
AVRational ist_pts_tb = ost->output_video_filter->inputs[0]->time_base;
- if (av_vsink_buffer_get_video_buffer_ref(ost->output_video_filter, &ost->picref, 0) < 0)
+ if (av_buffersink_get_buffer_ref(ost->output_video_filter, &ost->picref, 0) < 0)
goto cont;
if (ost->picref) {
avfilter_fill_frame_from_video_buffer_ref(&picture, ost->picref);