[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
Thu May 19 15:14:58 EEST 2022


On Wed, May 18, 2022 at 10:50:58PM +0800, "zhilizhao(赵志立)" wrote:
> 
> 
> > On May 8, 2022, at 3:17 PM, 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:
> 
> Looks like ‘Format options’ is copy-paste error from format_opts.

Yes, will fix it, thanks.

> 
> > + 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
> > 
> > _______________________________________________
> > ffmpeg-devel mailing list
> > ffmpeg-devel at ffmpeg.org
> > https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
> > 
> > To unsubscribe, visit link above, or email
> > ffmpeg-devel-request at ffmpeg.org with subject "unsubscribe".
> 

-- 
Thanks,
Limin Wang


More information about the ffmpeg-devel mailing list