diff movenc.c @ 5910:536e5527c1e0 libavformat

Define AVMediaType enum, and use it instead of enum CodecType, which is deprecated and will be dropped at the next major bump.
author stefano
date Tue, 30 Mar 2010 23:30:55 +0000
parents 2fb291f12e5f
children 11bb10c37225
line wrap: on
line diff
--- a/movenc.c	Tue Mar 30 15:50:57 2010 +0000
+++ b/movenc.c	Tue Mar 30 23:30:55 2010 +0000
@@ -333,7 +333,7 @@
 
     // the following fields is made of 6 bits to identify the streamtype (4 for video, 5 for audio)
     // plus 1 bit to indicate upstream and 1 bit set to 1 (reserved)
-    if(track->enc->codec_type == CODEC_TYPE_AUDIO)
+    if(track->enc->codec_type == AVMEDIA_TYPE_AUDIO)
         put_byte(pb, 0x15); // flags (= Audiostream)
     else
         put_byte(pb, 0x11); // flags (= Visualstream)
@@ -620,8 +620,8 @@
     else if (track->enc->codec_id == CODEC_ID_AC3)       tag = MKTAG('a','c','-','3');
     else if (track->enc->codec_id == CODEC_ID_DIRAC)     tag = MKTAG('d','r','a','c');
     else if (track->enc->codec_id == CODEC_ID_MOV_TEXT)  tag = MKTAG('t','x','3','g');
-    else if (track->enc->codec_type == CODEC_TYPE_VIDEO) tag = MKTAG('m','p','4','v');
-    else if (track->enc->codec_type == CODEC_TYPE_AUDIO) tag = MKTAG('m','p','4','a');
+    else if (track->enc->codec_type == AVMEDIA_TYPE_VIDEO) tag = MKTAG('m','p','4','v');
+    else if (track->enc->codec_type == AVMEDIA_TYPE_AUDIO) tag = MKTAG('m','p','4','a');
 
     return tag;
 }
@@ -642,7 +642,7 @@
     int tag = track->enc->codec_tag;
 
     // keep original tag for subs, ipod supports both formats
-    if (!(track->enc->codec_type == CODEC_TYPE_SUBTITLE &&
+    if (!(track->enc->codec_type == AVMEDIA_TYPE_SUBTITLE &&
         (tag == MKTAG('t','x','3','g') ||
          tag == MKTAG('t','e','x','t'))))
         tag = ff_codec_get_tag(codec_ipod_tags, track->enc->codec_id);
@@ -714,7 +714,7 @@
             tag = mov_get_dv_codec_tag(s, track);
         else if (track->enc->codec_id == CODEC_ID_RAWVIDEO)
             tag = mov_get_rawvideo_codec_tag(s, track);
-        else if (track->enc->codec_type == CODEC_TYPE_VIDEO) {
+        else if (track->enc->codec_type == AVMEDIA_TYPE_VIDEO) {
             tag = ff_codec_get_tag(codec_movvideo_tags, track->enc->codec_id);
             if (!tag) { // if no mac fcc found, try with Microsoft tags
                 tag = ff_codec_get_tag(ff_codec_bmp_tags, track->enc->codec_id);
@@ -722,7 +722,7 @@
                     av_log(s, AV_LOG_INFO, "Warning, using MS style video codec tag, "
                            "the file may be unplayable!\n");
             }
-        } else if (track->enc->codec_type == CODEC_TYPE_AUDIO) {
+        } else if (track->enc->codec_type == AVMEDIA_TYPE_AUDIO) {
             tag = ff_codec_get_tag(codec_movaudio_tags, track->enc->codec_id);
             if (!tag) { // if no mac fcc found, try with Microsoft tags
                 int ms_tag = ff_codec_get_tag(ff_codec_wav_tags, track->enc->codec_id);
@@ -732,7 +732,7 @@
                            "the file may be unplayable!\n");
                 }
             }
-        } else if (track->enc->codec_type == CODEC_TYPE_SUBTITLE)
+        } else if (track->enc->codec_type == AVMEDIA_TYPE_SUBTITLE)
             tag = ff_codec_get_tag(ff_codec_movsubtitle_tags, track->enc->codec_id);
     }
 
