Commit 6d6d7970 authored by Mike Melanson's avatar Mike Melanson

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

Originally committed as revision 4008 to svn://svn.ffmpeg.org/ffmpeg/trunk
parent 2a515c08
...@@ -14,6 +14,7 @@ Brian Foley ...@@ -14,6 +14,7 @@ Brian Foley
Arpad Gereoffy Arpad Gereoffy
Philip Gladstone Philip Gladstone
Vladimir Gneushev Vladimir Gneushev
David Hammerton
Wolfgang Hesseler Wolfgang Hesseler
Falk Hueffner Falk Hueffner
Zdenek Kabelac Zdenek Kabelac
......
# #
# libavcodec Makefile # libavcodec Makefile
# (c) 2000-2003 Fabrice Bellard # (c) 2000-2005 Fabrice Bellard
# #
include ../config.mak include ../config.mak
...@@ -22,7 +22,8 @@ OBJS= bitstream.o utils.o mem.o allcodecs.o \ ...@@ -22,7 +22,8 @@ OBJS= bitstream.o utils.o mem.o allcodecs.o \
smc.o parser.o flicvideo.o truemotion1.o vmdav.o lcl.o qtrle.o g726.o \ smc.o parser.o flicvideo.o truemotion1.o vmdav.o lcl.o qtrle.o g726.o \
flac.o vp3dsp.o integer.o snow.o tscc.o sonic.o ulti.o h264idct.o \ flac.o vp3dsp.o integer.o snow.o tscc.o sonic.o ulti.o h264idct.o \
qdrw.o xl.o rangecoder.o png.o pnm.o qpeg.o vc9.o h263.o h261.o \ qdrw.o xl.o rangecoder.o png.o pnm.o qpeg.o vc9.o h263.o h261.o \
msmpeg4.o h263dec.o svq1.o rv10.o wmadec.o indeo3.o shorten.o loco.o msmpeg4.o h263dec.o svq1.o rv10.o wmadec.o indeo3.o shorten.o loco.o \
alac.o
AMROBJS= AMROBJS=
ifeq ($(AMR_NB),yes) ifeq ($(AMR_NB),yes)
......
This diff is collapsed.
...@@ -196,6 +196,7 @@ void avcodec_register_all(void) ...@@ -196,6 +196,7 @@ void avcodec_register_all(void)
register_avcodec(&qtrle_decoder); register_avcodec(&qtrle_decoder);
register_avcodec(&flac_decoder); register_avcodec(&flac_decoder);
register_avcodec(&shorten_decoder); register_avcodec(&shorten_decoder);
register_avcodec(&alac_decoder);
#endif /* CONFIG_DECODERS */ #endif /* CONFIG_DECODERS */
#ifdef AMR_NB #ifdef AMR_NB
......
...@@ -17,7 +17,7 @@ extern "C" { ...@@ -17,7 +17,7 @@ extern "C" {
#define FFMPEG_VERSION_INT 0x000409 #define FFMPEG_VERSION_INT 0x000409
#define FFMPEG_VERSION "0.4.9-pre1" #define FFMPEG_VERSION "0.4.9-pre1"
#define LIBAVCODEC_BUILD 4744 #define LIBAVCODEC_BUILD 4745
#define LIBAVCODEC_VERSION_INT FFMPEG_VERSION_INT #define LIBAVCODEC_VERSION_INT FFMPEG_VERSION_INT
#define LIBAVCODEC_VERSION FFMPEG_VERSION #define LIBAVCODEC_VERSION FFMPEG_VERSION
...@@ -170,6 +170,7 @@ enum CodecID { ...@@ -170,6 +170,7 @@ enum CodecID {
CODEC_ID_MPEG2TS= 0x20000, /* _FAKE_ codec to indicate a raw MPEG2 transport CODEC_ID_MPEG2TS= 0x20000, /* _FAKE_ codec to indicate a raw MPEG2 transport
stream (only used by libavformat) */ stream (only used by libavformat) */
CODEC_ID_ALAC,
}; };
/* CODEC_ID_MP3LAME is absolete */ /* CODEC_ID_MP3LAME is absolete */
...@@ -2011,6 +2012,7 @@ extern AVCodec xl_decoder; ...@@ -2011,6 +2012,7 @@ extern AVCodec xl_decoder;
extern AVCodec qpeg_decoder; extern AVCodec qpeg_decoder;
extern AVCodec shorten_decoder; extern AVCodec shorten_decoder;
extern AVCodec loco_decoder; extern AVCodec loco_decoder;
extern AVCodec alac_decoder;
/* pcm codecs */ /* pcm codecs */
#define PCM_CODEC(id, name) \ #define PCM_CODEC(id, name) \
......
...@@ -142,6 +142,7 @@ static const CodecTag mov_audio_tags[] = { ...@@ -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_NB, MKTAG('s', 'a', 'm', 'r') }, /* AMR-NB 3gp */
{ CODEC_ID_AMR_WB, MKTAG('s', 'a', 'w', 'b') }, /* AMR-WB 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_AC3, MKTAG('m', 's', 0x20, 0x00) }, /* Dolby AC-3 */
{ CODEC_ID_ALAC,MKTAG('a', 'l', 'a', 'c') }, /* Apple Lossless */
{ CODEC_ID_NONE, 0 }, { CODEC_ID_NONE, 0 },
}; };
...@@ -1101,6 +1102,23 @@ static int mov_read_stsd(MOVContext *c, ByteIOContext *pb, MOV_atom_t atom) ...@@ -1101,6 +1102,23 @@ static int mov_read_stsd(MOVContext *c, ByteIOContext *pb, MOV_atom_t atom)
st->codec.channels = (px[1] >> 3) & 15; 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)) else if(size>=(16+20))
{//16 bytes read, reading atleast 20 more {//16 bytes read, reading atleast 20 more
uint16_t version; uint16_t version;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment