]> git.sesse.net Git - ffmpeg/blobdiff - libavformat/electronicarts.c
Rework link property configuration system.
[ffmpeg] / libavformat / electronicarts.c
index 33f2cea481332a1ba30d4b532e5466970431d612..0201e82004650cdb6efef7b8acc93e3ae6fea4a1 100644 (file)
@@ -91,7 +91,7 @@ static int process_audio_header_elements(AVFormatContext *s)
     int inHeader = 1;
     EaDemuxContext *ea = s->priv_data;
     ByteIOContext *pb = s->pb;
-    int compression_type = -1, revision = -1;
+    int compression_type = -1, revision = -1, revision2 = -1;
 
     ea->bytes = 2;
     ea->sample_rate = -1;
@@ -136,6 +136,10 @@ static int process_audio_header_elements(AVFormatContext *s)
                     av_log (s, AV_LOG_INFO, "exited audio subheader\n");
                     inSubheader = 0;
                     break;
+                case 0xA0:
+                    revision2 = read_arbitary(pb);
+                    av_log (s, AV_LOG_INFO, "revision2 (element 0xA0) set to 0x%08x\n", revision2);
+                    break;
                 case 0xFF:
                     av_log (s, AV_LOG_INFO, "end of header block reached (within audio subheader)\n");
                     inSubheader = 0;
@@ -165,10 +169,17 @@ static int process_audio_header_elements(AVFormatContext *s)
         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: 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;
+        default:
+            av_log(s, AV_LOG_ERROR, "unsupported stream type; revision2=%i\n", revision2);
+            return 0;
+        }
         break;
     default:
         av_log(s, AV_LOG_ERROR, "unsupported stream type; compression_type=%i\n", compression_type);
@@ -392,6 +403,9 @@ static int ea_read_packet(AVFormatContext *s,
             if (!ea->audio_codec) {
                 url_fskip(pb, chunk_size);
                 break;
+            } else if (ea->audio_codec == CODEC_ID_PCM_S16LE_PLANAR) {
+                url_fskip(pb, 12);  /* planar header */
+                chunk_size -= 12;
             }
             ret = av_get_packet(pb, pkt, chunk_size);
             if (ret != chunk_size)