Merge commit '36ef5369ee9b336febc2c270f8718cec4476cb85'
[ffmpeg.git] / libavformat / electronicarts.c
index 3d51c70..c5533f2 100644 (file)
 typedef struct EaDemuxContext {
     int big_endian;
 
-    enum CodecID video_codec;
+    enum AVCodecID video_codec;
     AVRational time_base;
     int width, height;
     int nb_frames;
     int video_stream_index;
 
-    enum CodecID audio_codec;
+    enum AVCodecID audio_codec;
     int audio_stream_index;
 
     int bytes;
@@ -175,25 +175,25 @@ static int process_audio_header_elements(AVFormatContext *s)
     }
 
     switch (compression_type) {
-    case  0: ea->audio_codec = CODEC_ID_PCM_S16LE; break;
-    case  7: ea->audio_codec = CODEC_ID_ADPCM_EA; break;
+    case  0: ea->audio_codec = AV_CODEC_ID_PCM_S16LE; break;
+    case  7: ea->audio_codec = AV_CODEC_ID_ADPCM_EA; break;
     case -1:
         switch (revision) {
-        case  1: ea->audio_codec = CODEC_ID_ADPCM_EA_R1; break;
-        case  2: ea->audio_codec = CODEC_ID_ADPCM_EA_R2; break;
-        case  3: ea->audio_codec = CODEC_ID_ADPCM_EA_R3; break;
+        case  1: ea->audio_codec = AV_CODEC_ID_ADPCM_EA_R1; break;
+        case  2: ea->audio_codec = AV_CODEC_ID_ADPCM_EA_R2; break;
+        case  3: ea->audio_codec = AV_CODEC_ID_ADPCM_EA_R3; break;
         case -1: break;
         default:
             av_log(s, AV_LOG_ERROR, "unsupported stream type; revision=%i\n", revision);
             return 0;
         }
         switch (revision2) {
-        case  8: ea->audio_codec = CODEC_ID_PCM_S16LE_PLANAR; break;
-        case 10: ea->audio_codec = CODEC_ID_ADPCM_EA_R2; break;
-        case 16: ea->audio_codec = CODEC_ID_MP3; break;
+        case  8: ea->audio_codec = AV_CODEC_ID_PCM_S16LE_PLANAR; break;
+        case 10: ea->audio_codec = AV_CODEC_ID_ADPCM_EA_R2; break;
+        case 16: ea->audio_codec = AV_CODEC_ID_MP3; break;
         case -1: break;
         default:
-            ea->audio_codec = CODEC_ID_NONE;
+            ea->audio_codec = AV_CODEC_ID_NONE;
             av_log(s, AV_LOG_ERROR, "unsupported stream type; revision2=%i\n", revision2);
             return 0;
         }
@@ -228,12 +228,12 @@ static int process_audio_header_eacs(AVFormatContext *s)
     switch (compression_type) {
     case 0:
         switch (ea->bytes) {
-        case 1: ea->audio_codec = CODEC_ID_PCM_S8;    break;
-        case 2: ea->audio_codec = CODEC_ID_PCM_S16LE; break;
+        case 1: ea->audio_codec = AV_CODEC_ID_PCM_S8;    break;
+        case 2: ea->audio_codec = AV_CODEC_ID_PCM_S16LE; break;
         }
         break;
-    case 1: ea->audio_codec = CODEC_ID_PCM_MULAW; ea->bytes = 1; break;
-    case 2: ea->audio_codec = CODEC_ID_ADPCM_IMA_EA_EACS; break;
+    case 1: ea->audio_codec = AV_CODEC_ID_PCM_MULAW; ea->bytes = 1; break;
+    case 2: ea->audio_codec = AV_CODEC_ID_ADPCM_IMA_EA_EACS; break;
     default:
         av_log (s, AV_LOG_ERROR, "unsupported stream type; audio compression_type=%i\n", compression_type);
     }
@@ -253,7 +253,7 @@ static int process_audio_header_sead(AVFormatContext *s)
     ea->sample_rate  = avio_rl32(pb);
     ea->bytes        = avio_rl32(pb);  /* 1=8-bit, 2=16-bit */
     ea->num_channels = avio_rl32(pb);
-    ea->audio_codec  = CODEC_ID_ADPCM_IMA_EA_SEAD;
+    ea->audio_codec  = AV_CODEC_ID_ADPCM_IMA_EA_SEAD;
 
     return 1;
 }
@@ -266,7 +266,7 @@ static int process_video_header_mdec(AVFormatContext *s)
     ea->width  = avio_rl16(pb);
     ea->height = avio_rl16(pb);
     ea->time_base = (AVRational){1,15};
-    ea->video_codec = CODEC_ID_MDEC;
+    ea->video_codec = AV_CODEC_ID_MDEC;
     return 1;
 }
 
@@ -280,7 +280,7 @@ static int process_video_header_vp6(AVFormatContext *s)
     avio_skip(pb, 4);
     ea->time_base.den = avio_rl32(pb);
     ea->time_base.num = avio_rl32(pb);
