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

Anton Khirnov anton at khirnov.net
Tue Oct 1 13:54:18 EEST 2024


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

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,
-- 
2.43.0



More information about the ffmpeg-devel mailing list