diff options
author | Juanjo <pulento@users.sourceforge.net> | 2002-04-09 04:52:49 +0000 |
---|---|---|
committer | Juanjo <pulento@users.sourceforge.net> | 2002-04-09 04:52:49 +0000 |
commit | e0d2714adc4985198a4c9fadf76508cfe7c131d0 (patch) | |
tree | 8907aa932e9da43372590f5454fd7fd231e0983e /libavcodec/ac3dec.c | |
parent | 9f862d1133e23c26e7b682c625f380f68cd4627b (diff) | |
download | ffmpeg-e0d2714adc4985198a4c9fadf76508cfe7c131d0.tar.gz |
- Fixed AC3 decoding for 5:1 AC3 streams. Now when calling av_audio_decode for
AC3 set avcodec_context->channels to the desired number channels, if the
setting is 0 AC3 decoder will set it to the channels found in the
stream.
- Changed ffmpeg to cope with the new "way" of AC3 decoding.
- ASF muxer now uses Tickers for PTS calculations.
Originally committed as revision 393 to svn://svn.ffmpeg.org/ffmpeg/trunk
Diffstat (limited to 'libavcodec/ac3dec.c')
-rw-r--r-- | libavcodec/ac3dec.c | 29 |
1 files changed, 15 insertions, 14 deletions
diff --git a/libavcodec/ac3dec.c b/libavcodec/ac3dec.c index c0d801da2d..eade4fb6ae 100644 --- a/libavcodec/ac3dec.c +++ b/libavcodec/ac3dec.c @@ -108,13 +108,16 @@ static int ac3_decode_frame(AVCodecContext *avctx, /* update codec info */ avctx->sample_rate = sample_rate; s->channels = ac3_channels[s->flags & 7]; - if (s->flags & AC3_LFE) - s->channels++; - if (s->channels < avctx->channels) { - fprintf(stderr, "Source channels are less than specified: output to %d channels..\n", s->channels); - avctx->channels = s->channels; - } - avctx->bit_rate = bit_rate; + if (s->flags & AC3_LFE) + s->channels++; + if (avctx->channels == 0) + /* No specific number of channel requested */ + avctx->channels = s->channels; + else if (s->channels < avctx->channels) { + fprintf(stderr, "libav: AC3 Source channels are less than specified: output to %d channels..\n", s->channels); + avctx->channels = s->channels; + } + avctx->bit_rate = bit_rate; } } } else if (len < s->frame_size) { @@ -127,15 +130,13 @@ static int ac3_decode_frame(AVCodecContext *avctx, s->inbuf_ptr += len; buf_size -= len; } else { -#if 0 + flags = s->flags; if (avctx->channels == 1) flags = AC3_MONO; - else + else if (avctx->channels == 2) flags = AC3_STEREO; -#else - flags = s->flags; -#endif - flags |= AC3_ADJUST_LEVEL; + else + flags |= AC3_ADJUST_LEVEL; level = 1; if (ac3_frame (&s->state, s->inbuf, &flags, &level, 384)) { fail: @@ -146,7 +147,7 @@ static int ac3_decode_frame(AVCodecContext *avctx, for (i = 0; i < 6; i++) { if (ac3_block (&s->state)) goto fail; - float_to_int (*samples, out_samples + i * 256 * avctx->channels, avctx->channels); + float_to_int (*samples, out_samples + i * 256 * avctx->channels, avctx->channels); } s->inbuf_ptr = s->inbuf; s->frame_size = 0; |