diff options
author | Anton Khirnov <anton@khirnov.net> | 2024-09-04 15:11:22 +0200 |
---|---|---|
committer | Anton Khirnov <anton@khirnov.net> | 2024-09-09 17:26:18 +0200 |
commit | c4d9282a568887c14b4415b6e3d1501382d41ccf (patch) | |
tree | 5e889ebb88f70102b5befa09ef59a6d1d8676354 | |
parent | d90035c94137199ef4641857e9d4ee731b223510 (diff) | |
download | ffmpeg-c4d9282a568887c14b4415b6e3d1501382d41ccf.tar.gz |
lavfi/af_stereowiden: convert to query_func2()
Also, drop redundant calls that also happen implicitly in generic code.
-rw-r--r-- | libavfilter/af_stereowiden.c | 29 |
1 files changed, 20 insertions, 9 deletions
diff --git a/libavfilter/af_stereowiden.c b/libavfilter/af_stereowiden.c index 6718bb39a5..66aa24a03c 100644 --- a/libavfilter/af_stereowiden.c +++ b/libavfilter/af_stereowiden.c @@ -54,19 +54,30 @@ static const AVOption stereowiden_options[] = { AVFILTER_DEFINE_CLASS(stereowiden); -static int query_formats(AVFilterContext *ctx) +static int query_formats(const AVFilterContext *ctx, + AVFilterFormatsConfig **cfg_in, + AVFilterFormatsConfig **cfg_out) { - AVFilterFormats *formats = NULL; - AVFilterChannelLayouts *layout = NULL; + static const enum AVSampleFormat formats[] = { + AV_SAMPLE_FMT_FLT, + AV_SAMPLE_FMT_NONE, + }; + static const AVChannelLayout layouts[] = { + AV_CHANNEL_LAYOUT_STEREO, + { .nb_channels = 0 }, + }; + int ret; - if ((ret = ff_add_format (&formats, AV_SAMPLE_FMT_FLT )) < 0 || - (ret = ff_set_common_formats (ctx , formats )) < 0 || - (ret = ff_add_channel_layout (&layout , &(AVChannelLayout)AV_CHANNEL_LAYOUT_STEREO)) < 0 || - (ret = ff_set_common_channel_layouts (ctx , layout )) < 0) + ret = ff_set_common_formats_from_list2(ctx, cfg_in, cfg_out, formats); + if (ret < 0) + return ret; + + ret = ff_set_common_channel_layouts_from_list2(ctx, cfg_in, cfg_out, layouts); + if (ret < 0) return ret; - return ff_set_common_all_samplerates(ctx); + return 0; } static int config_input(AVFilterLink *inlink) @@ -158,7 +169,7 @@ const AVFilter ff_af_stereowiden = { .uninit = uninit, FILTER_INPUTS(inputs), FILTER_OUTPUTS(ff_audio_default_filterpad), - FILTER_QUERY_FUNC(query_formats), + FILTER_QUERY_FUNC2(query_formats), .flags = AVFILTER_FLAG_SUPPORT_TIMELINE_INTERNAL, .process_command = ff_filter_process_command, }; |