[FFmpeg-devel] [PATCH 1/2] avfilter/src_movie: add dec_opts for the opened file
lance.lmwang at gmail.com
lance.lmwang at gmail.com
Wed May 18 16:43:14 EEST 2022
On Sun, May 08, 2022 at 03:17:00PM +0800, lance.lmwang at gmail.com wrote:
> From: Limin Wang <lance.lmwang at gmail.com>
>
> Signed-off-by: Limin Wang <lance.lmwang at gmail.com>
> ---
> doc/filters.texi | 9 +++++++++
> libavfilter/src_movie.c | 5 ++++-
> 2 files changed, 13 insertions(+), 1 deletion(-)
>
> diff --git a/doc/filters.texi b/doc/filters.texi
> index 367614d2f8..6775cf43ba 100644
> --- a/doc/filters.texi
> +++ b/doc/filters.texi
> @@ -29652,6 +29652,15 @@ shows how to add protocol_whitelist and protocol_blacklist options:
> ffplay -f lavfi
> "movie=filename='1.sdp':format_opts='protocol_whitelist=file,rtp,udp\:protocol_blacklist=http'"
> @end example
> +
> + at item dec_opts
> +Specify decode options for the opened file. Format options can be specified
> +as a list of @var{key}=@var{value} pairs separated by ':'. The following example
> +shows how to add export_side_data options:
> + at example
> +./ffmpeg -y -f lavfi
> +-i "movie=./input.ts:dec_opts=export_side_data=scte20cc[out0+subcc]" out.srt
> + at end example
> @end table
>
> It allows overlaying a second video on top of the main input of
> diff --git a/libavfilter/src_movie.c b/libavfilter/src_movie.c
> index 711854c23c..c7dbd90aa9 100644
> --- a/libavfilter/src_movie.c
> +++ b/libavfilter/src_movie.c
> @@ -70,6 +70,7 @@ typedef struct MovieContext {
> int64_t discontinuity_threshold;
> int64_t ts_offset;
> int dec_threads;
> + AVDictionary *dec_opts;
>
> AVFormatContext *format_ctx;
>
> @@ -96,6 +97,7 @@ static const AVOption movie_options[]= {
> { "discontinuity", "set discontinuity threshold", OFFSET(discontinuity_threshold), AV_OPT_TYPE_DURATION, {.i64 = 0}, 0, INT64_MAX, FLAGS },
> { "dec_threads", "set the number of threads for decoding", OFFSET(dec_threads), AV_OPT_TYPE_INT, {.i64 = 0}, 0, INT_MAX, FLAGS },
> { "format_opts", "set format options for the opened file", OFFSET(format_opts), AV_OPT_TYPE_DICT, {.str = NULL}, 0, 0, FLAGS},
> + { "dec_opts", "set decode options for the opened file", OFFSET(dec_opts), AV_OPT_TYPE_DICT, {.str = NULL}, 0, 0, FLAGS},
> { NULL },
> };
>
> @@ -158,6 +160,7 @@ static AVStream *find_stream(void *log, AVFormatContext *avf, const char *spec)
>
> static int open_stream(AVFilterContext *ctx, MovieStream *st, int dec_threads)
> {
> + MovieContext *movie = ctx->priv;
> const AVCodec *codec;
> int ret;
>
> @@ -179,7 +182,7 @@ static int open_stream(AVFilterContext *ctx, MovieStream *st, int dec_threads)
> dec_threads = ff_filter_get_nb_threads(ctx);
> st->codec_ctx->thread_count = dec_threads;
>
> - if ((ret = avcodec_open2(st->codec_ctx, codec, NULL)) < 0) {
> + if ((ret = avcodec_open2(st->codec_ctx, codec, &movie->dec_opts)) < 0) {
> av_log(ctx, AV_LOG_ERROR, "Failed to open codec\n");
> return ret;
> }
> --
> 2.35.1
>
will apply the patchset tomorrow if no other comments or objection.
--
Thanks,
Limin Wang
More information about the ffmpeg-devel
mailing list