[FFmpeg-devel] [PATCH] examples/filtering_audio: get rid of AVABufferSinkParams

Pavel Koshevoy pkoshevoy at gmail.com
Wed Apr 17 15:54:36 CEST 2013


On 4/17/13 3:14 AM, Clément Bœsch wrote:
> On Wed, Apr 17, 2013 at 12:46:49AM -0600, pkoshevoy at gmail.com wrote:
>> From: Pavel Koshevoy <pkoshevoy at gmail.com>
>>
>> AVABufferSinkParams are ignored by avfilter_graph_create_filter,
>> therefore the example is misleading.  Use av_opt_set_int_list to
>> configure abuffersink directly.
>>
>> Also, make the example a bit more interesting.
>>
>> Signed-off-by: Pavel Koshevoy <pkoshevoy at gmail.com>
>> ---
>>   doc/examples/filtering_audio.c |   45 +++++++++++++++++++++++++++++++++-------
>>   1 file changed, 37 insertions(+), 8 deletions(-)
>>
> What about doc/examples/filtering_video.c?

I haven't even looked there, because I didn't need a video filtering 
example this time.

<snip>
>   
> +    ret = av_opt_set_int_list(buffersink_ctx, "sample_fmts", out_sample_fmts, -1,
> +                              AV_OPT_SEARCH_CHILDREN);
> +    if (ret < 0) {
> +        av_log(NULL, AV_LOG_ERROR, "Cannot set output sample format\n");
> +        return ret;
> +    }
> +
> +    ret = av_opt_set_int_list(buffersink_ctx, "channel_layouts", out_channel_layouts, -1,
> +                              AV_OPT_SEARCH_CHILDREN);
> +    if (ret < 0) {
> +        av_log(NULL, AV_LOG_ERROR, "Cannot set output channel layout\n");
> +        return ret;
> +    }
> +
> +    ret = av_opt_set_int_list(buffersink_ctx, "sample_rates", out_sample_rates, -1,
> +                              AV_OPT_SEARCH_CHILDREN);
> +    if (ret < 0) {
> +        av_log(NULL, AV_LOG_ERROR, "Cannot set output sample rate\n");
> +        return ret;
> +    }
> +
>       /* Endpoints for the filter graph. */
>       outputs->name       = av_strdup("in");
>       outputs->filter_ctx = buffersrc_ctx;
> That may be unrelated, but why don't we just insert a aformat filter at
> the end of the filtergraph to request a specific configuration?
>

I would expect the automatic graph builder to insert any necessary 
format converters between buffersrc and buffersink. If I were to insert 
aformat manually I could possible introduce an unnecessary filter into 
the graph. Does the graph builder remove redundant format conversion 
filters?

Pavel.



More information about the ffmpeg-devel mailing list