summaryrefslogtreecommitdiff
path: root/libavcodec/ac3dec.c
diff options
context:
space:
mode:
authorTim Walker <tdskywalker@gmail.com>2014-01-17 15:57:40 +0100
committerTim Walker <tdskywalker@gmail.com>2014-01-19 19:12:42 +0100
commitc229f571fd3c7d7b567c27c87b2bbcdaee1b0e9f (patch)
treeb6b72196768c8731b4d4dbf1651fdda6634f7375 /libavcodec/ac3dec.c
parent1f604f96ea70503caa642f68a85be6074a5b3f46 (diff)
(e)ac3: parse and store the Lt/Rt and LFE mix levels.
Diffstat (limited to 'libavcodec/ac3dec.c')
-rw-r--r--libavcodec/ac3dec.c16
1 files changed, 12 insertions, 4 deletions
diff --git a/libavcodec/ac3dec.c b/libavcodec/ac3dec.c
index 584ce1a35a..b6ee401485 100644
--- a/libavcodec/ac3dec.c
+++ b/libavcodec/ac3dec.c
@@ -227,16 +227,20 @@ static int ac3_parse_header(AC3DecodeContext *s)
skip_bits(gbc, 2); //skip copyright bit and original bitstream bit
- /* skip the timecodes or parse the Alternate Bit Stream Syntax
- TODO: read & use the xbsi1 downmix levels */
+ /* skip the timecodes or parse the Alternate Bit Stream Syntax */
if (s->bitstream_id != 6) {
if (get_bits1(gbc))
skip_bits(gbc, 14); //skip timecode1
if (get_bits1(gbc))
skip_bits(gbc, 14); //skip timecode2
} else {
- if (get_bits1(gbc))
- skip_bits(gbc, 14); //skip xbsi1
+ if (get_bits1(gbc)) {
+ s->preferred_downmix = get_bits(gbc, 2);
+ s->center_mix_level_ltrt = get_bits(gbc, 3);
+ s->surround_mix_level_ltrt = get_bits(gbc, 3);
+ s->center_mix_level = get_bits(gbc, 3);
+ s->surround_mix_level = get_bits(gbc, 3);
+ }
if (get_bits1(gbc)) {
s->dolby_surround_ex_mode = get_bits(gbc, 2);
s->dolby_headphone_mode = get_bits(gbc, 2);
@@ -280,8 +284,12 @@ static int parse_frame_header(AC3DecodeContext *s)
s->fbw_channels = s->channels - s->lfe_on;
s->lfe_ch = s->fbw_channels + 1;
s->frame_size = hdr.frame_size;
+ s->preferred_downmix = AC3_DMIXMOD_NOTINDICATED;
s->center_mix_level = hdr.center_mix_level;
+ s->center_mix_level_ltrt = 4; // -3.0dB
s->surround_mix_level = hdr.surround_mix_level;
+ s->surround_mix_level_ltrt = 4; // -3.0dB
+ s->lfe_mix_level_exists = 0;
s->num_blocks = hdr.num_blocks;
s->frame_type = hdr.frame_type;
s->substreamid = hdr.substreamid;