[FFmpeg-cvslog] lavfi/buffersink: restore possibility to pass opaque data

Stefano Sabatini git at videolan.org
Tue Jul 10 01:31:27 CEST 2012


ffmpeg | branch: master | Stefano Sabatini <stefasab at gmail.com> | Fri Jul  6 01:06:20 2012 +0200| [a5382b50f23a2d840298216211126c397122b4ea] | committer: Stefano Sabatini

lavfi/buffersink: restore possibility to pass opaque data

Use the init_opaque callback for the purpose.

Fix regression introduced in a5e8c41c28f. In particular, fix lavfi
device in case a conversion to the supported (packed) formats is needed.

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

 libavfilter/sink_buffer.c |   24 +++++++-----------------
 1 file changed, 7 insertions(+), 17 deletions(-)

diff --git a/libavfilter/sink_buffer.c b/libavfilter/sink_buffer.c
index ceae112..608a887 100644
--- a/libavfilter/sink_buffer.c
+++ b/libavfilter/sink_buffer.c
@@ -181,19 +181,12 @@ int av_buffersink_poll_frame(AVFilterContext *ctx)
 
 #if CONFIG_BUFFERSINK_FILTER
 
-static av_cold int vsink_init(AVFilterContext *ctx, const char *args)
+static av_cold int vsink_init(AVFilterContext *ctx, const char *args, void *opaque)
 {
     BufferSinkContext *buf = ctx->priv;
-    AVBufferSinkParams *params = NULL;
+    AVBufferSinkParams *params = opaque;
 
-//     if(args && !strcmp(args, "opaque"))
-//         params = (AVBufferSinkParams *)(args+7);
-
-    if (!params) {
-        av_log(ctx, AV_LOG_WARNING,
-               "No opaque field provided\n");
-        buf->pixel_fmts = NULL;
-    } else {
+    if (params && buf->pixel_fmts) {
         const int *pixel_fmts = params->pixel_fmts;
 
         buf->pixel_fmts = ff_copy_int_list(pixel_fmts);
@@ -227,7 +220,7 @@ AVFilter avfilter_vsink_buffersink = {
     .name      = "buffersink",
     .description = NULL_IF_CONFIG_SMALL("Buffer video frames, and make them available to the end of the filter graph."),
     .priv_size = sizeof(BufferSinkContext),
-    .init      = vsink_init,
+    .init_opaque = vsink_init,
     .uninit    = vsink_uninit,
 
     .query_formats = vsink_query_formats,
@@ -250,13 +243,10 @@ static int filter_samples(AVFilterLink *link, AVFilterBufferRef *samplesref)
     return 0;
 }
 
-static av_cold int asink_init(AVFilterContext *ctx, const char *args)
+static av_cold int asink_init(AVFilterContext *ctx, const char *args, void *opaque)
 {
     BufferSinkContext *buf = ctx->priv;
-    AVABufferSinkParams *params = NULL;
-
-//     if(args && !strcmp(args, "opaque"))
-//         params = (AVABufferSinkParams *)(args+7);
+    AVABufferSinkParams *params = opaque;
 
     if (params && params->sample_fmts) {
         buf->sample_fmts     = ff_copy_int_list  (params->sample_fmts);
@@ -310,7 +300,7 @@ static int asink_query_formats(AVFilterContext *ctx)
 AVFilter avfilter_asink_abuffersink = {
     .name      = "abuffersink",
     .description = NULL_IF_CONFIG_SMALL("Buffer audio frames, and make them available to the end of the filter graph."),
-    .init      = asink_init,
+    .init_opaque = asink_init,
     .uninit    = asink_uninit,
     .priv_size = sizeof(BufferSinkContext),
     .query_formats = asink_query_formats,



More information about the ffmpeg-cvslog mailing list