-    ea->video_codec = CODEC_ID_VP6;
+    ea->video_codec = AV_CODEC_ID_VP6;
 
     return 1;
 }
@@ -294,7 +294,7 @@ static int process_video_header_cmv(AVFormatContext *s)
     fps = avio_rl16(s->pb);
     if (fps)
         ea->time_base = (AVRational){1, fps};
-    ea->video_codec = CODEC_ID_CMV;
+    ea->video_codec = AV_CODEC_ID_CMV;
 
     return 0;
 }
@@ -350,7 +350,7 @@ static int process_ea_header(AVFormatContext *s) {
                 break;
 
             case kVGT_TAG:
-                ea->video_codec = CODEC_ID_TGV;
+                ea->video_codec = AV_CODEC_ID_TGV;
                 break;
 
             case mTCD_TAG :
@@ -358,20 +358,20 @@ static int process_ea_header(AVFormatContext *s) {
                 break;
 
             case MPCh_TAG:
-                ea->video_codec = CODEC_ID_MPEG2VIDEO;
+                ea->video_codec = AV_CODEC_ID_MPEG2VIDEO;
                 break;
 
             case pQGT_TAG:
             case TGQs_TAG:
-                ea->video_codec = CODEC_ID_TGQ;
+                ea->video_codec = AV_CODEC_ID_TGQ;
                 break;
 
             case pIQT_TAG:
-                ea->video_codec = CODEC_ID_TQI;
+                ea->video_codec = AV_CODEC_ID_TQI;
                 break;
 
             case MADk_TAG :
-                ea->video_codec = CODEC_ID_MAD;
+                ea->video_codec = AV_CODEC_ID_MAD;
                 break;
 
             case MVhd_TAG :
@@ -431,7 +431,7 @@ static int ea_read_header(AVFormatContext *s)
         st->codec->codec_type = AVMEDIA_TYPE_VIDEO;
         st->codec->codec_id = ea->video_codec;
         // parsing is necessary to make FFmpeg generate correct timestamps
-        if (st->codec->codec_id == CODEC_ID_MPEG2VIDEO)
+        if (st->codec->codec_id == AV_CODEC_ID_MPEG2VIDEO)
             st->need_parsing = AVSTREAM_PARSE_HEADERS;
         st->codec->codec_tag = 0;  /* no fourcc */
         st->codec->width = ea->width;
@@ -456,7 +456,7 @@ static int ea_read_header(AVFormatContext *s)
         }
         if (ea->bytes <= 0) {
             av_log(s, AV_LOG_ERROR, "Invalid number of bytes per sample: %d\n", ea->bytes);
-            ea->audio_codec = CODEC_ID_NONE;
+            ea->audio_codec = AV_CODEC_ID_NONE;
             return 1;
         }
 
@@ -515,8 +515,8 @@ static int ea_read_packet(AVFormatContext *s,
             if (!ea->audio_codec) {
                 avio_skip(pb, chunk_size);
                 break;
-            } else if (ea->audio_codec == CODEC_ID_PCM_S16LE_PLANAR ||
-                       ea->audio_codec == CODEC_ID_MP3) {
+            } else if (ea->audio_codec == AV_CODEC_ID_PCM_S16LE_PLANAR ||
+                       ea->audio_codec == AV_CODEC_ID_MP3) {
                 num_samples = avio_rl32(pb);
                 avio_skip(pb, 8);
                 chunk_size -= 12;
@@ -532,20 +532,20 @@ static int ea_read_packet(AVFormatContext *s,
             pkt->stream_index = ea->audio_stream_index;
 
             switch (ea->audio_codec) {
-            case CODEC_ID_ADPCM_EA:
-            case CODEC_ID_ADPCM_EA_R1:
-            case CODEC_ID_ADPCM_EA_R2:
-            case CODEC_ID_ADPCM_IMA_EA_EACS:
+            case AV_CODEC_ID_ADPCM_EA:
+            case AV_CODEC_ID_ADPCM_EA_R1:
+            case AV_CODEC_ID_ADPCM_EA_R2:
+            case AV_CODEC_ID_ADPCM_IMA_EA_EACS:
                 pkt->duration = AV_RL32(pkt->data);
                 break;
-            case CODEC_ID_ADPCM_EA_R3:
+            case AV_CODEC_ID_ADPCM_EA_R3:
                 pkt->duration = AV_RB32(pkt->data);
                 break;
-            case CODEC_ID_ADPCM_IMA_EA_SEAD:
+            case AV_CODEC_ID_ADPCM_IMA_EA_SEAD:
                 pkt->duration = ret * 2 / ea->num_channels;
                 break;
-            case CODEC_ID_PCM_S16LE_PLANAR:
-            case CODEC_ID_MP3:
+            case AV_CODEC_ID_PCM_S16LE_PLANAR:
+            case AV_CODEC_ID_MP3:
                 pkt->duration = num_samples;
                 break;
             default: