aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAnton Khirnov <anton@khirnov.net>2024-09-04 15:11:22 +0200
committerAnton Khirnov <anton@khirnov.net>2024-09-09 17:26:18 +0200
commitd90035c94137199ef4641857e9d4ee731b223510 (patch)
treed65515c2e7dedc82c2f264f35412f57a56efdb9c
parent2ee4625d4bac1991c715a95a6fea042071c6a795 (diff)
downloadffmpeg-d90035c94137199ef4641857e9d4ee731b223510.tar.gz
lavfi/af_surround: convert to query_func2()
Also, drop redundant calls that also happen implicitly in generic code.
-rw-r--r--libavfilter/af_surround.c25
1 files changed, 14 insertions, 11 deletions
diff --git a/libavfilter/af_surround.c b/libavfilter/af_surround.c
index 111af03335..95efe4685a 100644
--- a/libavfilter/af_surround.c
+++ b/libavfilter/af_surround.c
@@ -146,17 +146,20 @@ typedef struct AudioSurroundContext {
int n);
} AudioSurroundContext;
-static int query_formats(AVFilterContext *ctx)
+static int query_formats(const AVFilterContext *ctx,
+ AVFilterFormatsConfig **cfg_in,
+ AVFilterFormatsConfig **cfg_out)
{
- AudioSurroundContext *s = ctx->priv;
- AVFilterFormats *formats = NULL;
+ static const enum AVSampleFormat formats[] = {
+ AV_SAMPLE_FMT_FLTP,
+ AV_SAMPLE_FMT_NONE,
+ };
+
+ const AudioSurroundContext *s = ctx->priv;
AVFilterChannelLayouts *layouts = NULL;
int ret;
- ret = ff_add_format(&formats, AV_SAMPLE_FMT_FLTP);
- if (ret)
- return ret;
- ret = ff_set_common_formats(ctx, formats);
+ ret = ff_set_common_formats_from_list2(ctx, cfg_in, cfg_out, formats);
if (ret)
return ret;
@@ -165,7 +168,7 @@ static int query_formats(AVFilterContext *ctx)
if (ret)
return ret;
- ret = ff_channel_layouts_ref(layouts, &ctx->outputs[0]->incfg.channel_layouts);
+ ret = ff_channel_layouts_ref(layouts, &cfg_out[0]->channel_layouts);
if (ret)
return ret;
@@ -174,11 +177,11 @@ static int query_formats(AVFilterContext *ctx)
if (ret)
return ret;
- ret = ff_channel_layouts_ref(layouts, &ctx->inputs[0]->outcfg.channel_layouts);
+ ret = ff_channel_layouts_ref(layouts, &cfg_in[0]->channel_layouts);
if (ret)
return ret;
- return ff_set_common_all_samplerates(ctx);
+ return 0;
}
static void set_input_levels(AVFilterContext *ctx)
@@ -1517,7 +1520,7 @@ const AVFilter ff_af_surround = {
.activate = activate,
FILTER_INPUTS(inputs),
FILTER_OUTPUTS(outputs),
- FILTER_QUERY_FUNC(query_formats),
+ FILTER_QUERY_FUNC2(query_formats),
.flags = AVFILTER_FLAG_SLICE_THREADS,
.process_command = process_command,
};