--- libavformat/concatdec.c | 24 +++++++++++++++++------- 1 file changed, 17 insertions(+), 7 deletions(-)
diff --git a/libavformat/concatdec.c b/libavformat/concatdec.c index f07cfd7..a6bf6ee 100644 --- a/libavformat/concatdec.c +++ b/libavformat/concatdec.c @@ -56,6 +56,7 @@ typedef struct { int seekable; ConcatMatchMode stream_match_mode; unsigned auto_convert; + AVDictionary *options; } ConcatContext; static int concat_probe(AVProbeData *probe) @@ -280,6 +281,7 @@ static int open_file(AVFormatContext *avf, unsigned fileno) ConcatContext *cat = avf->priv_data; ConcatFile *file = &cat->files[fileno]; int ret; + AVDictionary *tmp = NULL; if (cat->avf) avformat_close_input(&cat->avf); @@ -293,11 +295,14 @@ static int open_file(AVFormatContext *avf, unsigned fileno) if ((ret = ff_copy_whitelists(cat->avf, avf)) < 0) return ret; - if ((ret = avformat_open_input(&cat->avf, file->url, NULL, NULL)) < 0 || - (ret = avformat_find_stream_info(cat->avf, NULL)) < 0) { + if (cat->options) + av_dict_copy(&tmp, cat->options, 0); + + if ((ret = avformat_open_input(&cat->avf, file->url, NULL, &tmp)) < 0 || + (ret = avformat_find_stream_info(cat->avf, &tmp)) < 0) { av_log(avf, AV_LOG_ERROR, "Impossible to open '%s'\n", file->url); avformat_close_input(&cat->avf); - return ret; + goto fail; } cat->cur_file = file; if (file->start_time == AV_NOPTS_VALUE) @@ -305,8 +310,10 @@ static int open_file(AVFormatContext *avf, unsigned fileno) cat->files[fileno - 1].start_time + cat->files[fileno - 1].duration; if ((ret = match_streams(avf)) < 0) - return ret; - return 0; + goto fail; +fail: + av_dict_free(&tmp); + return ret; } static int concat_read_close(AVFormatContext *avf) @@ -320,11 +327,12 @@ static int concat_read_close(AVFormatContext *avf) av_freep(&cat->files[i].url); av_freep(&cat->files[i].streams); } + av_dict_free(&cat->options); av_freep(&cat->files); return 0; } -static int concat_read_header(AVFormatContext *avf) +static int concat_read_header(AVFormatContext *avf, AVDictionary **options) { ConcatContext *cat = avf->priv_data; uint8_t buf[4096]; @@ -412,6 +420,8 @@ static int concat_read_header(AVFormatContext *avf) cat->stream_match_mode = avf->nb_streams ? MATCH_EXACT_ID : MATCH_ONE_TO_ONE; + if (options) + av_dict_copy(&cat->options, *options, 0); if ((ret = open_file(avf, 0)) < 0) goto fail; return 0; @@ -644,7 +654,7 @@ AVInputFormat ff_concat_demuxer = { .long_name = NULL_IF_CONFIG_SMALL("Virtual concatenation script"), .priv_data_size = sizeof(ConcatContext), .read_probe = concat_probe, - .read_header = concat_read_header, + .read_header2 = concat_read_header, .read_packet = concat_read_packet, .read_close = concat_read_close, .read_seek2 = concat_seek, -- 2.0.0 _______________________________________________ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel