[FFmpeg-devel] [PATCH 2/5] lavf/concatdec: support per-file options.

Andreas Rheinhardt andreas.rheinhardt at outlook.com
Thu Jul 29 01:07:36 EEST 2021


Nicolas George:
> Signed-off-by: Nicolas George <george at nsup.org>
> ---
>  doc/demuxers.texi       |  4 ++++
>  libavformat/concatdec.c | 37 ++++++++++++++++++++++++++++++++++++-
>  2 files changed, 40 insertions(+), 1 deletion(-)
> 
> 
> I intend to refactor the parser some time later.
> 
> 
> diff --git a/doc/demuxers.texi b/doc/demuxers.texi
> index 5f18e4551b..eb3351833a 100644
> --- a/doc/demuxers.texi
> +++ b/doc/demuxers.texi
> @@ -151,6 +151,10 @@ Metadata of the packets of the file. The specified metadata will be set for
>  each file packet. You can specify this directive multiple times to add multiple
>  metadata entries.
>  
> + at item @code{option @var{key} @var{value}}
> +Option to access, open and probe the file.
> +Can be present multiple times.
> +
>  @item @code{stream}
>  Introduce a stream in the virtual file.
>  All subsequent stream-related directives apply to the last introduced
> diff --git a/libavformat/concatdec.c b/libavformat/concatdec.c
> index 3db1693725..0203b1e6dc 100644
> --- a/libavformat/concatdec.c
> +++ b/libavformat/concatdec.c
> @@ -51,6 +51,7 @@ typedef struct {
>      int64_t inpoint;
>      int64_t outpoint;
>      AVDictionary *metadata;
> +    AVDictionary *options;
>      int nb_streams;
>  } ConcatFile;
>  
> @@ -329,6 +330,7 @@ static int open_file(AVFormatContext *avf, unsigned fileno)
>  {
>      ConcatContext *cat = avf->priv_data;
>      ConcatFile *file = &cat->files[fileno];
> +    AVDictionary *options = NULL;
>      int ret;
>  
>      if (cat->avf)
> @@ -344,12 +346,21 @@ static int open_file(AVFormatContext *avf, unsigned fileno)
>      if ((ret = ff_copy_whiteblacklists(cat->avf, avf)) < 0)
>          return ret;
>  
> -    if ((ret = avformat_open_input(&cat->avf, file->url, NULL, NULL)) < 0 ||
> +    ret = av_dict_copy(&options, file->options, 0);
> +    if (ret < 0)
> +        return ret;

In case of failure, options needs to be freed.

- Andreas


More information about the ffmpeg-devel mailing list