X-Git-Url: https://git.libav.org/?p=libav.git;a=blobdiff_plain;f=libavformat%2Fmov.c;h=c0d9cec5651e640a338f5c93409aa0c19ba4ecef;hp=afa0a2347705d55626db0ef186f5cdeb1c69e22f;hb=6d6d7970e7c0ae1bf3f0e015d3c22723ed5b1a28;hpb=2a515c08f25dc4c78c09b4600358574ef34b4ea5 diff --git a/libavformat/mov.c b/libavformat/mov.c index afa0a23477..c0d9cec565 100644 --- a/libavformat/mov.c +++ b/libavformat/mov.c @@ -142,6 +142,7 @@ static const CodecTag mov_audio_tags[] = { { 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 @@ static int mov_read_stsd(MOVContext *c, ByteIOContext *pb, MOV_atom_t atom) 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;