Commit 30d770ca authored by Michael Niedermayer's avatar Michael Niedermayer

ffmpeg: Allow specifying the program number for created programs

Signed-off-by: 's avatarMichael Niedermayer <michael@niedermayer.cc>
parent 83a04f10
...@@ -355,9 +355,9 @@ To set the language of the first audio stream: ...@@ -355,9 +355,9 @@ To set the language of the first audio stream:
ffmpeg -i INPUT -metadata:s:a:0 language=eng OUTPUT ffmpeg -i INPUT -metadata:s:a:0 language=eng OUTPUT
@end example @end example
@item -program [title=@var{title}:]st=@var{stream}[:st=@var{stream}...] (@emph{output}) @item -program [title=@var{title}:][program_num=@var{program_num}:]st=@var{stream}[:st=@var{stream}...] (@emph{output})
Creates a program with the specified @var{title} and adds the specified Creates a program with the specified @var{title}, @var{program_num} and adds the specified
@var{stream}(s) to it. @var{stream}(s) to it.
@item -target @var{type} (@emph{output}) @item -target @var{type} (@emph{output})
......
...@@ -2418,8 +2418,27 @@ loop_end: ...@@ -2418,8 +2418,27 @@ loop_end:
for (i = 0; i < o->nb_program; i++) { for (i = 0; i < o->nb_program; i++) {
const char *p = o->program[i].u.str; const char *p = o->program[i].u.str;
int progid = i+1; int progid = i+1;
AVProgram *program = av_new_program(oc, progid); AVProgram *program;
while(*p) {
const char *p2 = av_get_token(&p, ":");
char *key;
if (!p2)
break;
if(*p) p++;
key = av_get_token(&p2, "=");
if (!key || !*p2)
break;
p2++;
if (!strcmp(key, "program_num"))
progid = strtol(p2, NULL, 0);
}
program = av_new_program(oc, progid);
p = o->program[i].u.str;
while(*p) { while(*p) {
const char *p2 = av_get_token(&p, ":"); const char *p2 = av_get_token(&p, ":");
char *key; char *key;
...@@ -2440,6 +2459,7 @@ loop_end: ...@@ -2440,6 +2459,7 @@ loop_end:
if (!strcmp(key, "title")) { if (!strcmp(key, "title")) {
av_dict_set(&program->metadata, "title", p2, 0); av_dict_set(&program->metadata, "title", p2, 0);
} else if (!strcmp(key, "program_num")) {
} else if (!strcmp(key, "st")) { } else if (!strcmp(key, "st")) {
int st_num = strtol(p2, NULL, 0); int st_num = strtol(p2, NULL, 0);
av_program_add_stream_index(oc, progid, st_num); av_program_add_stream_index(oc, progid, st_num);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment