---
libavcodec/ac3.h | 8 ++++++++
libavcodec/ac3dec.c | 22 +++++++++++++++++-----
libavcodec/ac3dec.h | 1 +
3 files changed, 26 insertions(+), 5 deletions(-)
diff --git a/libavcodec/ac3.h b/libavcodec/ac3.h
index c68f80b..661436a 100644
--- a/libavcodec/ac3.h
+++ b/libavcodec/ac3.h
@@ -88,6 +88,14 @@ typedef enum AC3DolbySurroundMode {
AC3_DSURMOD_RESERVED
} AC3DolbySurroundMode;
+/** Dolby Surround EX mode */
+typedef enum AC3DolbySurroundEXMode {
+ AC3_DSUREXMOD_NOTINDICATED = 0,
+ AC3_DSUREXMOD_OFF,
+ AC3_DSUREXMOD_ON,
+ AC3_DSUREXMOD_PLIIZ
+} AC3DolbySurroundEXMode;
+
typedef struct AC3BitAllocParameters {
int sr_code;
int sr_shift;
diff --git a/libavcodec/ac3dec.c b/libavcodec/ac3dec.c
index e75384e..fa6ba29 100644
--- a/libavcodec/ac3dec.c
+++ b/libavcodec/ac3dec.c
@@ -227,12 +227,24 @@ static int ac3_parse_header(AC3DecodeContext *s)
skip_bits(gbc, 2); //skip copyright bit and original bitstream bit
- /* skip the timecodes (or extra bitstream information for Alternate Syntax)
+ /* default dolby surround ex mode */
+ s->dolby_surround_ex_mode = AC3_DSUREXMOD_NOTINDICATED;
+
+ /* skip the timecodes or parse the Alternate Bit Stream Syntax
TODO: read & use the xbsi1 downmix levels */
- if (get_bits1(gbc))
- skip_bits(gbc, 14); //skip timecode1 / xbsi1
- if (get_bits1(gbc))
- skip_bits(gbc, 14); //skip timecode2 / xbsi2
+ 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->dolby_surround_ex_mode = get_bits(gbc, 2);
+ skip_bits(gbc, 12); // skip dheadphonmod, adconvtyp, xbsi2, encinfo
+ }
+ }
/* skip additional bitstream info */
if (get_bits1(gbc)) {
diff --git a/libavcodec/ac3dec.h b/libavcodec/ac3dec.h
index 68e2270..bba4562 100644
--- a/libavcodec/ac3dec.h
+++ b/libavcodec/ac3dec.h
@@ -88,6 +88,7 @@ typedef struct AC3DecodeContext {
int surround_mix_level; ///< Surround mix level index
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)
///@}
///@name Frame syntax parameters
--
1.8.3.4 (Apple Git-47)
_______________________________________________
libav-devel mailing list
[email protected]
https://lists.libav.org/mailman/listinfo/libav-devel