Browse code

user setable fourcc

Originally committed as revision 3597 to svn://svn.ffmpeg.org/ffmpeg/trunk

Michael Niedermayer authored on 2004/10/16 10:51:50
Showing 1 changed files
... ...
@@ -133,6 +133,7 @@ static int video_inter_quant_bias= FF_DEFAULT_QUANT_BIAS;
133 133
 static int me_method = ME_EPZS;
134 134
 static int video_disable = 0;
135 135
 static int video_codec_id = CODEC_ID_NONE;
136
+static int video_codec_tag = 0;
136 137
 static int same_quality = 0;
137 138
 static int b_frames = 0;
138 139
 static int mb_decision = FF_MB_DECISION_SIMPLE;
... ...
@@ -200,6 +201,7 @@ static int audio_bit_rate = 64000;
200 200
 static int audio_disable = 0;
201 201
 static int audio_channels = 1;
202 202
 static int audio_codec_id = CODEC_ID_NONE;
203
+static int audio_codec_tag = 0;
203 204
 
204 205
 static int mux_rate= 0;
205 206
 static int mux_packet_size= 0;
... ...
@@ -1489,7 +1491,7 @@ static int av_encode(AVFormatContext **output_files,
1489 1489
             /* if stream_copy is selected, no need to decode or encode */
1490 1490
             codec->codec_id = icodec->codec_id;
1491 1491
             codec->codec_type = icodec->codec_type;
1492
-            codec->codec_tag = icodec->codec_tag;
1492
+            if(!codec->codec_tag) codec->codec_tag = icodec->codec_tag;
1493 1493
             codec->bit_rate = icodec->bit_rate;
1494 1494
             switch(codec->codec_type) {
1495 1495
             case CODEC_TYPE_AUDIO:
... ...
@@ -2613,6 +2615,24 @@ static void opt_audio_codec(const char *arg)
2613 2613
     }
2614 2614
 }
2615 2615
 
2616
+static void opt_audio_tag(const char *arg)
2617
+{
2618
+    char *tail;
2619
+    audio_codec_tag= strtol(arg, &tail, 0);
2620
+
2621
+    if(!tail || *tail)
2622
+        audio_codec_tag= arg[0] + (arg[1]<<8) + (arg[2]<<16) + (arg[3]<<24);
2623
+}
2624
+
2625
+static void opt_video_tag(const char *arg)
2626
+{
2627
+    char *tail;
2628
+    video_codec_tag= strtol(arg, &tail, 0);
2629
+
2630
+    if(!tail || *tail)
2631
+        video_codec_tag= arg[0] + (arg[1]<<8) + (arg[2]<<16) + (arg[3]<<24);
2632
+}
2633
+
2616 2634
 static void add_frame_hooker(const char *arg)
2617 2635
 {
2618 2636
     int argc = 0;
... ...
@@ -2955,6 +2975,9 @@ static void opt_output_file(const char *filename)
2955 2955
 
2956 2956
             video_enc = &st->codec;
2957 2957
             
2958
+            if(video_codec_tag)
2959
+                video_enc->codec_tag= video_codec_tag;
2960
+                
2958 2961
             if(!strcmp(file_oformat->name, "mp4") || !strcmp(file_oformat->name, "mov") || !strcmp(file_oformat->name, "3gp"))
2959 2962
                 video_enc->flags |= CODEC_FLAG_GLOBAL_HEADER;
2960 2963
             if (video_stream_copy) {
... ...
@@ -3205,6 +3228,9 @@ static void opt_output_file(const char *filename)
3205 3205
             audio_enc = &st->codec;
3206 3206
             audio_enc->codec_type = CODEC_TYPE_AUDIO;
3207 3207
 
3208
+            if(audio_codec_tag)
3209
+                audio_enc->codec_tag= audio_codec_tag;
3210
+
3208 3211
             if(!strcmp(file_oformat->name, "mp4") || !strcmp(file_oformat->name, "mov") || !strcmp(file_oformat->name, "3gp"))
3209 3212
                 audio_enc->flags |= CODEC_FLAG_GLOBAL_HEADER;
3210 3213
             if (audio_stream_copy) {
... ...
@@ -3870,6 +3896,7 @@ const OptionDef options[] = {
3870 3870
     { "nssew", OPT_INT | HAS_ARG | OPT_EXPERT | OPT_VIDEO, {(void*)&nsse_weight}, "weight", "" },
3871 3871
     { "subq", OPT_INT | HAS_ARG | OPT_EXPERT | OPT_VIDEO, {(void*)&subpel_quality}, "", "" },
3872 3872
     { "lowres", OPT_INT | HAS_ARG | OPT_EXPERT | OPT_VIDEO, {(void*)&lowres}, "", "" },
3873
+    { "vtag", HAS_ARG | OPT_EXPERT | OPT_VIDEO, {(void*)opt_video_tag}, "force video tag/fourcc", "fourcc/tag" },
3873 3874
 
3874 3875
     /* audio options */
3875 3876
     { "ab", HAS_ARG | OPT_AUDIO, {(void*)opt_audio_bitrate}, "set audio bitrate (in kbit/s)", "bitrate", },
... ...
@@ -3877,6 +3904,7 @@ const OptionDef options[] = {
3877 3877
     { "ac", HAS_ARG | OPT_AUDIO, {(void*)opt_audio_channels}, "set number of audio channels", "channels" },
3878 3878
     { "an", OPT_BOOL | OPT_AUDIO, {(void*)&audio_disable}, "disable audio" },
3879 3879
     { "acodec", HAS_ARG | OPT_AUDIO, {(void*)opt_audio_codec}, "force audio codec ('copy' to copy stream)", "codec" },
3880
+    { "atag", HAS_ARG | OPT_EXPERT | OPT_AUDIO, {(void*)opt_audio_tag}, "force audio tag/fourcc", "fourcc/tag" },
3880 3881
 
3881 3882
     /* grab options */
3882 3883
     { "vd", HAS_ARG | OPT_EXPERT | OPT_VIDEO | OPT_GRAB, {(void*)opt_video_device}, "set video grab device", "device" },