diff options
author | Stefano Sabatini <stefasab@gmail.com> | 2012-07-06 01:06:20 +0200 |
---|---|---|
committer | Stefano Sabatini <stefasab@gmail.com> | 2012-07-10 01:29:47 +0200 |
commit | a5382b50f23a2d840298216211126c397122b4ea (patch) | |
tree | 5b8c7719e519caccec35917a9899f83d2f51f91f /libavfilter/sink_buffer.c | |
parent | 21d56098265656b9b7e97a3ae385ca08bb93f729 (diff) | |
download | ffmpeg-a5382b50f23a2d840298216211126c397122b4ea.tar.gz |
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.
Diffstat (limited to 'libavfilter/sink_buffer.c')
-rw-r--r-- | libavfilter/sink_buffer.c | 24 |
1 files changed, 7 insertions, 17 deletions
diff --git a/libavfilter/sink_buffer.c b/libavfilter/sink_buffer.c index ceae11203d..608a8876c2 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, |