changeset 2024:8b400be65542 libavformat

Atrac3 decoder.
author banan
date Tue, 17 Apr 2007 20:53:39 +0000
parents a3e79d6e4e3c
children 9a8908eaa2ea
files riff.c rm.c
diffstat 2 files changed, 7 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/riff.c	Sun Apr 15 13:51:57 2007 +0000
+++ b/riff.c	Tue Apr 17 20:53:39 2007 +0000
@@ -204,6 +204,7 @@
     { CODEC_ID_FLAC, 0xF1AC },
     { CODEC_ID_IMC, 0x401 },
     { CODEC_ID_GSM_MS, 0x31 },
+    { CODEC_ID_ATRAC3, 0x270 },
 
     /* FIXME: All of the IDs below are not 16 bit and thus illegal. */
     // for NuppelVideo (nuv.c)
--- a/rm.c	Sun Apr 15 13:51:57 2007 +0000
+++ b/rm.c	Tue Apr 17 20:53:39 2007 +0000
@@ -565,7 +565,7 @@
             }
 
             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 @@
                 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 @@
 
         } 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 @@
                         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);