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

Anton Khirnov git at videolan.org
Mon Sep 9 18:26:51 EEST 2024


ffmpeg | branch: master | Anton Khirnov <anton at khirnov.net> | Tue Sep  3 10:29:51 2024 +0200| [84fda7de7948a52e4551c65faa794063e1e945e6] | committer: Anton Khirnov

lavfi/af_channelsplit: convert to query_func2()

Also, drop a redundant call that also happens implicitly in generic code.

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

 libavfilter/af_channelsplit.c | 14 ++++++++------
 1 file changed, 8 insertions(+), 6 deletions(-)

diff --git a/libavfilter/af_channelsplit.c b/libavfilter/af_channelsplit.c
index 527c197fa6..64b6c7a1e1 100644
--- a/libavfilter/af_channelsplit.c
+++ b/libavfilter/af_channelsplit.c
@@ -118,18 +118,20 @@ static av_cold void uninit(AVFilterContext *ctx)
     av_freep(&s->map);
 }
 
-static int query_formats(AVFilterContext *ctx)
+static int query_formats(const AVFilterContext *ctx,
+                         AVFilterFormatsConfig **cfg_in,
+                         AVFilterFormatsConfig **cfg_out)
 {
     ChannelSplitContext *s = ctx->priv;
     AVFilterChannelLayouts *in_layouts = NULL;
     int i, ret;
 
-    if ((ret = ff_set_common_formats(ctx, ff_planar_sample_fmts())) < 0 ||
-        (ret = ff_set_common_all_samplerates(ctx)) < 0)
+    ret = ff_set_common_formats2(ctx, cfg_in, cfg_out, ff_planar_sample_fmts());
+    if (ret < 0)
         return ret;
 
     if ((ret = ff_add_channel_layout(&in_layouts, &s->channel_layout)) < 0 ||
-        (ret = ff_channel_layouts_ref(in_layouts, &ctx->inputs[0]->outcfg.channel_layouts)) < 0)
+        (ret = ff_channel_layouts_ref(in_layouts, &cfg_in[0]->channel_layouts)) < 0)
         return ret;
 
     for (i = 0; i < ctx->nb_outputs; i++) {
@@ -156,7 +158,7 @@ static int query_formats(AVFilterContext *ctx)
         if (ret < 0)
             return ret;
 
-        ret = ff_channel_layouts_ref(out_layouts, &ctx->outputs[i]->incfg.channel_layouts);
+        ret = ff_channel_layouts_ref(out_layouts, &cfg_out[i]->channel_layouts);
         if (ret < 0)
             return ret;
     }
@@ -249,6 +251,6 @@ const AVFilter ff_af_channelsplit = {
     .uninit         = uninit,
     FILTER_INPUTS(ff_audio_default_filterpad),
     .outputs        = NULL,
-    FILTER_QUERY_FUNC(query_formats),
+    FILTER_QUERY_FUNC2(query_formats),
     .flags          = AVFILTER_FLAG_DYNAMIC_OUTPUTS,
 };



More information about the ffmpeg-cvslog mailing list