diff mbox series

[FFmpeg-devel,04/25] lavfi/af_channelsplit: convert to query_func2()

Message ID 20240905100729.6030-4-anton@khirnov.net
State New
Headers show
Series [FFmpeg-devel,01/25] lavfi/af_channelmap: remove an arbitrary limit on channel count | expand

Checks

Context Check Description
yinshiyou/make_loongarch64 success Make finished
yinshiyou/make_fate_loongarch64 success Make fate finished
andriy/make_x86 success Make finished
andriy/make_fate_x86 success Make fate finished

Commit Message

FFmpeg Technical Committee Sept. 5, 2024, 10:07 a.m. UTC
Also, drop a redundant call that also happens implicitly in generic code.
---
 libavfilter/af_channelsplit.c | 14 ++++++++------
 1 file changed, 8 insertions(+), 6 deletions(-)
diff mbox series

Patch

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,
 };