aboutsummaryrefslogtreecommitdiffstats
path: root/ffmpeg_opt.c
diff options
context:
space:
mode:
authorMichael Niedermayer <michael@niedermayer.cc>2015-12-10 21:01:19 +0100
committerMichael Niedermayer <michael@niedermayer.cc>2015-12-11 22:27:25 +0100
commit8f948b6244e4e25156fc075c139f9ebd7a3a4bd1 (patch)
treef4f048943d2ee00fbd27afa5178615dcb0e2ae69 /ffmpeg_opt.c
parent676a93f2d86d704ab6a973a19000e265c14e37d5 (diff)
downloadffmpeg-8f948b6244e4e25156fc075c139f9ebd7a3a4bd1.tar.gz
ffmpeg: Add basic support to mux multiple programs
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
Diffstat (limited to 'ffmpeg_opt.c')
-rw-r--r--ffmpeg_opt.c38
1 files changed, 38 insertions, 0 deletions
diff --git a/ffmpeg_opt.c b/ffmpeg_opt.c
index 131dd89b52..fd2c0517cf 100644
--- a/ffmpeg_opt.c
+++ b/ffmpeg_opt.c
@@ -2414,6 +2414,42 @@ loop_end:
}
}
+ /* process manually set programs */
+ for (i = 0; i < o->nb_program; i++) {
+ const char *p = o->program[i].u.str;
+ int progid = i+1;
+ AVProgram *program = av_new_program(oc, progid);
+
+ while(*p) {
+ const char *p2 = av_get_token(&p, ":");
+ char *key;
+ if (!p2)
+ break;
+ if(*p) p++;
+
+ key = av_get_token(&p2, "=");
+ if (!key) {
+ av_log(NULL, AV_LOG_FATAL,
+ "No '=' character in program string %s.\n",
+ p2);
+ exit_program(1);
+ }
+ if (!*p2)
+ exit_program(1);
+ p2++;
+
+ if (!strcmp(key, "title")) {
+ av_dict_set(&program->metadata, "title", p2, 0);
+ } else if (!strcmp(key, "st")) {
+ int st_num = strtol(p2, NULL, 0);
+ av_program_add_stream_index(oc, progid, st_num);
+ } else {
+ av_log(NULL, AV_LOG_FATAL, "Unknown program key %s.\n", key);
+ exit_program(1);
+ }
+ }
+ }
+
return 0;
}
@@ -3093,6 +3129,8 @@ const OptionDef options[] = {
"set the recording timestamp ('now' to set the current time)", "time" },
{ "metadata", HAS_ARG | OPT_STRING | OPT_SPEC | OPT_OUTPUT, { .off = OFFSET(metadata) },
"add metadata", "string=string" },
+ { "program", HAS_ARG | OPT_STRING | OPT_SPEC | OPT_OUTPUT, { .off = OFFSET(program) },
+ "add program with specified streams", "title=string:st=number..." },
{ "dframes", HAS_ARG | OPT_PERFILE | OPT_EXPERT |
OPT_OUTPUT, { .func_arg = opt_data_frames },
"set the number of data frames to output", "number" },