@@ -868,11 +868,11 @@
     put_tag(pb, "stsd");
     put_be32(pb, 0); /* version & flags */
     put_be32(pb, 1); /* entry count */
-    if (track->enc->codec_type == CODEC_TYPE_VIDEO)
+    if (track->enc->codec_type == AVMEDIA_TYPE_VIDEO)
         mov_write_video_tag(pb, track);
-    else if (track->enc->codec_type == CODEC_TYPE_AUDIO)
+    else if (track->enc->codec_type == AVMEDIA_TYPE_AUDIO)
         mov_write_audio_tag(pb, track);
-    else if (track->enc->codec_type == CODEC_TYPE_SUBTITLE)
+    else if (track->enc->codec_type == AVMEDIA_TYPE_SUBTITLE)
         mov_write_subtitle_tag(pb, track);
     return updateSize(pb, pos);
 }
@@ -918,7 +918,7 @@
     uint32_t atom_size;
     int i;
 
-    if (track->enc->codec_type == CODEC_TYPE_AUDIO && !track->audio_vbr) {
+    if (track->enc->codec_type == AVMEDIA_TYPE_AUDIO && !track->audio_vbr) {
         stts_entries = av_malloc(sizeof(*stts_entries)); /* one entry */
         stts_entries[0].count = track->sampleCount;
         stts_entries[0].duration = 1;
@@ -973,12 +973,12 @@
     put_tag(pb, "stbl");
     mov_write_stsd_tag(pb, track);
     mov_write_stts_tag(pb, track);
-    if (track->enc->codec_type == CODEC_TYPE_VIDEO &&
+    if (track->enc->codec_type == AVMEDIA_TYPE_VIDEO &&
         track->hasKeyframes && track->hasKeyframes < track->entry)
         mov_write_stss_tag(pb, track, MOV_SYNC_SAMPLE);
     if (track->mode == MODE_MOV && track->flags & MOV_TRACK_STPS)
         mov_write_stss_tag(pb, track, MOV_PARTIAL_SYNC_SAMPLE);
-    if (track->enc->codec_type == CODEC_TYPE_VIDEO &&
+    if (track->enc->codec_type == AVMEDIA_TYPE_VIDEO &&
         track->flags & MOV_TRACK_CTTS)
         mov_write_ctts_tag(pb, track);
     mov_write_stsc_tag(pb, track);
@@ -1050,13 +1050,13 @@
         descr = "DataHandler";
     } else {
         hdlr = (track->mode == MODE_MOV) ? "mhlr" : "\0\0\0\0";
-        if (track->enc->codec_type == CODEC_TYPE_VIDEO) {
+        if (track->enc->codec_type == AVMEDIA_TYPE_VIDEO) {
             hdlr_type = "vide";
             descr = "VideoHandler";
-        } else if (track->enc->codec_type == CODEC_TYPE_AUDIO) {
+        } else if (track->enc->codec_type == AVMEDIA_TYPE_AUDIO) {
             hdlr_type = "soun";
             descr = "SoundHandler";
-        } else if (track->enc->codec_type == CODEC_TYPE_SUBTITLE) {
+        } else if (track->enc->codec_type == AVMEDIA_TYPE_SUBTITLE) {
             if (track->tag == MKTAG('t','x','3','g')) hdlr_type = "sbtl";
             else                                      hdlr_type = "text";
             descr = "SubtitleHandler";
@@ -1084,11 +1084,11 @@
     int64_t pos = url_ftell(pb);
     put_be32(pb, 0); /* size */
     put_tag(pb, "minf");
-    if(track->enc->codec_type == CODEC_TYPE_VIDEO)
+    if(track->enc->codec_type == AVMEDIA_TYPE_VIDEO)
         mov_write_vmhd_tag(pb);
-    else if (track->enc->codec_type == CODEC_TYPE_AUDIO)
+    else if (track->enc->codec_type == AVMEDIA_TYPE_AUDIO)
         mov_write_smhd_tag(pb);
-    else if (track->enc->codec_type == CODEC_TYPE_SUBTITLE) {
+    else if (track->enc->codec_type == AVMEDIA_TYPE_SUBTITLE) {
         if (track->tag == MKTAG('t','e','x','t')) mov_write_gmhd_tag(pb);
         else                                      mov_write_nmhd_tag(pb);
     }
@@ -1165,7 +1165,7 @@
     put_be32(pb, 0); /* reserved */
     put_be32(pb, 0x0); /* reserved (Layer & Alternate group) */
     /* Volume, only for audio */
-    if(track->enc->codec_type == CODEC_TYPE_AUDIO)
+    if(track->enc->codec_type == AVMEDIA_TYPE_AUDIO)
         put_be16(pb, 0x0100);
     else
         put_be16(pb, 0);
@@ -1183,8 +1183,8 @@
     put_be32(pb, 0x40000000); /* reserved */
 
     /* Track width and height, for visual only */
-    if(track->enc->codec_type == CODEC_TYPE_VIDEO ||
-       track->enc->codec_type == CODEC_TYPE_SUBTITLE) {
+    if(track->enc->codec_type == AVMEDIA_TYPE_VIDEO ||
+       track->enc->codec_type == AVMEDIA_TYPE_SUBTITLE) {
         double sample_aspect_ratio = av_q2d(st->sample_aspect_ratio);
         if(!sample_aspect_ratio || track->height != track->enc->height)
             sample_aspect_ratio = 1;
@@ -1671,7 +1671,7 @@
 
     for (i = 0; i < s->nb_streams; i++) {
         AVStream *st = s->streams[i];
-        if (st->codec->codec_type == CODEC_TYPE_VIDEO)
+        if (st->codec->codec_type == AVMEDIA_TYPE_VIDEO)
             has_video = 1;
         if (st->codec->codec_id == CODEC_ID_H264)
             has_h264 = 1;
@@ -1829,7 +1829,7 @@
                    "codec not currently supported in container\n", i);
             goto error;
         }
-        if(st->codec->codec_type == CODEC_TYPE_VIDEO){
+        if(st->codec->codec_type == AVMEDIA_TYPE_VIDEO){
             if (track->tag == MKTAG('m','x','3','p') || track->tag == MKTAG('m','x','3','n') ||
                 track->tag == MKTAG('m','x','4','p') || track->tag == MKTAG('m','x','4','n') ||
                 track->tag == MKTAG('m','x','5','p') || track->tag == MKTAG('m','x','5','n')) {
@@ -1845,7 +1845,7 @@
                        "WARNING codec timebase is very high. If duration is too long,\n"
                        "file may not be playable by quicktime. Specify a shorter timebase\n"
                        "or choose different container.\n");
-        }else if(st->codec->codec_type == CODEC_TYPE_AUDIO){
+        }else if(st->codec->codec_type == AVMEDIA_TYPE_AUDIO){
             track->timescale = st->codec->sample_rate;
             if(!st->codec->frame_size && !av_get_bits_per_sample(st->codec->codec_id)) {
                 av_log(s, AV_LOG_ERROR, "track %d: codec frame size is not set\n", i);
@@ -1868,7 +1868,7 @@
                     goto error;
                 }
             }
-        }else if(st->codec->codec_type == CODEC_TYPE_SUBTITLE){
+        }else if(st->codec->codec_type == AVMEDIA_TYPE_SUBTITLE){
             track->timescale = st->codec->time_base.den;
         }
         if (!track->height)