Browse code

ffmpeg_opt: Allow -metadata option to set metadata on programs.

Signed-off-by: Vittorio Gambaletta <ffmpeg-dev@vittgam.net>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>

Vittorio Gambaletta (VittGam) authored on 2016/01/26 23:13:09
Showing 2 changed files
... ...
@@ -339,8 +339,8 @@ see @ref{date syntax,,the Date section in the ffmpeg-utils(1) manual,ffmpeg-util
339 339
 Set a metadata key/value pair.
340 340
 
341 341
 An optional @var{metadata_specifier} may be given to set metadata
342
-on streams or chapters. See @code{-map_metadata} documentation for
343
-details.
342
+on streams, chapters or programs. See @code{-map_metadata}
343
+documentation for details.
344 344
 
345 345
 This option overrides metadata set with @code{-map_metadata}. It is
346 346
 also possible to delete metadata by using an empty value.
... ...
@@ -2466,6 +2466,13 @@ loop_end:
2466 2466
                 }
2467 2467
                 m = &oc->chapters[index]->metadata;
2468 2468
                 break;
2469
+            case 'p':
2470
+                if (index < 0 || index >= oc->nb_programs) {
2471
+                    av_log(NULL, AV_LOG_FATAL, "Invalid program index %d in metadata specifier.\n", index);
2472
+                    exit_program(1);
2473
+                }
2474
+                m = &oc->programs[index]->metadata;
2475
+                break;
2469 2476
             default:
2470 2477
                 av_log(NULL, AV_LOG_FATAL, "Invalid metadata specifier %s.\n", o->metadata[i].specifier);
2471 2478
                 exit_program(1);