aboutsummaryrefslogtreecommitdiffstats
path: root/libavformat/rsd.c
diff options
context:
space:
mode:
authorJames Almer <jamrial@gmail.com>2013-05-10 16:53:50 -0300
committerJames Almer <jamrial@gmail.com>2013-05-10 16:53:50 -0300
commit67fad0d221458d43edb9037c30171d0adb1d609a (patch)
treefe6ccd93afeaebf20af25b376c4040f07b8055b0 /libavformat/rsd.c
parente5e86db178b76026981f97889365ca9701705f2b (diff)
downloadffmpeg-67fad0d221458d43edb9037c30171d0adb1d609a.tar.gz
ADPCM IMA Radical decoder
Signed-off-by: James Almer <jamrial@gmail.com>
Diffstat (limited to 'libavformat/rsd.c')
-rw-r--r--libavformat/rsd.c13
1 files changed, 11 insertions, 2 deletions
diff --git a/libavformat/rsd.c b/libavformat/rsd.c
index b9352551c7..5b53cef9c0 100644
--- a/libavformat/rsd.c
+++ b/libavformat/rsd.c
@@ -27,6 +27,7 @@
static const AVCodecTag rsd_tags[] = {
{ AV_CODEC_ID_ADPCM_THP, MKTAG('G','A','D','P') },
+ { AV_CODEC_ID_ADPCM_IMA_RAD, MKTAG('R','A','D','P') },
{ AV_CODEC_ID_PCM_S16BE, MKTAG('P','C','M','B') },
{ AV_CODEC_ID_PCM_S16LE, MKTAG('P','C','M',' ') },
{ AV_CODEC_ID_NONE, 0 },
@@ -34,7 +35,6 @@ static const AVCodecTag rsd_tags[] = {
static const uint32_t rsd_unsupported_tags[] = {
MKTAG('O','G','G',' '),
- MKTAG('R','A','D','P'),
MKTAG('V','A','G',' '),
MKTAG('W','A','D','P'),
MKTAG('X','A','D','P'),
@@ -92,6 +92,11 @@ static int rsd_read_header(AVFormatContext *s)
avio_skip(pb, 4); // Unknown
switch (codec->codec_id) {
+ case AV_CODEC_ID_ADPCM_IMA_RAD:
+ codec->block_align = 20 * codec->channels;
+ if (pb->seekable)
+ st->duration = av_get_audio_frame_duration(codec, avio_size(pb) - start);
+ break;
case AV_CODEC_ID_ADPCM_THP:
/* RSD3GADP is mono, so only alloc enough memory
to store the coeff table for a single channel. */
@@ -131,12 +136,16 @@ static int rsd_read_header(AVFormatContext *s)
static int rsd_read_packet(AVFormatContext *s, AVPacket *pkt)
{
+ AVCodecContext *codec = s->streams[0]->codec;
int ret, size = 1024;
if (url_feof(s->pb))
return AVERROR_EOF;
- ret = av_get_packet(s->pb, pkt, size);
+ if (codec->codec_id == AV_CODEC_ID_ADPCM_IMA_RAD)
+ ret = av_get_packet(s->pb, pkt, codec->block_align);
+ else
+ ret = av_get_packet(s->pb, pkt, size);
if (ret != size) {
if (ret < 0) {