[FFmpeg-devel] [PATCH 5/8] lavfi/af_adynamicequalizer: convert to query_func2()

Anton Khirnov anton at khirnov.net
Thu Aug 29 11:50:49 EEST 2024


Drop redundant ff_set_common_all_channel_counts() /
ff_set_common_all_samplerates() calls, since those happen implicitly in
generic code.
---
 libavfilter/af_adynamicequalizer.c | 16 ++++++++--------
 1 file changed, 8 insertions(+), 8 deletions(-)

diff --git a/libavfilter/af_adynamicequalizer.c b/libavfilter/af_adynamicequalizer.c
index 7a102cad22..ba03faff60 100644
--- a/libavfilter/af_adynamicequalizer.c
+++ b/libavfilter/af_adynamicequalizer.c
@@ -110,9 +110,11 @@ typedef struct AudioDynamicEqualizerContext {
     ChannelContext *cc;
 } AudioDynamicEqualizerContext;
 
-static int query_formats(AVFilterContext *ctx)
+static int query_formats(const AVFilterContext *ctx,
+                         AVFilterFormatsConfig **cfg_in,
+                         AVFilterFormatsConfig **cfg_out)
 {
-    AudioDynamicEqualizerContext *s = ctx->priv;
+    const AudioDynamicEqualizerContext *s = ctx->priv;
     static const enum AVSampleFormat sample_fmts[3][3] = {
         { AV_SAMPLE_FMT_FLTP, AV_SAMPLE_FMT_DBLP, AV_SAMPLE_FMT_NONE },
         { AV_SAMPLE_FMT_FLTP, AV_SAMPLE_FMT_NONE },
@@ -120,13 +122,11 @@ static int query_formats(AVFilterContext *ctx)
     };
     int ret;
 
-    if ((ret = ff_set_common_all_channel_counts(ctx)) < 0)
+    if ((ret = ff_set_common_formats_from_list2(ctx, cfg_in, cfg_out,
+                                                sample_fmts[s->precision])) < 0)
         return ret;
 
-    if ((ret = ff_set_common_formats_from_list(ctx, sample_fmts[s->precision])) < 0)
-        return ret;
-
-    return ff_set_common_all_samplerates(ctx);
+    return 0;
 }
 
 static double get_coef(double x, double sr)
@@ -281,7 +281,7 @@ const AVFilter ff_af_adynamicequalizer = {
     .uninit          = uninit,
     FILTER_INPUTS(inputs),
     FILTER_OUTPUTS(ff_audio_default_filterpad),
-    FILTER_QUERY_FUNC(query_formats),
+    FILTER_QUERY_FUNC2(query_formats),
     .flags           = AVFILTER_FLAG_SUPPORT_TIMELINE_INTERNAL |
                        AVFILTER_FLAG_SLICE_THREADS,
     .process_command = ff_filter_process_command,
-- 
2.43.0



More information about the ffmpeg-devel mailing list