From 4c4199758c9dcff7ef92f7de9af0f05c8935f580 Mon Sep 17 00:00:00 2001 From: Anton Khirnov Date: Wed, 4 Sep 2024 15:11:22 +0200 Subject: [PATCH] lavfi/af_sofalizer: convert to query_func2() --- libavfilter/af_sofalizer.c | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/libavfilter/af_sofalizer.c b/libavfilter/af_sofalizer.c index e647d2fe4e..178b9c0b53 100644 --- a/libavfilter/af_sofalizer.c +++ b/libavfilter/af_sofalizer.c @@ -634,9 +634,11 @@ static int activate(AVFilterContext *ctx) return FFERROR_NOT_READY; } -static int query_formats(AVFilterContext *ctx) +static int query_formats(const AVFilterContext *ctx, + AVFilterFormatsConfig **cfg_in, + AVFilterFormatsConfig **cfg_out) { - struct SOFAlizerContext *s = ctx->priv; + const SOFAlizerContext *s = ctx->priv; AVFilterChannelLayouts *layouts = NULL; int ret, sample_rates[] = { 48000, -1 }; static const enum AVSampleFormat sample_fmts[] = { @@ -644,7 +646,7 @@ static int query_formats(AVFilterContext *ctx) AV_SAMPLE_FMT_NONE }; - ret = ff_set_common_formats_from_list(ctx, sample_fmts); + ret = ff_set_common_formats_from_list2(ctx, cfg_in, cfg_out, sample_fmts); if (ret) return ret; @@ -652,7 +654,7 @@ static int query_formats(AVFilterContext *ctx) if (!layouts) return AVERROR(ENOMEM); - 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; @@ -661,12 +663,12 @@ 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; sample_rates[0] = s->sample_rate; - return ff_set_common_samplerates_from_list(ctx, sample_rates); + return ff_set_common_samplerates_from_list2(ctx, cfg_in, cfg_out, sample_rates); } static int getfilter_float(AVFilterContext *ctx, float x, float y, float z, @@ -1096,6 +1098,6 @@ const AVFilter ff_af_sofalizer = { .uninit = uninit, FILTER_INPUTS(inputs), FILTER_OUTPUTS(ff_audio_default_filterpad), - FILTER_QUERY_FUNC(query_formats), + FILTER_QUERY_FUNC2(query_formats), .flags = AVFILTER_FLAG_SLICE_THREADS, };