From c4cc361099fca9f100336c4178382b8901f2c954 Mon Sep 17 00:00:00 2001 From: Aurelien Jacobs Date: Thu, 1 Nov 2007 17:58:03 +0000 Subject: [PATCH] cleanup and simplify adx_decode_header() Originally committed as revision 10900 to svn://svn.ffmpeg.org/ffmpeg/trunk --- libavcodec/adx.c | 29 ++++++----------------------- 1 file changed, 6 insertions(+), 23 deletions(-) diff --git a/libavcodec/adx.c b/libavcodec/adx.c index 4b4165a7db..a0f7373229 100644 --- a/libavcodec/adx.c +++ b/libavcodec/adx.c @@ -249,35 +249,18 @@ static int adx_encode_frame(AVCodecContext *avctx, #endif //CONFIG_ENCODERS -static int is_adx(const unsigned char *buf,size_t bufsize) +/* return data offset or 0 */ +static int adx_decode_header(AVCodecContext *avctx,const unsigned char *buf,size_t bufsize) { - int offset; + int offset; if (buf[0]!=0x80) return 0; offset = (AV_RB32(buf)^0x80000000)+4; if (bufsizesample_rate = freq; - avctx->channels = channels; - avctx->bit_rate = freq*channels*18*8/32; -// avctx->frame_size = 18*channels; + avctx->channels = buf[7]; + avctx->sample_rate = AV_RB32(buf+8); + avctx->bit_rate = avctx->sample_rate*avctx->channels*18*8/32; return offset; }