diff options
author | Mike Melanson <mike@multimedia.cx> | 2005-03-06 07:00:24 +0000 |
---|---|---|
committer | Mike Melanson <mike@multimedia.cx> | 2005-03-06 07:00:24 +0000 |
commit | f770ee038f641b0637669756b7aad08b8636148b (patch) | |
tree | d23eb3f811ab8c9013bf4b7b468fba420632c740 /libavcodec/alac.c | |
parent | 7ff85a81edcb10da52a9e37e1f99765a0d96854a (diff) | |
download | ffmpeg-f770ee038f641b0637669756b7aad08b8636148b.tar.gz |
decoder works fine now, when fed properly-sized chunks by the demuxer;
cleaned up some cruft for this commit
Originally committed as revision 4010 to svn://svn.ffmpeg.org/ffmpeg/trunk
Diffstat (limited to 'libavcodec/alac.c')
-rw-r--r-- | libavcodec/alac.c | 60 |
1 files changed, 14 insertions, 46 deletions
diff --git a/libavcodec/alac.c b/libavcodec/alac.c index 8231fb1f67..c0c7fdf3bf 100644 --- a/libavcodec/alac.c +++ b/libavcodec/alac.c @@ -132,7 +132,7 @@ static uint32_t readbits_16(alac_file *alac, int bits) int new_accumulator; if (alac->input_buffer_index + 2 >= alac->input_buffer_size) { - av_log(NULL, AV_LOG_INFO, "alac: input buffer went out of bounds (%d >= %d)\n", + av_log(NULL, AV_LOG_ERROR, "alac: input buffer went out of bounds (%d >= %d)\n", alac->input_buffer_index + 2, alac->input_buffer_size); // exit (0); } @@ -184,9 +184,9 @@ static int readbit(alac_file *alac) int new_accumulator; if (alac->input_buffer_index >= alac->input_buffer_size) { - av_log(NULL, AV_LOG_INFO, "alac: input buffer went out of bounds (%d >= %d)\n", + av_log(NULL, AV_LOG_ERROR, "alac: input buffer went out of bounds (%d >= %d)\n", alac->input_buffer_index + 2, alac->input_buffer_size); -// exit (0); + exit (0); } result = alac->input_buffer[alac->input_buffer_index]; @@ -508,14 +508,6 @@ void deinterlace_16(int32_t *buffer_a, int32_t *buffer_b, left = (midright - ((difference * interlacing_leftweight) >> interlacing_shift)) + difference; - /* output is always little endian */ -/* - if (host_bigendian) { - be2me_16(left); - be2me_16(right); - } -*/ - buffer_out[i*numchannels] = left; buffer_out[i*numchannels + 1] = right; } @@ -530,27 +522,25 @@ void deinterlace_16(int32_t *buffer_a, int32_t *buffer_b, left = buffer_a[i]; right = buffer_b[i]; - /* output is always little endian */ -/* - if (host_bigendian) { - be2me_16(left); - be2me_16(right); - } -*/ - buffer_out[i*numchannels] = left; buffer_out[i*numchannels + 1] = right; } } -int decode_frame(ALACContext *s, alac_file *alac, - unsigned char *inbuffer, - int input_buffer_size, - void *outbuffer, int *outputsize) +static int alac_decode_frame(AVCodecContext *avctx, + void *outbuffer, int *outputsize, + uint8_t *inbuffer, int input_buffer_size) { + ALACContext *s = avctx->priv_data; + alac_file *alac = s->alac; + int channels; int32_t outputsamples; + /* short-circuit null buffers */ + if (!inbuffer || !input_buffer_size) + return input_buffer_size; + /* initialize from the extradata */ if (!s->context_initialized) { if (s->avctx->extradata_size != ALAC_EXTRADATA_SIZE) { @@ -906,15 +896,7 @@ int decode_frame(ALACContext *s, alac_file *alac, } } -av_log(NULL, AV_LOG_INFO, "buf size = %d, consumed %d\n", - input_buffer_size, alac->input_buffer_index); - - /* avoid infinite loop: if decoder consumed 0 bytes; report all bytes - * consumed */ -// if (alac->input_buffer_index) -// return alac->input_buffer_index; -// else - return input_buffer_size; + return input_buffer_size; } static int alac_decode_init(AVCodecContext * avctx) @@ -932,20 +914,6 @@ static int alac_decode_init(AVCodecContext * avctx) return 0; } -static int alac_decode_frame(AVCodecContext *avctx, - void *data, int *data_size, - uint8_t *buf, int buf_size) -{ - ALACContext *s = avctx->priv_data; - int bytes_consumed = buf_size; - - if (buf) - bytes_consumed = decode_frame(s, s->alac, buf, buf_size, - data, data_size); - - return bytes_consumed; -} - static int alac_decode_close(AVCodecContext *avctx) { ALACContext *s = avctx->priv_data; |