Commit a9922613 authored by Paul B Mahol's avatar Paul B Mahol

avformat/rsd: support XADP tag

It appears that Xbox ADPCM is same as WAV adpcm.
Signed-off-by: 's avatarPaul B Mahol <onemda@gmail.com>
parent 98b8bf12
...@@ -28,6 +28,7 @@ ...@@ -28,6 +28,7 @@
static const AVCodecTag rsd_tags[] = { static const AVCodecTag rsd_tags[] = {
{ AV_CODEC_ID_ADPCM_THP, MKTAG('G','A','D','P') }, { AV_CODEC_ID_ADPCM_THP, MKTAG('G','A','D','P') },
{ AV_CODEC_ID_ADPCM_IMA_RAD, MKTAG('R','A','D','P') }, { AV_CODEC_ID_ADPCM_IMA_RAD, MKTAG('R','A','D','P') },
{ AV_CODEC_ID_ADPCM_IMA_WAV, MKTAG('X','A','D','P') },
{ AV_CODEC_ID_PCM_S16BE, MKTAG('P','C','M','B') }, { AV_CODEC_ID_PCM_S16BE, MKTAG('P','C','M','B') },
{ AV_CODEC_ID_PCM_S16LE, MKTAG('P','C','M',' ') }, { AV_CODEC_ID_PCM_S16LE, MKTAG('P','C','M',' ') },
{ AV_CODEC_ID_NONE, 0 }, { AV_CODEC_ID_NONE, 0 },
...@@ -37,7 +38,6 @@ static const uint32_t rsd_unsupported_tags[] = { ...@@ -37,7 +38,6 @@ static const uint32_t rsd_unsupported_tags[] = {
MKTAG('O','G','G',' '), MKTAG('O','G','G',' '),
MKTAG('V','A','G',' '), MKTAG('V','A','G',' '),
MKTAG('W','A','D','P'), MKTAG('W','A','D','P'),
MKTAG('X','A','D','P'),
MKTAG('X','M','A',' '), MKTAG('X','M','A',' '),
}; };
...@@ -100,6 +100,15 @@ static int rsd_read_header(AVFormatContext *s) ...@@ -100,6 +100,15 @@ static int rsd_read_header(AVFormatContext *s)
if (pb->seekable) if (pb->seekable)
st->duration = av_get_audio_frame_duration(codec, avio_size(pb) - start); st->duration = av_get_audio_frame_duration(codec, avio_size(pb) - start);
break; break;
case AV_CODEC_ID_ADPCM_IMA_WAV:
if (version == 2)
start = avio_rl32(pb);
codec->bits_per_coded_sample = 4;
codec->block_align = 36 * codec->channels;
if (pb->seekable)
st->duration = av_get_audio_frame_duration(codec, avio_size(pb) - start);
break;
case AV_CODEC_ID_ADPCM_THP: case AV_CODEC_ID_ADPCM_THP:
/* RSD3GADP is mono, so only alloc enough memory /* RSD3GADP is mono, so only alloc enough memory
to store the coeff table for a single channel. */ to store the coeff table for a single channel. */
...@@ -140,7 +149,8 @@ static int rsd_read_packet(AVFormatContext *s, AVPacket *pkt) ...@@ -140,7 +149,8 @@ static int rsd_read_packet(AVFormatContext *s, AVPacket *pkt)
if (avio_feof(s->pb)) if (avio_feof(s->pb))
return AVERROR_EOF; return AVERROR_EOF;
if (codec->codec_id == AV_CODEC_ID_ADPCM_IMA_RAD) if (codec->codec_id == AV_CODEC_ID_ADPCM_IMA_RAD ||
codec->codec_id == AV_CODEC_ID_ADPCM_IMA_WAV)
ret = av_get_packet(s->pb, pkt, codec->block_align); ret = av_get_packet(s->pb, pkt, codec->block_align);
else else
ret = av_get_packet(s->pb, pkt, size); ret = av_get_packet(s->pb, pkt, size);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment