diff options
author | Nicolas George <nicolas.george@normalesup.org> | 2013-02-13 17:25:56 +0100 |
---|---|---|
committer | Nicolas George <nicolas.george@normalesup.org> | 2013-02-24 13:12:46 +0100 |
commit | ea2de3d09614fcfe53b9406cce57a1bf8cf6d5cd (patch) | |
tree | 61efbd6e05faac03bbc8794d02f0d45bdbaa44d5 /libavformat/concatdec.c | |
parent | b92c7a8f4b55f15dd05130f24b9300c42a806655 (diff) | |
download | ffmpeg-ea2de3d09614fcfe53b9406cce57a1bf8cf6d5cd.tar.gz |
lavf/concatdec: add the "duration" directive.
Diffstat (limited to 'libavformat/concatdec.c')
-rw-r--r-- | libavformat/concatdec.c | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/libavformat/concatdec.c b/libavformat/concatdec.c index f1fb169259..2858befa3d 100644 --- a/libavformat/concatdec.c +++ b/libavformat/concatdec.c @@ -20,6 +20,7 @@ #include "libavutil/avstring.h" #include "libavutil/opt.h" +#include "libavutil/parseutils.h" #include "avformat.h" #include "internal.h" @@ -174,6 +175,20 @@ static int concat_read_header(AVFormatContext *avf) } if ((ret = add_file(avf, filename, &file, &nb_files_alloc)) < 0) FAIL(ret); + } else if (!strcmp(keyword, "duration")) { + char *dur_str = get_keyword(&cursor); + int64_t dur; + if (!file) { + av_log(avf, AV_LOG_ERROR, "Line %d: duration without file\n", + line); + FAIL(AVERROR_INVALIDDATA); + } + if ((ret = av_parse_time(&dur, dur_str, 1)) < 0) { + av_log(avf, AV_LOG_ERROR, "Line %d: invalid duration '%s'\n", + line, dur_str); + FAIL(ret); + } + file->duration = dur; } else if (!strcmp(keyword, "ffconcat")) { char *ver_kw = get_keyword(&cursor); char *ver_val = get_keyword(&cursor); |