diff mov.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 dba191dda275
children 11bb10c37225
line wrap: on
line diff
--- a/mov.c	Tue Mar 30 15:50:57 2010 +0000
+++ b/mov.c	Tue Mar 30 23:30:55 2010 +0000
@@ -411,13 +411,13 @@
     dprintf(c->fc, "stype= %.4s\n", (char*)&type);
 
     if     (type == MKTAG('v','i','d','e'))
-        st->codec->codec_type = CODEC_TYPE_VIDEO;
+        st->codec->codec_type = AVMEDIA_TYPE_VIDEO;
     else if(type == MKTAG('s','o','u','n'))
-        st->codec->codec_type = CODEC_TYPE_AUDIO;
+        st->codec->codec_type = AVMEDIA_TYPE_AUDIO;
     else if(type == MKTAG('m','1','a',' '))
         st->codec->codec_id = CODEC_ID_MP2;
     else if(type == MKTAG('s','u','b','p'))
-        st->codec->codec_type = CODEC_TYPE_SUBTITLE;
+        st->codec->codec_type = AVMEDIA_TYPE_SUBTITLE;
 
     get_be32(pb); /* component  manufacture */
     get_be32(pb); /* component flags */
@@ -933,19 +933,19 @@
         if (id<=0 && ((format&0xFFFF) == 'm'+('s'<<8) || (format&0xFFFF) == 'T'+('S'<<8)))
             id = ff_codec_get_id(ff_codec_wav_tags, bswap_32(format)&0xFFFF);
 
-        if (st->codec->codec_type != CODEC_TYPE_VIDEO && id > 0) {
-            st->codec->codec_type = CODEC_TYPE_AUDIO;
-        } else if (st->codec->codec_type != CODEC_TYPE_AUDIO && /* do not overwrite codec type */
+        if (st->codec->codec_type != AVMEDIA_TYPE_VIDEO && id > 0) {
+            st->codec->codec_type = AVMEDIA_TYPE_AUDIO;
+        } else if (st->codec->codec_type != AVMEDIA_TYPE_AUDIO && /* do not overwrite codec type */
                    format && format != MKTAG('m','p','4','s')) { /* skip old asf mpeg4 tag */
             id = ff_codec_get_id(codec_movvideo_tags, format);
             if (id <= 0)
                 id = ff_codec_get_id(ff_codec_bmp_tags, format);
             if (id > 0)
-                st->codec->codec_type = CODEC_TYPE_VIDEO;
-            else if(st->codec->codec_type == CODEC_TYPE_DATA){
+                st->codec->codec_type = AVMEDIA_TYPE_VIDEO;
+            else if(st->codec->codec_type == AVMEDIA_TYPE_DATA){
                 id = ff_codec_get_id(ff_codec_movsubtitle_tags, format);
                 if(id > 0)
-                    st->codec->codec_type = CODEC_TYPE_SUBTITLE;
+                    st->codec->codec_type = AVMEDIA_TYPE_SUBTITLE;
             }
         }
 
@@ -953,7 +953,7 @@
                 (format >> 0) & 0xff, (format >> 8) & 0xff, (format >> 16) & 0xff,
                 (format >> 24) & 0xff, st->codec->codec_type);
 
-        if(st->codec->codec_type==CODEC_TYPE_VIDEO) {
+        if(st->codec->codec_type==AVMEDIA_TYPE_VIDEO) {
             unsigned int color_depth, len;
             int color_greyscale;
 
@@ -1057,7 +1057,7 @@
                 }
                 st->codec->palctrl->palette_changed = 1;
             }
-        } else if(st->codec->codec_type==CODEC_TYPE_AUDIO) {
+        } else if(st->codec->codec_type==AVMEDIA_TYPE_AUDIO) {
             int bits_per_sample, flags;
             uint16_t version = get_be16(pb);
 
@@ -1137,7 +1137,7 @@
                 st->codec->bits_per_coded_sample = bits_per_sample;
                 sc->sample_size = (bits_per_sample >> 3) * st->codec->channels;
             }
