lavf/concat: add support for chapters
This commit is contained in:
parent
1a0aff8ca5
commit
2263ff505c
@ -184,6 +184,10 @@ Can be present multiple times.
|
|||||||
@item @code{stream_codec @var{value}}
|
@item @code{stream_codec @var{value}}
|
||||||
Codec for the stream.
|
Codec for the stream.
|
||||||
|
|
||||||
|
@item @code{cahpter @var{id} @var{start} @var{end}}
|
||||||
|
Add a chapter. @var{id} is an unique identifier, possibly small and
|
||||||
|
consecutive.
|
||||||
|
|
||||||
@end table
|
@end table
|
||||||
|
|
||||||
@subsection Options
|
@subsection Options
|
||||||
|
@ -408,7 +408,7 @@ static int concat_read_close(AVFormatContext *avf)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
#define MAX_ARGS 2
|
#define MAX_ARGS 3
|
||||||
#define NEEDS_UNSAFE (1 << 1)
|
#define NEEDS_UNSAFE (1 << 1)
|
||||||
#define NEEDS_FILE (1 << 1)
|
#define NEEDS_FILE (1 << 1)
|
||||||
#define NEEDS_STREAM (1 << 2)
|
#define NEEDS_STREAM (1 << 2)
|
||||||
@ -432,6 +432,7 @@ typedef enum ParseDirective {
|
|||||||
DIR_EXSID,
|
DIR_EXSID,
|
||||||
DIR_STMETA,
|
DIR_STMETA,
|
||||||
DIR_STCODEC,
|
DIR_STCODEC,
|
||||||
|
DIR_CHAPTER,
|
||||||
} ParseDirective;
|
} ParseDirective;
|
||||||
|
|
||||||
static const ParseSyntax syntax[] = {
|
static const ParseSyntax syntax[] = {
|
||||||
@ -447,6 +448,7 @@ static const ParseSyntax syntax[] = {
|
|||||||
[DIR_EXSID ] = { "exact_stream_id", "i", NEEDS_STREAM },
|
[DIR_EXSID ] = { "exact_stream_id", "i", NEEDS_STREAM },
|
||||||
[DIR_STMETA ] = { "stream_meta", "ks", NEEDS_STREAM },
|
[DIR_STMETA ] = { "stream_meta", "ks", NEEDS_STREAM },
|
||||||
[DIR_STCODEC ] = { "stream_codec", "k", NEEDS_STREAM },
|
[DIR_STCODEC ] = { "stream_codec", "k", NEEDS_STREAM },
|
||||||
|
[DIR_CHAPTER ] = { "chapter", "idd", 0 },
|
||||||
};
|
};
|
||||||
|
|
||||||
static int concat_parse_script(AVFormatContext *avf)
|
static int concat_parse_script(AVFormatContext *avf)
|
||||||
@ -457,6 +459,7 @@ static int concat_parse_script(AVFormatContext *avf)
|
|||||||
uint8_t *cursor, *keyword;
|
uint8_t *cursor, *keyword;
|
||||||
ConcatFile *file = NULL;
|
ConcatFile *file = NULL;
|
||||||
AVStream *stream = NULL;
|
AVStream *stream = NULL;
|
||||||
|
AVChapter *chapter = NULL;
|
||||||
unsigned line = 0, arg;
|
unsigned line = 0, arg;
|
||||||
const ParseSyntax *dir;
|
const ParseSyntax *dir;
|
||||||
char *arg_kw[MAX_ARGS];
|
char *arg_kw[MAX_ARGS];
|
||||||
@ -609,6 +612,13 @@ static int concat_parse_script(AVFormatContext *avf)
|
|||||||
break;
|
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:
|
default:
|
||||||
FAIL(AVERROR_BUG);
|
FAIL(AVERROR_BUG);
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user