summaryrefslogtreecommitdiff
path: root/libavdevice
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 /libavdevice
parentbe7eed72c89368de70dbf8749eca1dac7443e51a (diff)
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 'libavdevice')
-rw-r--r--libavdevice/lavfi.c26
1 files changed, 18 insertions, 8 deletions
diff --git a/libavdevice/lavfi.c b/libavdevice/lavfi.c
index ce4189ff1c..a1929ef0ec 100644
--- a/libavdevice/lavfi.c
+++ b/libavdevice/lavfi.c
@@ -173,10 +173,21 @@ av_cold static int lavfi_read_header(AVFormatContext *avctx,
for (i = 0, inout = output_links; inout; i++, inout = inout->next) {
AVFilterContext *sink;
- if ((ret = avfilter_graph_create_filter(&sink, buffersink,
- inout->name, NULL,
- pix_fmts, lavfi->graph)) < 0)
- FAIL(ret);
+ AVBufferSinkParams *buffersink_params = av_buffersink_params_alloc();
+#if FF_API_OLD_VSINK_API
+ ret = avfilter_graph_create_filter(&sink, buffersink,
+ inout->name, NULL,
+ pix_fmts, lavfi->graph);
+#else
+ buffersink_params->pixel_fmts = pix_fmts;
+ ret = avfilter_graph_create_filter(&sink, buffersink,
+ inout->name, NULL,
+ buffersink_params, lavfi->graph);
+#endif
+ av_freep(&buffersink_params);
+ if (ret < 0)
+ goto end;
+
lavfi->sinks[i] = sink;
if ((ret = avfilter_link(inout->filter_ctx, inout->pad_idx, sink, 0)) < 0)
FAIL(ret);
@@ -225,8 +236,8 @@ static int lavfi_read_packet(AVFormatContext *avctx, AVPacket *pkt)
for (i = 0; i < avctx->nb_streams; i++) {
AVRational tb = lavfi->sinks[i]->inputs[0]->time_base;
double d;
- int ret = av_vsink_buffer_get_video_buffer_ref(lavfi->sinks[i],
- &picref, AV_VSINK_BUF_FLAG_PEEK);
+ int ret = av_buffersink_get_buffer_ref(lavfi->sinks[i],
+ &picref, AV_BUFFERSINK_FLAG_PEEK);
if (ret < 0)
return ret;
d = av_rescale_q(picref->pts, tb, AV_TIME_BASE_Q);
@@ -239,8 +250,7 @@ static int lavfi_read_packet(AVFormatContext *avctx, AVPacket *pkt)
}
av_dlog(avctx, "min_pts_sink_idx:%i\n", min_pts_sink_idx);
- av_vsink_buffer_get_video_buffer_ref(lavfi->sinks[min_pts_sink_idx],
- &picref, 0);
+ av_buffersink_get_buffer_ref(lavfi->sinks[min_pts_sink_idx], &picref, 0);
size = avpicture_get_size(picref->format, picref->video->w, picref->video->h);
if ((ret = av_new_packet(pkt, size)) < 0)