[FFmpeg-devel] [PATCH] avfilter/src_movie: Expose format options

Ignacio Losiggio iglosiggio at dc.uba.ar
Mon May 10 01:37:24 EEST 2021


Add a dict-typed option to movie/amovie called format_options that
allows forwarding of the options to avformat_open_input.

Signed-off-by: Ignacio Losiggio <iglosiggio at gmail.com>
---
 libavfilter/src_movie.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/libavfilter/src_movie.c b/libavfilter/src_movie.c
index 54f6738f9a..c47fabd348 100644
--- a/libavfilter/src_movie.c
+++ b/libavfilter/src_movie.c
@@ -61,6 +61,7 @@ typedef struct MovieContext {
     int64_t seek_point;   ///< seekpoint in microseconds
     double seek_point_d;
     char *format_name;
+    AVDictionary *format_options;
     char *file_name;
     char *stream_specs; /**< user-provided list of streams, separated by + */
     int stream_index; /**< for compatibility */
@@ -90,6 +91,7 @@ static const AVOption movie_options[]= {
     { "s",            "set streams",             OFFSET(stream_specs), AV_OPT_TYPE_STRING, {.str =  0},  0, 0, FLAGS },
     { "loop",         "set loop count",          OFFSET(loop_count),   AV_OPT_TYPE_INT,    {.i64 =  1},  0,        INT_MAX, FLAGS },
     { "discontinuity", "set discontinuity threshold", OFFSET(discontinuity_threshold), AV_OPT_TYPE_DURATION, {.i64 = 0}, 0, INT64_MAX, FLAGS },
+    { "format_options","set format options",          OFFSET(format_options),          AV_OPT_TYPE_DICT,                      .flags = FLAGS },
     { NULL },
 };
 
@@ -239,7 +241,7 @@ static av_cold int movie_common_init(AVFilterContext *ctx)
     iformat = movie->format_name ? av_find_input_format(movie->format_name) : NULL;
 
     movie->format_ctx = NULL;
-    if ((ret = avformat_open_input(&movie->format_ctx, movie->file_name, iformat, NULL)) < 0) {
+    if ((ret = avformat_open_input(&movie->format_ctx, movie->file_name, iformat, &movie->format_options)) < 0) {
         av_log(ctx, AV_LOG_ERROR,
                "Failed to avformat_open_input '%s'\n", movie->file_name);
         return ret;
-- 
2.31.1



More information about the ffmpeg-devel mailing list