]> git.sesse.net Git - ffmpeg/commitdiff
aiff: add support for XA ADPCM
authorMisty De Meo <mistydemeo@gmail.com>
Wed, 3 Jan 2018 08:14:22 +0000 (19:14 +1100)
committerMichael Niedermayer <michael@niedermayer.cc>
Thu, 4 Jan 2018 20:39:34 +0000 (21:39 +0100)
Certain AIFF files encode XA ADPCM compressed audio using a chunk
with the tag `APCM`. Aside from this custom chunk type, they're
otherwise standard AIFF files. I've only observed these files in the
Sega Saturn game Sonic Jam so far.

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
libavformat/aiffdec.c

index 99e05c78ecac3528569fa1590afb6fff2a34ecd4..a6c180fc8da72b1f94b4fda7172fd2bc7d310be6 100644 (file)
@@ -325,6 +325,13 @@ static int aiff_read_header(AVFormatContext *s)
             if(ff_mov_read_chan(s, pb, st, size) < 0)
                 return AVERROR_INVALIDDATA;
             break;
+        case MKTAG('A','P','C','M'): /* XA ADPCM compressed sound chunk */
+            st->codecpar->codec_id = AV_CODEC_ID_ADPCM_XA;
+            aiff->data_end = avio_tell(pb) + size;
+            offset = avio_tell(pb) + 8;
+            /* This field is unknown and its data seems to be irrelevant */
+            avio_rb32(pb);
+            st->codecpar->block_align = avio_rb32(pb);
         case 0:
             if (offset > 0 && st->codecpar->block_align) // COMM && SSND
                 goto got_sound;