summaryrefslogtreecommitdiff
path: root/libavcodec/ac3_parser.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/ac3_parser.c
parent467ec3c1205c083f79851486479721d9a9817612 (diff)
downloadffmpeg-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/ac3_parser.c')
-rw-r--r--libavcodec/ac3_parser.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/libavcodec/ac3_parser.c b/libavcodec/ac3_parser.c
index a6b9b740e0..667c6d3821 100644
--- a/libavcodec/ac3_parser.c
+++ b/libavcodec/ac3_parser.c
@@ -49,7 +49,6 @@ static const uint8_t surround_levels[4] = { 2, 4, 0, 4 };
int ff_ac3_parse_header(GetBitContext *gbc, AC3HeaderInfo *hdr)
{
int frame_size_code;
- int num_blocks;
memset(hdr, 0, sizeof(*hdr));
@@ -62,6 +61,8 @@ int ff_ac3_parse_header(GetBitContext *gbc, AC3HeaderInfo *hdr)
if(hdr->bitstream_id > 16)
return AC3_PARSE_ERROR_BSID;
+ hdr->num_blocks = 6;
+
if(hdr->bitstream_id <= 10) {
/* Normal AC-3 */
hdr->crc1 = get_bits(gbc, 16);
@@ -118,9 +119,8 @@ int ff_ac3_parse_header(GetBitContext *gbc, AC3HeaderInfo *hdr)
return AC3_PARSE_ERROR_SAMPLE_RATE;
hdr->sample_rate = ff_ac3_sample_rate_tab[sr_code2] / 2;
hdr->sr_shift = 1;
- num_blocks = 6;
} else {
- num_blocks = eac3_blocks[get_bits(gbc, 2)];
+ hdr->num_blocks = eac3_blocks[get_bits(gbc, 2)];
hdr->sample_rate = ff_ac3_sample_rate_tab[hdr->sr_code];
hdr->sr_shift = 0;
}
@@ -129,7 +129,7 @@ int ff_ac3_parse_header(GetBitContext *gbc, AC3HeaderInfo *hdr)
hdr->lfe_on = get_bits1(gbc);
hdr->bit_rate = (uint32_t)(8.0 * hdr->frame_size * hdr->sample_rate /
- (num_blocks * 256.0));
+ (hdr->num_blocks * 256.0));
hdr->channels = ff_ac3_channels_tab[hdr->channel_mode] + hdr->lfe_on;
}