-        } else if(st->codec->codec_type==CODEC_TYPE_SUBTITLE){
+        } else if(st->codec->codec_type==AVMEDIA_TYPE_SUBTITLE){
             // ttxt stsd contains display flags, justification, background
             // color, fonts, and default styles, so fake an atom to read it
             MOVAtom fake_atom = { .size = size - (url_ftell(pb) - start_pos) };
@@ -1159,7 +1159,7 @@
             url_fskip(pb, a.size);
     }
 
-    if(st->codec->codec_type==CODEC_TYPE_AUDIO && st->codec->sample_rate==0 && sc->time_scale>1)
+    if(st->codec->codec_type==AVMEDIA_TYPE_AUDIO && st->codec->sample_rate==0 && sc->time_scale>1)
         st->codec->sample_rate= sc->time_scale;
 
     /* special codec parameters handling */
@@ -1196,7 +1196,7 @@
         break;
     case CODEC_ID_MP2:
     case CODEC_ID_MP3:
-        st->codec->codec_type = CODEC_TYPE_AUDIO; /* force type after stsd for m1a hdlr */
+        st->codec->codec_type = AVMEDIA_TYPE_AUDIO; /* force type after stsd for m1a hdlr */
         st->need_parsing = AVSTREAM_PARSE_FULL;
         break;
     case CODEC_ID_GSM:
@@ -1490,7 +1490,7 @@
     }
 
     /* only use old uncompressed audio chunk demuxing when stts specifies it */
-    if (!(st->codec->codec_type == CODEC_TYPE_AUDIO &&
+    if (!(st->codec->codec_type == AVMEDIA_TYPE_AUDIO &&
           sc->stts_count == 1 && sc->stts_data[0].duration == 1)) {
         unsigned int current_sample = 0;
         unsigned int stts_sample = 0;
@@ -1698,7 +1698,7 @@
     if (!sc) return AVERROR(ENOMEM);
 
     st->priv_data = sc;
-    st->codec->codec_type = CODEC_TYPE_DATA;
+    st->codec->codec_type = AVMEDIA_TYPE_DATA;
     sc->ffindex = st->index;
 
     if ((ret = mov_read_default(c, pb, atom)) < 0)
@@ -1721,7 +1721,7 @@
 
     av_set_pts_info(st, 64, 1, sc->time_scale);
 
-    if (st->codec->codec_type == CODEC_TYPE_AUDIO &&
+    if (st->codec->codec_type == AVMEDIA_TYPE_AUDIO &&
         !st->codec->frame_size && sc->stts_count == 1) {
         st->codec->frame_size = av_rescale(sc->stts_data[0].duration,
                                            st->codec->sample_rate, sc->time_scale);
@@ -1741,7 +1741,7 @@
     } else
         sc->pb = c->fc->pb;
 
-    if (st->codec->codec_type == CODEC_TYPE_VIDEO) {
+    if (st->codec->codec_type == AVMEDIA_TYPE_VIDEO) {
         if (st->codec->width != sc->width || st->codec->height != sc->height) {
             AVRational r = av_d2q(((double)st->codec->height * sc->width) /
                                   ((double)st->codec->width * sc->height), INT_MAX);
@@ -2004,7 +2004,7 @@
             sc->ctts_data[sc->ctts_count].duration = get_be32(pb);
             sc->ctts_count++;
         }
-        if ((keyframe = st->codec->codec_type == CODEC_TYPE_AUDIO ||
+        if ((keyframe = st->codec->codec_type == AVMEDIA_TYPE_AUDIO ||
              (flags & 0x004 && !i && !sample_flags) || sample_flags & 0x2000000))
             distance = 0;
         av_add_index_entry(st, offset, dts, sample_size, distance,