changeset 691:28af25a9a897 libavformat

first pass at ALAC decoder from David Hammerton; while David's original decoder works great, this decoder is not completely and seamlessly integrated yet with FFmpeg
author melanson
date Sun, 06 Mar 2005 00:43:55 +0000
parents fec605ce7d4a
children b0144ebc71dd
files mov.c
diffstat 1 files changed, 18 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/mov.c	Fri Mar 04 00:30:18 2005 +0000
+++ b/mov.c	Sun Mar 06 00:43:55 2005 +0000
@@ -142,6 +142,7 @@
     { CODEC_ID_AMR_NB, MKTAG('s', 'a', 'm', 'r') }, /* AMR-NB 3gp */
     { CODEC_ID_AMR_WB, MKTAG('s', 'a', 'w', 'b') }, /* AMR-WB 3gp */
     { CODEC_ID_AC3, MKTAG('m', 's', 0x20, 0x00) }, /* Dolby AC-3 */
+    { CODEC_ID_ALAC,MKTAG('a', 'l', 'a', 'c') }, /* Apple Lossless */
     { CODEC_ID_NONE, 0 },
 };
 
@@ -1101,6 +1102,23 @@
                    st->codec.channels = (px[1] >> 3) & 15;
                 }
             }
+            else if( st->codec.codec_tag == MKTAG( 'a', 'l', 'a', 'c' ))
+            {
+                /* Handle alac audio tag + special extradata */
+                get_be32(pb); /* version */
+                get_be32(pb);
+                st->codec.channels = get_be16(pb); /* channels */
+                st->codec.bits_per_sample = get_be16(pb); /* bits per sample */
+                get_be32(pb);
+                st->codec.sample_rate = get_be16(pb);
+                get_be16(pb);
+
+                /* fetch the 36-byte extradata needed for alac decoding */
+                st->codec.extradata_size = 36;
+                st->codec.extradata = (uint8_t*) 
+                    av_mallocz(st->codec.extradata_size + FF_INPUT_BUFFER_PADDING_SIZE);
+                get_buffer(pb, st->codec.extradata, st->codec.extradata_size);
+            }
 	    else if(size>=(16+20))
 	    {//16 bytes read, reading atleast 20 more
                 uint16_t version;