[FFmpeg-cvslog] lavfi/af_surround: convert to query_func2()
Anton Khirnov
git at videolan.org
Mon Sep 9 18:27:18 EEST 2024
ffmpeg | branch: master | Anton Khirnov <anton at khirnov.net> | Wed Sep 4 15:11:22 2024 +0200| [d90035c94137199ef4641857e9d4ee731b223510] | committer: Anton Khirnov
lavfi/af_surround: convert to query_func2()
Also, drop redundant calls that also happen implicitly in generic code.
> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=d90035c94137199ef4641857e9d4ee731b223510
---
libavfilter/af_surround.c | 25 ++++++++++++++-----------
1 file 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,
};
More information about the ffmpeg-cvslog
mailing list