From cf43a02c2c16a6cefcc93a7eef886e06340ba2c2 Mon Sep 17 00:00:00 2001 From: Anton Khirnov Date: Sat, 31 Aug 2024 11:21:00 +0200 Subject: [PATCH] lavfi/af_asetrate: convert to query_func2() Also, drop redundant calls that also happen implicitly in generic code. --- libavfilter/af_asetrate.c | 18 +++++++----------- 1 file changed, 7 insertions(+), 11 deletions(-) diff --git a/libavfilter/af_asetrate.c b/libavfilter/af_asetrate.c index 80f76fbb70..061edebdf0 100644 --- a/libavfilter/af_asetrate.c +++ b/libavfilter/af_asetrate.c @@ -47,23 +47,19 @@ static const AVOption asetrate_options[] = { AVFILTER_DEFINE_CLASS(asetrate); -static av_cold int query_formats(AVFilterContext *ctx) +static av_cold int query_formats(const AVFilterContext *ctx, + AVFilterFormatsConfig **cfg_in, + AVFilterFormatsConfig **cfg_out) { - ASetRateContext *sr = ctx->priv; + const ASetRateContext *sr = ctx->priv; int ret, sample_rates[] = { sr->sample_rate, -1 }; - if ((ret = ff_set_common_formats(ctx, ff_all_formats(AVMEDIA_TYPE_AUDIO))) < 0) - return ret; - - if ((ret = ff_set_common_all_channel_counts(ctx)) < 0) - return ret; - if ((ret = ff_formats_ref(ff_all_samplerates(), - &ctx->inputs[0]->outcfg.samplerates)) < 0) + &cfg_in[0]->samplerates)) < 0) return ret; return ff_formats_ref(ff_make_format_list(sample_rates), - &ctx->outputs[0]->incfg.samplerates); + &cfg_out[0]->samplerates); } static av_cold int config_props(AVFilterLink *outlink) @@ -122,7 +118,7 @@ const AVFilter ff_af_asetrate = { .priv_size = sizeof(ASetRateContext), FILTER_INPUTS(asetrate_inputs), FILTER_OUTPUTS(asetrate_outputs), - FILTER_QUERY_FUNC(query_formats), + FILTER_QUERY_FUNC2(query_formats), .priv_class = &asetrate_class, .flags = AVFILTER_FLAG_METADATA_ONLY, };