diff mbox

[FFmpeg-devel,1/3] aiff: add support for XA ADPCM

Message ID 20180103081424.47388-2-misty@brew.sh
State Accepted
Commit fde057dfb25e2b6917fc896a0b2dfec0f336b1ce
Headers show

Commit Message

misty@brew.sh Jan. 3, 2018, 8:14 a.m. UTC
From: Misty De Meo <mistydemeo@gmail.com>

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.
---
 libavformat/aiffdec.c | 7 +++++++
 1 file changed, 7 insertions(+)

Comments

Michael Niedermayer Jan. 4, 2018, 8:06 p.m. UTC | #1
On Wed, Jan 03, 2018 at 07:14:22PM +1100, misty@brew.sh wrote:
> From: Misty De Meo <mistydemeo@gmail.com>
> 
> 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.
> ---
>  libavformat/aiffdec.c | 7 +++++++
>  1 file changed, 7 insertions(+)

will apply

thanks

[...]
diff mbox

Patch

diff --git a/libavformat/aiffdec.c b/libavformat/aiffdec.c
index 99e05c78ec..a6c180fc8d 100644
--- a/libavformat/aiffdec.c
+++ b/libavformat/aiffdec.c
@@ -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;