diff options
author | Nicolas George <george@nsup.org> | 2021-08-31 15:57:48 +0200 |
---|---|---|
committer | Nicolas George <george@nsup.org> | 2021-09-16 10:17:59 +0200 |
commit | 2263ff505c986f03005674072c1d46f0723143ea (patch) | |
tree | acb3394d77924bb6384a113615aa1a7484c1e6b0 /libavformat/concatdec.c | |
parent | 1a0aff8ca56d3695eedbc015f7f7dad991ef9bf5 (diff) | |
download | ffmpeg-2263ff505c986f03005674072c1d46f0723143ea.tar.gz |
lavf/concat: add support for chapters
Diffstat (limited to 'libavformat/concatdec.c')
-rw-r--r-- | libavformat/concatdec.c | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/libavformat/concatdec.c b/libavformat/concatdec.c index a0d68d51cc..0dd39a149e 100644 --- a/libavformat/concatdec.c +++ b/libavformat/concatdec.c @@ -408,7 +408,7 @@ static int concat_read_close(AVFormatContext *avf) return 0; } -#define MAX_ARGS 2 +#define MAX_ARGS 3 #define NEEDS_UNSAFE (1 << 1) #define NEEDS_FILE (1 << 1) #define NEEDS_STREAM (1 << 2) @@ -432,6 +432,7 @@ typedef enum ParseDirective { DIR_EXSID, DIR_STMETA, DIR_STCODEC, + DIR_CHAPTER, } ParseDirective; static const ParseSyntax syntax[] = { @@ -447,6 +448,7 @@ static const ParseSyntax syntax[] = { [DIR_EXSID ] = { "exact_stream_id", "i", NEEDS_STREAM }, [DIR_STMETA ] = { "stream_meta", "ks", NEEDS_STREAM }, [DIR_STCODEC ] = { "stream_codec", "k", NEEDS_STREAM }, + [DIR_CHAPTER ] = { "chapter", "idd", 0 }, }; static int concat_parse_script(AVFormatContext *avf) @@ -457,6 +459,7 @@ static int concat_parse_script(AVFormatContext *avf) uint8_t *cursor, *keyword; ConcatFile *file = NULL; AVStream *stream = NULL; + AVChapter *chapter = NULL; unsigned line = 0, arg; const ParseSyntax *dir; char *arg_kw[MAX_ARGS]; @@ -609,6 +612,13 @@ static int concat_parse_script(AVFormatContext *avf) break; } + case DIR_CHAPTER: + chapter = avpriv_new_chapter(avf, arg_int[0], AV_TIME_BASE_Q, + arg_int[1], arg_int[2], NULL); + if (!chapter) + return AVERROR(ENOMEM); + break; + default: FAIL(AVERROR_BUG); } |