diff mbox series

[FFmpeg-devel,13/16] lavfi/src_movie: switch to query_func2()

Message ID 20241001105421.28967-13-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_movie.c | 24 +++++++++++++-----------
 1 file changed, 13 insertions(+), 11 deletions(-)
diff mbox series

Patch

diff --git a/libavfilter/src_movie.c b/libavfilter/src_movie.c
index e7817c7ee7..65091b65f0 100644
--- a/libavfilter/src_movie.c
+++ b/libavfilter/src_movie.c
@@ -411,34 +411,36 @@  static av_cold void movie_uninit(AVFilterContext *ctx)
         avformat_close_input(&movie->format_ctx);
 }
 
-static int movie_query_formats(AVFilterContext *ctx)
+static int movie_query_formats(const AVFilterContext *ctx,
+                               AVFilterFormatsConfig **cfg_in,
+                               AVFilterFormatsConfig **cfg_out)
 {
-    MovieContext *movie = ctx->priv;
+    const MovieContext *movie = ctx->priv;
     int list[] = { 0, -1 };
     AVChannelLayout list64[] = { { 0 }, { 0 } };
     int i, ret;
 
     for (i = 0; i < ctx->nb_outputs; i++) {
-        MovieStream *st = &movie->st[i];
-        AVCodecParameters *c = st->st->codecpar;
-        AVFilterLink *outlink = ctx->outputs[i];
+        const MovieStream *st = &movie->st[i];
+        const AVCodecParameters *c = st->st->codecpar;
+        AVFilterFormatsConfig *cfg = cfg_out[i];
 
         switch (c->codec_type) {
         case AVMEDIA_TYPE_VIDEO:
             list[0] = c->format;
-            if ((ret = ff_formats_ref(ff_make_format_list(list), &outlink->incfg.formats)) < 0)
+            if ((ret = ff_formats_ref(ff_make_format_list(list), &cfg->formats)) < 0)
                 return ret;
             break;
         case AVMEDIA_TYPE_AUDIO:
             list[0] = c->format;
-            if ((ret = ff_formats_ref(ff_make_format_list(list), &outlink->incfg.formats)) < 0)
+            if ((ret = ff_formats_ref(ff_make_format_list(list), &cfg->formats)) < 0)
                 return ret;
             list[0] = c->sample_rate;
-            if ((ret = ff_formats_ref(ff_make_format_list(list), &outlink->incfg.samplerates)) < 0)
+            if ((ret = ff_formats_ref(ff_make_format_list(list), &cfg->samplerates)) < 0)
                 return ret;
             list64[0] = c->ch_layout;
             if ((ret = ff_channel_layouts_ref(ff_make_channel_layout_list(list64),
-                                   &outlink->incfg.channel_layouts)) < 0)
+                                   &cfg->channel_layouts)) < 0)
                 return ret;
             break;
         }
@@ -681,7 +683,7 @@  const AVFilter ff_avsrc_movie = {
     .init          = movie_common_init,
     .activate      = activate,
     .uninit        = movie_uninit,
-    FILTER_QUERY_FUNC(movie_query_formats),
+    FILTER_QUERY_FUNC2(movie_query_formats),
 
     .inputs    = NULL,
     .outputs   = NULL,
@@ -701,7 +703,7 @@  const AVFilter ff_avsrc_amovie = {
     .init          = movie_common_init,
     .activate      = activate,
     .uninit        = movie_uninit,
-    FILTER_QUERY_FUNC(movie_query_formats),
+    FILTER_QUERY_FUNC2(movie_query_formats),
 
     .inputs     = NULL,
     .outputs    = NULL,