Browse code

movenc: Allow override of major brand in ftyp atom

Signed-off-by: Tim Walker <tdskywalker@gmail.com>
(cherry picked from commit 1e9db41e2a2166be5671b088ef4ad06a40af459f)

John Stebbins authored on 2014/03/18 22:11:00
Showing 2 changed files
... ...
@@ -64,6 +64,7 @@ static const AVOption options[] = {
64 64
     { "min_frag_duration", "Minimum fragment duration", offsetof(MOVMuxContext, min_fragment_duration), AV_OPT_TYPE_INT, {.i64 = 0}, 0, INT_MAX, AV_OPT_FLAG_ENCODING_PARAM},
65 65
     { "frag_size", "Maximum fragment size", offsetof(MOVMuxContext, max_fragment_size), AV_OPT_TYPE_INT, {.i64 = 0}, 0, INT_MAX, AV_OPT_FLAG_ENCODING_PARAM},
66 66
     { "ism_lookahead", "Number of lookahead entries for ISM files", offsetof(MOVMuxContext, ism_lookahead), AV_OPT_TYPE_INT, {.i64 = 0}, 0, INT_MAX, AV_OPT_FLAG_ENCODING_PARAM},
67
+    { "brand",    "Override major brand", offsetof(MOVMuxContext, major_brand),   AV_OPT_TYPE_STRING, {.str = NULL}, .flags = AV_OPT_FLAG_ENCODING_PARAM },
67 68
     { NULL },
68 69
 };
69 70
 
... ...
@@ -2564,7 +2565,9 @@ static int mov_write_ftyp_tag(AVIOContext *pb, AVFormatContext *s)
2564 2564
     avio_wb32(pb, 0); /* size */
2565 2565
     ffio_wfourcc(pb, "ftyp");
2566 2566
 
2567
-    if (mov->mode == MODE_3GP) {
2567
+    if (mov->major_brand && strlen(mov->major_brand) >= 4)
2568
+        ffio_wfourcc(pb, mov->major_brand);
2569
+    else if (mov->mode == MODE_3GP) {
2568 2570
         ffio_wfourcc(pb, has_h264 ? "3gp6"  : "3gp4");
2569 2571
         minor =     has_h264 ?   0x100 :   0x200;
2570 2572
     } else if (mov->mode & MODE_3G2) {
... ...
@@ -159,6 +159,8 @@ typedef struct MOVMuxContext {
159 159
     AVIOContext *mdat_buf;
160 160
 
161 161
     int64_t reserved_moov_pos;
162
+
163
+    char *major_brand;
162 164
 } MOVMuxContext;
163 165
 
164 166
 #define FF_MOV_FLAG_RTP_HINT 1