Browse code

lavf/movenc: Allow to disable writing the timecode track.

Fixes ticket #5492.

Carl Eugen Hoyos authored on 2016/09/26 15:50:48
Showing 3 changed files
... ...
@@ -884,6 +884,9 @@ the new default-base-is-moof flag instead. This flag is new from
884 884
 14496-12:2012. This may make the fragments easier to parse in certain
885 885
 circumstances (avoiding basing track fragment location calculations
886 886
 on the implicit end of the previous track fragment).
887
+@item -write_tmcd
888
+Specify @code{on} to force writing a timecode track, @code{off} to disable it
889
+and @code{auto} to write a timecode track only for mov and mp4 output (default).
887 890
 @end table
888 891
 
889 892
 @subsection Example
... ...
@@ -90,6 +90,7 @@ static const AVOption options[] = {
90 90
     { "encryption_key", "The media encryption key (hex)", offsetof(MOVMuxContext, encryption_key), AV_OPT_TYPE_BINARY, .flags = AV_OPT_FLAG_ENCODING_PARAM },
91 91
     { "encryption_kid", "The media encryption key identifier (hex)", offsetof(MOVMuxContext, encryption_kid), AV_OPT_TYPE_BINARY, .flags = AV_OPT_FLAG_ENCODING_PARAM },
92 92
     { "use_stream_ids_as_track_ids", "use stream ids as track ids", offsetof(MOVMuxContext, use_stream_ids_as_track_ids), AV_OPT_TYPE_BOOL, {.i64 = 0}, 0, 1, AV_OPT_FLAG_ENCODING_PARAM},
93
+    { "write_tmcd", "force or disable writing tmcd", offsetof(MOVMuxContext, write_tmcd), AV_OPT_TYPE_BOOL, {.i64 = -1}, -1, 1, AV_OPT_FLAG_ENCODING_PARAM},
93 94
     { NULL },
94 95
 };
95 96
 
... ...
@@ -2312,7 +2313,7 @@ static int mov_write_minf_tag(AVFormatContext *s, AVIOContext *pb, MOVMuxContext
2312 2312
     } else if (track->tag == MKTAG('r','t','p',' ')) {
2313 2313
         mov_write_hmhd_tag(pb);
2314 2314
     } else if (track->tag == MKTAG('t','m','c','d')) {
2315
-        if (track->mode == MODE_MP4)
2315
+        if (track->mode != MODE_MOV)
2316 2316
             mov_write_nmhd_tag(pb);
2317 2317
         else
2318 2318
             mov_write_gmhd_tag(pb, track);
... ...
@@ -5539,7 +5540,8 @@ static int mov_write_header(AVFormatContext *s)
5539 5539
         }
5540 5540
     }
5541 5541
 
5542
-    if (mov->mode == MODE_MOV || mov->mode == MODE_MP4) {
5542
+    if (   mov->write_tmcd == -1 && (mov->mode == MODE_MOV || mov->mode == MODE_MP4)
5543
+        || mov->write_tmcd == 1) {
5543 5544
         tmcd_track = mov->nb_streams;
5544 5545
 
5545 5546
         /* +1 tmcd track for each video stream with a timecode */
... ...
@@ -219,6 +219,7 @@ typedef struct MOVMuxContext {
219 219
 
220 220
     int use_stream_ids_as_track_ids;
221 221
     int track_ids_ok;
222
+    int write_tmcd;
222 223
 } MOVMuxContext;
223 224
 
224 225
 #define FF_MOV_FLAG_RTP_HINT              (1 <<  0)