avformat/aiff: add support for ADPCM N64 decoder

(cherry picked from commit 0fdf549a890f276243ba62f194e0ec08b10df60f)
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
This commit is contained in:
Paul B Mahol
2024-11-25 13:30:45 +00:00
committed by michaelni
parent 00eef74336
commit e5ac70042e
2 changed files with 29 additions and 0 deletions
+1
View File
@@ -50,6 +50,7 @@ const AVCodecTag ff_codec_aiff_tags[] = {
{ AV_CODEC_ID_CBD2_DPCM, MKTAG('C','B','D','2') },
{ AV_CODEC_ID_SDX2_DPCM, MKTAG('S','D','X','2') },
{ AV_CODEC_ID_ADPCM_IMA_WS, MKTAG('A','D','P','4') },
{ AV_CODEC_ID_ADPCM_N64, MKTAG('V','A','P','C') },
{ AV_CODEC_ID_NONE, 0 },
};
+28
View File
@@ -177,6 +177,9 @@ static int get_aiff_header(AVFormatContext *s, int64_t size,
case AV_CODEC_ID_G728:
par->block_align = 5;
break;
case AV_CODEC_ID_ADPCM_N64:
par->block_align = 9;
break;
default:
aiff->block_duration = 1;
break;
@@ -353,6 +356,31 @@ static int aiff_read_header(AVFormatContext *s)
goto got_sound;
break;
case MKTAG('A','P','P','L'):
if (size > 4) {
uint32_t chunk = avio_rl32(pb);
size -= 4;
if (chunk == MKTAG('s','t','o','c')) {
int len = avio_r8(pb);
size--;
if (len == 11 && size > 11) {
uint8_t chunk[11];
ret = avio_read(pb, chunk, 11);
if (ret > 0)
size -= ret;
if (!memcmp(chunk, "VADPCMCODES", sizeof(chunk))) {
if ((ret = ff_get_extradata(s, st->codecpar, pb, size)) < 0)
return ret;
size -= ret;
}
}
}
}
avio_skip(pb, size);
break;
case 0:
if (offset > 0 && st->codecpar->block_align) // COMM && SSND
goto got_sound;