# HG changeset patch # User melanson # Date 1110069835 0 # Node ID 28af25a9a897a1154f8c572ad80ff55f100fe5e9 # Parent fec605ce7d4a752fef55390f38b0d3fab01ff6b6 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 diff -r fec605ce7d4a -r 28af25a9a897 mov.c --- 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;