[FFmpeg-cvslog] lavfi/af_agate: convert to query_func2()

Anton Khirnov git at videolan.org
Thu Sep 5 11:08:58 EEST 2024


ffmpeg | branch: master | Anton Khirnov <anton at khirnov.net> | Thu Aug 29 09:10:01 2024 +0200| [f1437230950639268f7c63dfd49622c60a603541] | committer: Anton Khirnov

lavfi/af_agate: 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.

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=f1437230950639268f7c63dfd49622c60a603541
---

 libavfilter/af_agate.c | 24 +++++++++++++-----------
 1 file changed, 13 insertions(+), 11 deletions(-)

diff --git a/libavfilter/af_agate.c b/libavfilter/af_agate.c
index d725485950..09655b7f82 100644
--- a/libavfilter/af_agate.c
+++ b/libavfilter/af_agate.c
@@ -310,26 +310,28 @@ static int activate(AVFilterContext *ctx)
     return 0;
 }
 
-static int scquery_formats(AVFilterContext *ctx)
+static int scquery_formats(const AVFilterContext *ctx,
+                           AVFilterFormatsConfig **cfg_in,
+                           AVFilterFormatsConfig **cfg_out)
 {
     static const enum AVSampleFormat sample_fmts[] = {
         AV_SAMPLE_FMT_DBL,
         AV_SAMPLE_FMT_NONE
     };
-    int ret = ff_channel_layouts_ref(ff_all_channel_counts(),
-                                     &ctx->inputs[1]->outcfg.channel_layouts);
-    if (ret < 0)
-        return ret;
+    int ret;
 
-    /* This will link the channel properties of the main input and the output;
-     * it won't touch the second input as its channel_layouts is already set. */
-    if ((ret = ff_set_common_all_channel_counts(ctx)) < 0)
+    /* Generic code will link the channel properties of the main input and the
+     * output; it won't touch the second input as its channel_layouts is already
+     * set. */
+    ret = ff_channel_layouts_ref(ff_all_channel_counts(),
+                                 &cfg_in[1]->channel_layouts);
+    if (ret < 0)
         return ret;
 
-    if ((ret = ff_set_common_formats_from_list(ctx, sample_fmts)) < 0)
+    if ((ret = ff_set_common_formats_from_list2(ctx, cfg_in, cfg_out, sample_fmts)) < 0)
         return ret;
 
-    return ff_set_common_all_samplerates(ctx);
+    return 0;
 }
 
 static int scconfig_output(AVFilterLink *outlink)
@@ -385,7 +387,7 @@ const AVFilter ff_af_sidechaingate = {
     .uninit         = uninit,
     FILTER_INPUTS(sidechaingate_inputs),
     FILTER_OUTPUTS(sidechaingate_outputs),
-    FILTER_QUERY_FUNC(scquery_formats),
+    FILTER_QUERY_FUNC2(scquery_formats),
     .process_command = ff_filter_process_command,
     .flags          = AVFILTER_FLAG_SUPPORT_TIMELINE_INTERNAL,
 };



More information about the ffmpeg-cvslog mailing list