summaryrefslogtreecommitdiffstats
path: root/libavcodec/ac3dec.c
diff options
context:
space:
mode:
authorJustin Ruggles <justin.ruggles@gmail.com>2008-06-07 22:29:03 +0000
committerJustin Ruggles <justin.ruggles@gmail.com>2008-06-07 22:29:03 +0000
commit6730e9f300927c37d2016093684222fef63bb740 (patch)
tree513239764a11776ccefdae2cd4d6612a48c686e6 /libavcodec/ac3dec.c
parent467ec3c1205c083f79851486479721d9a9817612 (diff)
downloadffmpeg-streaming-6730e9f300927c37d2016093684222fef63bb740.zip
ffmpeg-streaming-6730e9f300927c37d2016093684222fef63bb740.tar.gz
get the number of blocks from the ac3 parser and use in the ac3 decoder.
Originally committed as revision 13688 to svn://svn.ffmpeg.org/ffmpeg/trunk
Diffstat (limited to 'libavcodec/ac3dec.c')
-rw-r--r--libavcodec/ac3dec.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/libavcodec/ac3dec.c b/libavcodec/ac3dec.c
index 29955cc..ad5e083 100644
--- a/libavcodec/ac3dec.c
+++ b/libavcodec/ac3dec.c
@@ -111,6 +111,7 @@ static const uint8_t ac3_default_coeffs[8][5][2] = {
#define AC3_OUTPUT_LFEON 8
typedef struct {
+ int num_blocks; ///< number of audio blocks
int channel_mode; ///< channel mode (acmod)
int block_switch[AC3_MAX_CHANNELS]; ///< block switch flags
int dither_flag[AC3_MAX_CHANNELS]; ///< dither flags
@@ -324,6 +325,7 @@ static int ac3_parse_header(AC3DecodeContext *s)
s->frame_size = hdr.frame_size;
s->center_mix_level = hdr.center_mix_level;
s->surround_mix_level = hdr.surround_mix_level;
+ s->num_blocks = hdr.num_blocks;
if(s->lfe_on) {
s->start_freq[s->lfe_ch] = 0;
@@ -1206,7 +1208,7 @@ static int ac3_decode_frame(AVCodecContext * avctx, void *data, int *data_size,
}
/* parse the audio blocks */
- for (blk = 0; blk < NB_BLOCKS; blk++) {
+ for (blk = 0; blk < s->num_blocks; blk++) {
if (!err && ac3_parse_audio_block(s, blk)) {
av_log(avctx, AV_LOG_ERROR, "error parsing the audio block\n");
}
@@ -1216,7 +1218,7 @@ static int ac3_decode_frame(AVCodecContext * avctx, void *data, int *data_size,
for (ch = 0; ch < s->out_channels; ch++)
*(out_samples++) = s->int_output[ch][i];
}
- *data_size = NB_BLOCKS * 256 * avctx->channels * sizeof (int16_t);
+ *data_size = s->num_blocks * 256 * avctx->channels * sizeof (int16_t);
return s->frame_size;
}
OpenPOWER on IntegriCloud