Browse code

ima4 in aiff support

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

Baptiste Coudurier authored on 2008/02/25 19:57:22
Showing 1 changed files
... ...
@@ -37,6 +37,7 @@ static const AVCodecTag codec_aiff_tags[] = {
37 37
     { CODEC_ID_GSM, MKTAG('G','S','M',' ') },
38 38
     { CODEC_ID_ADPCM_G726, MKTAG('G','7','2','6') },
39 39
     { CODEC_ID_PCM_S16LE, MKTAG('s','o','w','t') },
40
+    { CODEC_ID_ADPCM_IMA_QT, MKTAG('i','m','a','4') },
40 41
     { 0, 0 },
41 42
 };
42 43
 
... ...
@@ -123,11 +124,17 @@ static unsigned int get_aiff_header(ByteIOContext *pb, AVCodecContext *codec,
123 123
         codec->codec_tag = get_le32(pb);
124 124
         codec->codec_id  = codec_get_id (codec_aiff_tags, codec->codec_tag);
125 125
 
126
-        if (codec->codec_id == CODEC_ID_PCM_S16BE) {
126
+        switch (codec->codec_id) {
127
+        case CODEC_ID_PCM_S16BE:
127 128
             codec->codec_id = aiff_codec_get_id (codec->bits_per_sample);
128 129
             codec->bits_per_sample = av_get_bits_per_sample(codec->codec_id);
130
+            break;
131
+        case CODEC_ID_ADPCM_IMA_QT:
132
+            codec->block_align = 34*codec->channels;
133
+            break;
134
+        default:
135
+            break;
129 136
         }
130
-
131 137
         size -= 4;
132 138
     } else {
133 139
         /* Need the codec type */
... ...
@@ -140,7 +147,8 @@ static unsigned int get_aiff_header(ByteIOContext *pb, AVCodecContext *codec,
140 140
 
141 141
     /* Block align needs to be computed in all cases, as the definition
142 142
      * is specific to applications -> here we use the WAVE format definition */
143
-    codec->block_align = (codec->bits_per_sample * codec->channels) >> 3;
143
+    if (!codec->block_align)
144
+        codec->block_align = (codec->bits_per_sample * codec->channels) >> 3;
144 145
 
145 146
     codec->bit_rate = codec->sample_rate * (codec->block_align << 3);
146 147