mirror of
https://github.com/FFmpeg/FFmpeg.git
synced 2024-11-21 10:55:51 +02:00
lavf/concatdec: support stream metadata
This commit is contained in:
parent
76cf1ff979
commit
c753b49c38
@ -177,6 +177,10 @@ subfiles will be used.
|
|||||||
This is especially useful for MPEG-PS (VOB) files, where the order of the
|
This is especially useful for MPEG-PS (VOB) files, where the order of the
|
||||||
streams is not reliable.
|
streams is not reliable.
|
||||||
|
|
||||||
|
@item @code{stream_meta @var{key} @var{value}}
|
||||||
|
Metadata for the stream.
|
||||||
|
Can be present multiple times.
|
||||||
|
|
||||||
@end table
|
@end table
|
||||||
|
|
||||||
@subsection Options
|
@subsection Options
|
||||||
|
@ -430,6 +430,7 @@ typedef enum ParseDirective {
|
|||||||
DIR_OPTION,
|
DIR_OPTION,
|
||||||
DIR_STREAM,
|
DIR_STREAM,
|
||||||
DIR_EXSID,
|
DIR_EXSID,
|
||||||
|
DIR_STMETA,
|
||||||
} ParseDirective;
|
} ParseDirective;
|
||||||
|
|
||||||
static const ParseSyntax syntax[] = {
|
static const ParseSyntax syntax[] = {
|
||||||
@ -443,6 +444,7 @@ static const ParseSyntax syntax[] = {
|
|||||||
[DIR_OPTION ] = { "option", "ks", NEEDS_FILE | NEEDS_UNSAFE },
|
[DIR_OPTION ] = { "option", "ks", NEEDS_FILE | NEEDS_UNSAFE },
|
||||||
[DIR_STREAM ] = { "stream", "", 0 },
|
[DIR_STREAM ] = { "stream", "", 0 },
|
||||||
[DIR_EXSID ] = { "exact_stream_id", "i", NEEDS_STREAM },
|
[DIR_EXSID ] = { "exact_stream_id", "i", NEEDS_STREAM },
|
||||||
|
[DIR_STMETA ] = { "stream_meta", "ks", NEEDS_STREAM },
|
||||||
};
|
};
|
||||||
|
|
||||||
static int concat_parse_script(AVFormatContext *avf)
|
static int concat_parse_script(AVFormatContext *avf)
|
||||||
@ -452,6 +454,7 @@ static int concat_parse_script(AVFormatContext *avf)
|
|||||||
AVBPrint bp;
|
AVBPrint bp;
|
||||||
uint8_t *cursor, *keyword;
|
uint8_t *cursor, *keyword;
|
||||||
ConcatFile *file = NULL;
|
ConcatFile *file = NULL;
|
||||||
|
AVStream *stream = 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];
|
||||||
@ -578,12 +581,19 @@ static int concat_parse_script(AVFormatContext *avf)
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case DIR_STREAM:
|
case DIR_STREAM:
|
||||||
if (!avformat_new_stream(avf, NULL))
|
stream = avformat_new_stream(avf, NULL);
|
||||||
|
if (!stream)
|
||||||
FAIL(AVERROR(ENOMEM));
|
FAIL(AVERROR(ENOMEM));
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case DIR_EXSID:
|
case DIR_EXSID:
|
||||||
avf->streams[avf->nb_streams - 1]->id = arg_int[0];
|
stream->id = arg_int[0];
|
||||||
|
break;
|
||||||
|
case DIR_STMETA:
|
||||||
|
ret = av_dict_set(&stream->metadata, arg_kw[0], arg_str[1], AV_DICT_DONT_STRDUP_VAL);
|
||||||
|
arg_str[1] = NULL;
|
||||||
|
if (ret < 0)
|
||||||
|
FAIL(ret);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
|
Loading…
Reference in New Issue
Block a user