From 6e4affc4071245990711500484ee53818bb844f2 Mon Sep 17 00:00:00 2001 From: Anton Khirnov Date: Thu, 29 Aug 2024 09:10:01 +0200 Subject: [PATCH] lavfi/af_aiir: convert to query_func2() Drop redundant ff_set_common_all_channel_counts() / ff_set_common_all_samplerates() calls, since those happen implicitly in generic code. --- libavfilter/af_aiir.c | 20 ++++++++------------ 1 file changed, 8 insertions(+), 12 deletions(-) diff --git a/libavfilter/af_aiir.c b/libavfilter/af_aiir.c index 462fa4666e..dfeeb34c9b 100644 --- a/libavfilter/af_aiir.c +++ b/libavfilter/af_aiir.c @@ -78,9 +78,11 @@ typedef struct AudioIIRContext { int (*iir_channel)(AVFilterContext *ctx, void *arg, int ch, int nb_jobs); } AudioIIRContext; -static int query_formats(AVFilterContext *ctx) +static int query_formats(const AVFilterContext *ctx, + AVFilterFormatsConfig **cfg_in, + AVFilterFormatsConfig **cfg_out) { - AudioIIRContext *s = ctx->priv; + const AudioIIRContext *s = ctx->priv; AVFilterFormats *formats; enum AVSampleFormat sample_fmts[] = { AV_SAMPLE_FMT_DBLP, @@ -93,23 +95,17 @@ static int query_formats(AVFilterContext *ctx) int ret; if (s->response) { - AVFilterLink *videolink = ctx->outputs[1]; - formats = ff_make_format_list(pix_fmts); - if ((ret = ff_formats_ref(formats, &videolink->incfg.formats)) < 0) + if ((ret = ff_formats_ref(formats, &cfg_out[1]->formats)) < 0) return ret; } - ret = ff_set_common_all_channel_counts(ctx); - if (ret < 0) - return ret; - sample_fmts[0] = s->sample_format; - 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 < 0) return ret; - return ff_set_common_all_samplerates(ctx); + return 0; } #define IIR_CH(name, type, min, max, need_clipping) \ @@ -1572,7 +1568,7 @@ const AVFilter ff_af_aiir = { .init = init, .uninit = uninit, FILTER_INPUTS(inputs), - FILTER_QUERY_FUNC(query_formats), + FILTER_QUERY_FUNC2(query_formats), .flags = AVFILTER_FLAG_DYNAMIC_OUTPUTS | AVFILTER_FLAG_SLICE_THREADS, };