aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAnton Khirnov <anton@khirnov.net>2024-09-03 10:32:45 +0200
committerAnton Khirnov <anton@khirnov.net>2024-09-09 17:26:17 +0200
commite37d1efe6575cac7c580f6dad21ade39c82a1e5d (patch)
tree550eb11b00584b3fb6a064fc3743aa4dfdb30f62
parentffbafbfdeddf93877c9b9076e1e4c87c67f9a709 (diff)
downloadffmpeg-e37d1efe6575cac7c580f6dad21ade39c82a1e5d.tar.gz
lavfi/af_dialoguenhance: convert to query_func2()
Also, drop redundant calls that also happen implicitly in generic code.
-rw-r--r--libavfilter/af_dialoguenhance.c28
1 files changed, 18 insertions, 10 deletions
diff --git a/libavfilter/af_dialoguenhance.c b/libavfilter/af_dialoguenhance.c
index b77e85198f..cae8375547 100644
--- a/libavfilter/af_dialoguenhance.c
+++ b/libavfilter/af_dialoguenhance.c
@@ -69,22 +69,30 @@ static const AVOption dialoguenhance_options[] = {
AVFILTER_DEFINE_CLASS(dialoguenhance);
-static int query_formats(AVFilterContext *ctx)
+static int query_formats(const AVFilterContext *ctx,
+ AVFilterFormatsConfig **cfg_in,
+ AVFilterFormatsConfig **cfg_out)
{
- AVFilterFormats *formats = NULL;
+ static const enum AVSampleFormat formats[] = {
+ AV_SAMPLE_FMT_FLTP,
+ AV_SAMPLE_FMT_DBLP,
+ AV_SAMPLE_FMT_NONE,
+ };
+
AVFilterChannelLayouts *in_layout = NULL, *out_layout = NULL;
int ret;
- if ((ret = ff_add_format (&formats, AV_SAMPLE_FMT_FLTP )) < 0 ||
- (ret = ff_add_format (&formats, AV_SAMPLE_FMT_DBLP )) < 0 ||
- (ret = ff_set_common_formats (ctx , formats )) < 0 ||
- (ret = ff_add_channel_layout (&in_layout , &(AVChannelLayout)AV_CHANNEL_LAYOUT_STEREO)) < 0 ||
- (ret = ff_channel_layouts_ref(in_layout, &ctx->inputs[0]->outcfg.channel_layouts)) < 0 ||
+ ret = ff_set_common_formats_from_list2(ctx, cfg_in, cfg_out, formats);
+ if (ret < 0)
+ return ret;
+
+ if ((ret = ff_add_channel_layout (&in_layout , &(AVChannelLayout)AV_CHANNEL_LAYOUT_STEREO)) < 0 ||
+ (ret = ff_channel_layouts_ref(in_layout, &cfg_in[0]->channel_layouts)) < 0 ||
(ret = ff_add_channel_layout (&out_layout , &(AVChannelLayout)AV_CHANNEL_LAYOUT_SURROUND)) < 0 ||
- (ret = ff_channel_layouts_ref(out_layout, &ctx->outputs[0]->incfg.channel_layouts)) < 0)
+ (ret = ff_channel_layouts_ref(out_layout, &cfg_out[0]->channel_layouts)) < 0)
return ret;
- return ff_set_common_all_samplerates(ctx);
+ return 0;
}
#define DEPTH 32
@@ -217,7 +225,7 @@ const AVFilter ff_af_dialoguenhance = {
.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,
.activate = activate,
.process_command = ff_filter_process_command,