mirror of
https://github.com/FFmpeg/FFmpeg.git
synced 2024-12-23 12:43:46 +02:00
Merge commit 'c229f571fd3c7d7b567c27c87b2bbcdaee1b0e9f'
* commit 'c229f571fd3c7d7b567c27c87b2bbcdaee1b0e9f': (e)ac3: parse and store the Lt/Rt and LFE mix levels. Merged-by: Michael Niedermayer <michaelni@gmx.at>
This commit is contained in:
commit
3a5a039ade
@ -106,6 +106,14 @@ typedef enum AC3DolbyHeadphoneMode {
|
||||
AC3_DHEADPHONMOD_RESERVED
|
||||
} AC3DolbyHeadphoneMode;
|
||||
|
||||
/** Preferred Stereo Downmix mode */
|
||||
typedef enum AC3PreferredStereoDownmixMode {
|
||||
AC3_DMIXMOD_NOTINDICATED = 0,
|
||||
AC3_DMIXMOD_LTRT,
|
||||
AC3_DMIXMOD_LORO,
|
||||
AC3_DMIXMOD_RESERVED
|
||||
} AC3PreferredStereoDownmixMode;
|
||||
|
||||
typedef struct AC3BitAllocParameters {
|
||||
int sr_code;
|
||||
int sr_shift;
|
||||
|
@ -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;
|
||||
|
@ -84,8 +84,13 @@ typedef struct AC3DecodeContext {
|
||||
int channel_mode; ///< channel mode (acmod)
|
||||
int lfe_on; ///< lfe channel in use
|
||||
int channel_map; ///< custom channel map
|
||||
int preferred_downmix; ///< Preferred 2-channel downmix mode (dmixmod)
|
||||
int center_mix_level; ///< Center mix level index
|
||||
int center_mix_level_ltrt; ///< Center mix level index for Lt/Rt (ltrtcmixlev)
|
||||
int surround_mix_level; ///< Surround mix level index
|
||||
int surround_mix_level_ltrt; ///< Surround mix level index for Lt/Rt (ltrtsurmixlev)
|
||||
int lfe_mix_level_exists; ///< indicates if lfemixlevcod is specified (lfemixlevcode)
|
||||
int lfe_mix_level; ///< LFE mix level index (lfemixlevcod)
|
||||
int eac3; ///< indicates if current frame is E-AC-3
|
||||
int dolby_surround_mode; ///< dolby surround mode (dsurmod)
|
||||
int dolby_surround_ex_mode; ///< dolby surround ex mode (dsurexmod)
|
||||
|
@ -345,23 +345,23 @@ int ff_eac3_parse_header(AC3DecodeContext *s)
|
||||
if (get_bits1(gbc)) {
|
||||
/* center and surround mix levels */
|
||||
if (s->channel_mode > AC3_CHMODE_STEREO) {
|
||||
skip_bits(gbc, 2); // skip preferred stereo downmix mode
|
||||
s->preferred_downmix = get_bits(gbc, 2);
|
||||
if (s->channel_mode & 1) {
|
||||
/* if three front channels exist */
|
||||
skip_bits(gbc, 3); //skip Lt/Rt center mix level
|
||||
s->center_mix_level_ltrt = get_bits(gbc, 3);
|
||||
s->center_mix_level = get_bits(gbc, 3);
|
||||
}
|
||||
if (s->channel_mode & 4) {
|
||||
/* if a surround channel exists */
|
||||
skip_bits(gbc, 3); //skip Lt/Rt surround mix level
|
||||
s->surround_mix_level_ltrt = get_bits(gbc, 3);
|
||||
s->surround_mix_level = get_bits(gbc, 3);
|
||||
}
|
||||
}
|
||||
|
||||
/* lfe mix level */
|
||||
if (s->lfe_on && get_bits1(gbc)) {
|
||||
if (s->lfe_on && (s->lfe_mix_level_exists = get_bits1(gbc))) {
|
||||
// TODO: use LFE mix level
|
||||
skip_bits(gbc, 5); // skip LFE mix level code
|
||||
s->lfe_mix_level = get_bits(gbc, 5);
|
||||
}
|
||||
|
||||
/* info for mixing with other streams and substreams */
|
||||
|
Loading…
Reference in New Issue
Block a user