From 10e26bc782b512e275fe860f2c8330b0b9277410 Mon Sep 17 00:00:00 2001 From: Benjamin Larsson Date: Tue, 17 Apr 2007 20:53:39 +0000 Subject: Atrac3 decoder. Originally committed as revision 8747 to svn://svn.ffmpeg.org/ffmpeg/trunk --- libavformat/rm.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) (limited to 'libavformat/rm.c') diff --git a/libavformat/rm.c b/libavformat/rm.c index d2e41acbb6..96752f225f 100644 --- a/libavformat/rm.c +++ b/libavformat/rm.c @@ -565,7 +565,7 @@ static int rm_read_audio_stream_info(AVFormatContext *s, AVStream *st, } rm->audiobuf = av_malloc(rm->audio_framesize * sub_packet_h); - } else if (!strcmp(buf, "cook")) { + } else if ((!strcmp(buf, "cook")) || (!strcmp(buf, "atrc"))) { int codecdata_length, i; get_be16(pb); get_byte(pb); if (((version >> 16) & 0xff) == 5) @@ -576,7 +576,8 @@ static int rm_read_audio_stream_info(AVFormatContext *s, AVStream *st, return -1; } - st->codec->codec_id = CODEC_ID_COOK; + if (!strcmp(buf, "cook")) st->codec->codec_id = CODEC_ID_COOK; + else st->codec->codec_id = CODEC_ID_ATRAC3; st->codec->extradata_size= codecdata_length; st->codec->extradata= av_mallocz(st->codec->extradata_size + FF_INPUT_BUFFER_PADDING_SIZE); for(i = 0; i < codecdata_length; i++) @@ -957,7 +958,8 @@ resync: } else if (st->codec->codec_type == CODEC_TYPE_AUDIO) { if ((st->codec->codec_id == CODEC_ID_RA_288) || - (st->codec->codec_id == CODEC_ID_COOK)) { + (st->codec->codec_id == CODEC_ID_COOK) || + (st->codec->codec_id == CODEC_ID_ATRAC3)) { int x; int sps = rm->sub_packet_size; int cfs = rm->coded_framesize; @@ -975,6 +977,7 @@ resync: for (x = 0; x < h/2; x++) get_buffer(pb, rm->audiobuf+x*2*w+y*cfs, cfs); break; + case CODEC_ID_ATRAC3: case CODEC_ID_COOK: for (x = 0; x < w/sps; x++) get_buffer(pb, rm->audiobuf+sps*(h*x+((h+1)/2)*(y&1)+(y>>1)), sps); -- cgit v1.2.3