diff mbox series

[FFmpeg-devel,12/16] lavfi/src_avsynctest: switch to query_func2()

Message ID 20241001105421.28967-12-anton@khirnov.net
State New
Headers show
Series [FFmpeg-devel,01/16] lavfi/buffersink: move the option sanity check to init | 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

Anton Khirnov Oct. 1, 2024, 10:54 a.m. UTC
---
 libavfilter/src_avsynctest.c | 26 +++++++++++++-------------
 1 file changed, 13 insertions(+), 13 deletions(-)
diff mbox series

Patch

diff --git a/libavfilter/src_avsynctest.c b/libavfilter/src_avsynctest.c
index f78cdd1dec..c46281c72b 100644
--- a/libavfilter/src_avsynctest.c
+++ b/libavfilter/src_avsynctest.c
@@ -93,39 +93,39 @@  static const AVOption avsynctest_options[] = {
 
 AVFILTER_DEFINE_CLASS(avsynctest);
 
-static av_cold int query_formats(AVFilterContext *ctx)
+static av_cold int query_formats(const AVFilterContext *ctx,
+                                 AVFilterFormatsConfig **cfg_in,
+                                 AVFilterFormatsConfig **cfg_out)
 {
-    AVSyncTestContext *s = ctx->priv;
-    AVFilterChannelLayouts *chlayout = NULL;
+    const AVSyncTestContext *s = ctx->priv;
     int sample_rates[] = { s->sample_rate, -1 };
     static const enum AVSampleFormat sample_fmts[] = {
         AV_SAMPLE_FMT_S32, AV_SAMPLE_FMT_NONE
     };
+    static const AVChannelLayout layouts[] = {
+        AV_CHANNEL_LAYOUT_MONO,
+        { .nb_channels = 0 },
+    };
     AVFilterFormats *formats;
     int ret;
 
     formats = ff_make_format_list(sample_fmts);
     if (!formats)
         return AVERROR(ENOMEM);
-    if ((ret = ff_formats_ref(formats, &ctx->outputs[0]->incfg.formats)) < 0)
+    if ((ret = ff_formats_ref(formats, &cfg_out[0]->formats)) < 0)
         return ret;
 
     formats = ff_draw_supported_pixel_formats(0);
     if (!formats)
         return AVERROR(ENOMEM);
-    if ((ret = ff_formats_ref(formats, &ctx->outputs[1]->incfg.formats)) < 0)
+    if ((ret = ff_formats_ref(formats, &cfg_out[1]->formats)) < 0)
         return ret;
 
-    if ((ret = ff_add_channel_layout(&chlayout, &(AVChannelLayout)AV_CHANNEL_LAYOUT_MONO)) < 0)
-        return ret;
-    ret = ff_set_common_channel_layouts(ctx, chlayout);
+    ret = ff_set_common_channel_layouts_from_list2(ctx, cfg_in, cfg_out, layouts);
     if (ret < 0)
         return ret;
 
-    formats = ff_make_format_list(sample_rates);
-    if (!formats)
-        return AVERROR(ENOMEM);
-    return ff_set_common_samplerates(ctx, formats);
+    return ff_set_common_samplerates_from_list2(ctx, cfg_in, cfg_out, sample_rates);
 }
 
 static av_cold int aconfig_props(AVFilterLink *outlink)
@@ -404,6 +404,6 @@  const AVFilter ff_avsrc_avsynctest = {
     .inputs        = NULL,
     .activate      = activate,
     FILTER_OUTPUTS(avsynctest_outputs),
-    FILTER_QUERY_FUNC(query_formats),
+    FILTER_QUERY_FUNC2(query_formats),
     .process_command = ff_filter_process_command,
 };