[vlc-devel] [PATCH 6/9] packetizer: detect AC-3 core + EAC3 extension

Thomas Guillem thomas at gllm.fr
Thu Oct 3 16:33:56 CEST 2019

This will allow audio output to first try EAC3 and/or fallback to AC3.

cf. https://en.wikipedia.org/wiki/Dolby_Digital_Plus#HD_DVD_and_Blu-ray_Disc

"On Blu-ray Disc, DD+ is an optional codec, and is deployed as an extension to a
"core" AC-3 5.1 audiotrack. The AC-3 core is encoded at 640 kbit/s, carries 5
primary channels (and 1 LFE), and is independently playable as a movie audio
track by any Blu-ray Disc player. The DD+ extension bitstream is used on
players that support it by replacing the rear channels in the 5.1 setup with
higher fidelity versions, along with providing a possible channel extension to
6.1 or 7.1. The complete audio track is allowed a combined bitrate of 1.7
Mbit/s: 640 kbit/s for the AC-3 5.1 core, and 1 Mbit/s for the DD+ extension.
During playback, both the core and extension bitstreams contribute to the final
audio-output, according to rules embedded in the bitstream metadata."
 modules/packetizer/a52.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/modules/packetizer/a52.c b/modules/packetizer/a52.c
index 91afafcf54..810c23dc66 100644
--- a/modules/packetizer/a52.c
+++ b/modules/packetizer/a52.c
@@ -258,7 +258,11 @@ static block_t *PacketizeBlock( decoder_t *p_dec, block_t **pp_block )
             vlc_a52_header_t a52;
             if( !vlc_a52_header_Parse( &a52, p_header, VLC_A52_MIN_HEADER_SIZE )
              && a52.b_eac3 && a52.bs.eac3.strmtyp == EAC3_STRMTYP_DEPENDENT )
+            {
                 p_sys->i_input_size += a52.i_size;
+                p_dec->fmt_out.i_codec = VLC_CODEC_A52;
+                p_dec->fmt_out.audio.extended = true;
+            }
             p_sys->i_state = STATE_GET_DATA;

More information about the vlc-devel mailing list