[vlc-commits] [Git][videolan/vlc][3.0.x] 8 commits: packetizer: dts: test and return sync word

Hugo Beauzée-Luyssen (@chouquette) gitlab at videolan.org
Thu Nov 11 12:09:16 UTC 2021



Hugo Beauzée-Luyssen pushed to branch 3.0.x at VideoLAN / VLC


Commits:
264b6c63 by Francois Cartegnie at 2021-11-11T11:56:36+00:00
packetizer: dts: test and return sync word

(cherry picked from commit e23d066b5183f6cf6d75f1fbab5d938bd4dc5452)
Signed-off-by: Marvin Scholz <epirat07 at gmail.com>

- - - - -
05150278 by Francois Cartegnie at 2021-11-11T11:56:36+00:00
packetizer_helper: add custom state offset

(cherry picked from commit 0ab18a89d6cbef7d88a77061334f59d7d84cf2de)
Signed-off-by: Marvin Scholz <epirat07 at gmail.com>

- - - - -
340583eb by Francois Cartegnie at 2021-11-11T11:56:36+00:00
packetizer: dts: store substream header size

(cherry picked from commit fcea1a345187062c49cf6747c8bff3106f3e5bf4)
Signed-off-by: Marvin Scholz <epirat07 at gmail.com>

- - - - -
73ec8e89 by Francois Cartegnie at 2021-11-11T11:56:36+00:00
packetizer: dts: handle substream in a dedicated state

(cherry picked from commit 516246a4bc518386c56854b90aa2a2db3522c8a0)
Signed-off-by: Marvin Scholz <epirat07 at gmail.com>

- - - - -
865f5423 by Francois Cartegnie at 2021-11-11T11:56:36+00:00
packetizer: dts: split second sync substream state

(cherry picked from commit 1f42cfc37622602babf1f50338a19981150f2457)
Signed-off-by: Marvin Scholz <epirat07 at gmail.com>

- - - - -
ee3c348a by Francois Cartegnie at 2021-11-11T11:56:36+00:00
packetizer: dts: renaming and store second header

(cherry picked from commit 4b0798f6875d48c90641dfa5106bf4d0f9f6a7ce)
Signed-off-by: Marvin Scholz <epirat07 at gmail.com>

- - - - -
6572382a by Francois Cartegnie at 2021-11-11T11:56:36+00:00
packetizer: dts: add LBR header parser

(cherry picked from commit 60cca0eadead0682e6625f825f6c7294999a49ee)
Signed-off-by: Marvin Scholz <epirat07 at gmail.com>

- - - - -
a108715f by Francois Cartegnie at 2021-11-11T11:56:36+00:00
packetizer: dts: handle LBR (fix #21973)

(cherry picked from commit ddf8716a0d749e9af01b6d1a32f6f99ab7aed340)
Signed-off-by: Marvin Scholz <epirat07 at gmail.com>

- - - - -


5 changed files:

- modules/audio_filter/converter/tospdif.c
- modules/packetizer/dts.c
- modules/packetizer/dts_header.c
- modules/packetizer/dts_header.h
- modules/packetizer/packetizer_helper.h


Changes:

=====================================
modules/audio_filter/converter/tospdif.c
=====================================
@@ -414,7 +414,8 @@ static int write_buffer_dts( filter_t *p_filter, block_t *p_in_buf )
         return SPDIF_ERROR;
     }
 
-    if( core.b_14b )
+    if( core.syncword == DTS_SYNC_CORE_14BITS_BE ||
+        core.syncword == DTS_SYNC_CORE_14BITS_LE )
     {
         if( p_in_buf->i_buffer > p_in_buf->i_nb_samples * 4 )
             return SPDIF_ERROR;


=====================================
modules/packetizer/dts.c
=====================================
@@ -68,10 +68,16 @@ struct decoder_sys_t
     mtime_t i_pts;
     bool    b_discontinuity;
 
-    vlc_dts_header_t dts;
+    vlc_dts_header_t first, second;
     size_t  i_input_size;
 };
 
+enum
+{
+    STATE_SYNC_SUBSTREAM_EXTENSIONS = STATE_CUSTOM_FIRST,
+    STATE_NEXT_SYNC_SUBSTREAM_EXTENSIONS,
+};
+
 static void PacketizeFlush( decoder_t *p_dec )
 {
     decoder_sys_t *p_sys = p_dec->p_sys;
@@ -87,33 +93,33 @@ static block_t *GetOutBuffer( decoder_t *p_dec )
     decoder_sys_t *p_sys = p_dec->p_sys;
 
     if( !p_sys->b_date_set
-     || p_dec->fmt_out.audio.i_rate != p_sys->dts.i_rate )
+     || p_dec->fmt_out.audio.i_rate != p_sys->first.i_rate )
     {
         msg_Dbg( p_dec, "DTS samplerate:%d bitrate:%d",
-                 p_sys->dts.i_rate, p_sys->dts.i_bitrate );
+                 p_sys->first.i_rate, p_sys->first.i_bitrate );
 
-        date_Init( &p_sys->end_date, p_sys->dts.i_rate, 1 );
+        date_Init( &p_sys->end_date, p_sys->first.i_rate, 1 );
         date_Set( &p_sys->end_date, p_sys->i_pts );
         p_sys->b_date_set = true;
     }
 
-    p_dec->fmt_out.audio.i_rate     = p_sys->dts.i_rate;
-    if( p_dec->fmt_out.audio.i_bytes_per_frame < p_sys->dts.i_frame_size )
-        p_dec->fmt_out.audio.i_bytes_per_frame = p_sys->dts.i_frame_size;
-    p_dec->fmt_out.audio.i_frame_length = p_sys->dts.i_frame_length;
+    p_dec->fmt_out.audio.i_rate     = p_sys->first.i_rate;
+    if( p_dec->fmt_out.audio.i_bytes_per_frame < p_sys->first.i_frame_size )
+        p_dec->fmt_out.audio.i_bytes_per_frame = p_sys->first.i_frame_size;
+    p_dec->fmt_out.audio.i_frame_length = p_sys->first.i_frame_length;
 
-    p_dec->fmt_out.audio.i_chan_mode = p_sys->dts.i_chan_mode;
-    p_dec->fmt_out.audio.i_physical_channels = p_sys->dts.i_physical_channels;
+    p_dec->fmt_out.audio.i_chan_mode = p_sys->first.i_chan_mode;
+    p_dec->fmt_out.audio.i_physical_channels = p_sys->first.i_physical_channels;
     p_dec->fmt_out.audio.i_channels =
         popcount( p_dec->fmt_out.audio.i_physical_channels );
 
-    p_dec->fmt_out.i_bitrate = p_sys->dts.i_bitrate;
+    p_dec->fmt_out.i_bitrate = p_sys->first.i_bitrate;
 
     block_t *p_block = block_Alloc( p_sys->i_input_size );
     if( p_block == NULL )
         return NULL;
 
-    p_block->i_nb_samples = p_sys->dts.i_frame_length;
+    p_block->i_nb_samples = p_sys->first.i_frame_length;
     p_block->i_pts = p_block->i_dts = date_Get( &p_sys->end_date );
     p_block->i_length =
         date_Increment( &p_sys->end_date, p_block->i_nb_samples ) - p_block->i_pts;
@@ -198,7 +204,7 @@ static block_t *PacketizeBlock( decoder_t *p_dec, block_t **pp_block )
             }
 
             /* Check if frame is valid and get frame info */
-            if( vlc_dts_header_Parse( &p_sys->dts, p_header,
+            if( vlc_dts_header_Parse( &p_sys->first, p_header,
                                       VLC_DTS_HEADER_SIZE ) != VLC_SUCCESS )
             {
                 msg_Dbg( p_dec, "emulated sync word" );
@@ -207,20 +213,56 @@ static block_t *PacketizeBlock( decoder_t *p_dec, block_t **pp_block )
                 break;
             }
 
-            if( p_sys->dts.b_substream  )
+            if( p_sys->first.syncword == DTS_SYNC_SUBSTREAM )
+                p_sys->i_state = STATE_SYNC_SUBSTREAM_EXTENSIONS;
+            else
+                p_sys->i_state = STATE_NEXT_SYNC;
+            p_sys->i_input_size = p_sys->i_next_offset = p_sys->first.i_frame_size;
+            break;
+
+        case STATE_SYNC_SUBSTREAM_EXTENSIONS:
+            /* Peek into the substream extension (sync + header size < frame_size) */
+            if( block_PeekOffsetBytes( &p_sys->bytestream,
+                                       p_sys->first.i_substream_header_size,
+                                       p_header,
+                                       VLC_DTS_HEADER_SIZE ) != VLC_SUCCESS )
+            {
+                /* Need more data */
+                return NULL;
+            }
+
+            vlc_dts_header_t xssheader;
+            if( vlc_dts_header_Parse( &xssheader, p_header,
+                                      VLC_DTS_HEADER_SIZE ) != VLC_SUCCESS )
             {
-                msg_Warn( p_dec, "substream without the paired core stream, "
-                          "skip it" );
+                msg_Dbg( p_dec, "emulated substream sync word, can't find extension" );
+                block_SkipByte( &p_sys->bytestream );
                 p_sys->i_state = STATE_NOSYNC;
-                if( block_SkipBytes( &p_sys->bytestream,
-                                     p_sys->dts.i_frame_size ) != VLC_SUCCESS )
-                    return NULL;
                 break;
             }
 
-            p_sys->i_input_size = p_sys->i_next_offset = p_sys->dts.i_frame_size;
-            p_sys->i_state = STATE_NEXT_SYNC;
-            /* fallthrough */
+            if( xssheader.syncword == DTS_SYNC_SUBSTREAM_LBR )
+            {
+                /*
+                 * LBR exists as independant SUBSTREAM. It is seen valid
+                 * only when SUBSTREAM[LBR]..SUBTREAM.
+                 * CORE...SUBSTREAM is regular extension.
+                 * SUBSTREAM...CORE is sync issue.
+                 */
+                p_dec->fmt_out.i_profile = PROFILE_DTS_EXPRESS;
+                p_sys->first.i_rate = xssheader.i_rate;
+                p_sys->first.i_frame_length = xssheader.i_frame_length;
+                p_sys->i_state = STATE_NEXT_SYNC;
+                break;
+            }
+
+            msg_Warn( p_dec, "substream without the paired core stream, skip it" );
+            p_sys->i_state = STATE_NOSYNC;
+            p_dec->fmt_out.i_profile = PROFILE_DTS;
+            if( block_SkipBytes( &p_sys->bytestream,
+                                 p_sys->first.i_frame_size ) != VLC_SUCCESS )
+                return NULL;
+            break;
 
         case STATE_NEXT_SYNC:
             /* Check if next expected frame contains the sync word */
@@ -250,13 +292,13 @@ static block_t *PacketizeBlock( decoder_t *p_dec, block_t **pp_block )
                 if( !vlc_dts_header_IsSync( p_header, VLC_DTS_HEADER_SIZE ) )
                 {
                     /* Even frame size is likely incorrect FSIZE #18166 */
-                    if( (p_sys->dts.i_frame_size % 2) && p_sys->i_next_offset > 0 &&
+                    if( (p_sys->first.i_frame_size % 2) && p_sys->i_next_offset > 0 &&
                         block_PeekOffsetBytes( &p_sys->bytestream,
                                                p_sys->i_next_offset - 1, p_header,
                                                VLC_DTS_HEADER_SIZE ) == 0 &&
                          vlc_dts_header_IsSync( p_header, VLC_DTS_HEADER_SIZE ) )
                     {
-                        p_sys->i_input_size = p_sys->i_next_offset = p_sys->dts.i_frame_size - 1;
+                        p_sys->i_input_size = p_sys->i_next_offset = p_sys->first.i_frame_size - 1;
                         /* reenter */
                         break;
                     }
@@ -269,19 +311,34 @@ static block_t *PacketizeBlock( decoder_t *p_dec, block_t **pp_block )
 
                 /* Check if a DTS substream packet is located just after
                  * the core packet */
-                if( p_sys->i_next_offset == p_sys->dts.i_frame_size )
+                if( p_sys->i_next_offset == p_sys->first.i_frame_size &&
+                    vlc_dts_header_Parse( &p_sys->second,
+                                          p_header, VLC_DTS_HEADER_SIZE ) == VLC_SUCCESS &&
+                    p_sys->second.syncword == DTS_SYNC_SUBSTREAM )
                 {
-                    vlc_dts_header_t next_header;
-                    if( vlc_dts_header_Parse( &next_header, p_header,
-                                              VLC_DTS_HEADER_SIZE )
-                        == VLC_SUCCESS && next_header.b_substream )
-                    {
-                        p_dec->fmt_out.i_profile = PROFILE_DTS_HD;
-                        p_sys->i_input_size += next_header.i_frame_size;
-                    }
+                    p_sys->i_state = STATE_NEXT_SYNC_SUBSTREAM_EXTENSIONS;
                 }
-                p_sys->i_state = STATE_GET_DATA;
+                else
+                {
+                    p_dec->fmt_out.i_profile = PROFILE_DTS;
+                    p_sys->i_state = STATE_GET_DATA;
+                }
+            }
+            break;
+
+        case STATE_NEXT_SYNC_SUBSTREAM_EXTENSIONS:
+            assert(p_sys->second.syncword == DTS_SYNC_SUBSTREAM);
+            if( p_sys->first.syncword == DTS_SYNC_SUBSTREAM )
+            {
+                /* First substream must have been LBR */
+                p_dec->fmt_out.i_profile = PROFILE_DTS_EXPRESS;
+            }
+            else /* Otherwise that's core + extensions, we need to output both */
+            {
+                p_dec->fmt_out.i_profile = PROFILE_DTS_HD;
+                p_sys->i_input_size += p_sys->second.i_frame_size;
             }
+            p_sys->i_state = STATE_GET_DATA;
             break;
 
         case STATE_GET_DATA:
@@ -355,7 +412,8 @@ static int Open( vlc_object_t *p_this )
     p_sys->i_pts = VLC_TS_INVALID;
     p_sys->b_date_set = false;
     p_sys->b_discontinuity = false;
-    memset(&p_sys->dts, 0, sizeof(vlc_dts_header_t));
+    memset(&p_sys->first, 0, sizeof(vlc_dts_header_t));
+    memset(&p_sys->second, 0, sizeof(vlc_dts_header_t));
     block_BytestreamInit( &p_sys->bytestream );
 
     /* Set output properties (passthrough only) */


=====================================
modules/packetizer/dts_header.c
=====================================
@@ -95,42 +95,35 @@ static int Buf14To16( uint8_t *p_out, const uint8_t *p_in, int i_in, int i_le,
     return i_out;
 }
 
-enum dts_bitsteam_type {
-    DTS_SYNC_CORE_BE,
-    DTS_SYNC_CORE_LE,
-    DTS_SYNC_CORE_14BITS_BE,
-    DTS_SYNC_CORE_14BITS_LE,
-    DTS_SYNC_SUBSTREAM,
-};
-
-static bool dts_header_IsSync( const uint8_t *p_buf,
-                               enum dts_bitsteam_type *p_bitstream_type )
+static enum vlc_dts_syncword_e dts_header_getSyncword( const uint8_t *p_buf )
 {
     if( memcmp( p_buf, "\x7F\xFE\x80\x01", 4 ) == 0 )
-        *p_bitstream_type = DTS_SYNC_CORE_BE;
+        return DTS_SYNC_CORE_BE;
     else
     if( memcmp( p_buf, "\xFE\x7F\x01\x80", 4 ) == 0 )
-        *p_bitstream_type = DTS_SYNC_CORE_LE;
+        return DTS_SYNC_CORE_LE;
     else
     if( memcmp( p_buf, "\x64\x58\x20\x25", 4 ) == 0 )
-        *p_bitstream_type = DTS_SYNC_SUBSTREAM;
+        return DTS_SYNC_SUBSTREAM;
     else
     if( memcmp( p_buf, "\x1F\xFF\xE8\x00", 4 ) == 0
      && p_buf[4] == 0x07 && (p_buf[5] & 0xf0) == 0xf0 )
-        *p_bitstream_type = DTS_SYNC_CORE_14BITS_BE;
+        return DTS_SYNC_CORE_14BITS_BE;
     else
     if( memcmp( p_buf, "\xFF\x1F\x00\xE8", 4 ) == 0
      && (p_buf[4] & 0xf0) == 0xf0 && p_buf[5] == 0x07 )
-        *p_bitstream_type = DTS_SYNC_CORE_14BITS_LE;
+        return DTS_SYNC_CORE_14BITS_LE;
     else
-        return false;
-    return true;
+    if( memcmp( p_buf, "\x0A\x80\x19\x21", 4 ) == 0 )
+        return DTS_SYNC_SUBSTREAM_LBR;
+    else
+        return DTS_SYNC_NONE;
 }
 
 bool vlc_dts_header_IsSync( const void *p_buf, size_t i_buf )
 {
     return i_buf >= 6
-        && dts_header_IsSync( p_buf, &(enum dts_bitsteam_type) { 0 } );
+        && dts_header_getSyncword( p_buf ) != DTS_SYNC_NONE;
 }
 
 static unsigned int dca_get_samplerate( uint8_t i_sfreq )
@@ -244,6 +237,49 @@ static uint16_t dca_get_channels( uint8_t i_amode, bool b_lfe,
     return i_physical_channels;
 }
 
+static uint8_t dca_get_LBR_channels( uint16_t nuSpkrActivityMask,
+                                     uint16_t *pi_chans )
+{
+    uint16_t i_physical_channels = 0;
+    uint8_t i_channels = 0;
+
+    static const struct
+    {
+        int phy;
+        uint8_t nb;
+    } bitmask[16] = {
+         /* table 7-10 */
+        { AOUT_CHAN_CENTER,     1 },
+        { AOUT_CHANS_FRONT,     2 },
+        { AOUT_CHANS_MIDDLE,    2 },
+        { AOUT_CHAN_LFE,        1 },
+        { AOUT_CHAN_REARCENTER, 1 },
+        { 0,                    2 },
+        { AOUT_CHANS_REAR,      2 },
+        { 0,                    1 },
+        { 0,                    1 },
+        { 0,                    2 },
+        { AOUT_CHANS_FRONT,     2 },
+        { AOUT_CHANS_MIDDLE,    2 },
+        { 0,                    1 },
+        { 0,                    2 },
+        { 0,                    1 },
+        { 0,                    2 },
+    };
+
+    for( int i=0 ; nuSpkrActivityMask; nuSpkrActivityMask >>= 1 )
+    {
+        if( nuSpkrActivityMask & 1 )
+        {
+            i_physical_channels |= bitmask[i].phy;
+            i_channels += bitmask[i].nb;
+        }
+        ++i;
+    }
+    *pi_chans = i_physical_channels;
+    return i_channels;
+}
+
 static int dts_header_ParseSubstream( vlc_dts_header_t *p_header,
                                       const void *p_buffer )
 {
@@ -252,24 +288,65 @@ static int dts_header_ParseSubstream( vlc_dts_header_t *p_header,
     bs_skip( &s, 32 /*SYNCEXTSSH*/ + 8 /*UserDefinedBits*/ + 2 /*nExtSSIndex*/ );
     uint8_t bHeaderSizeType = bs_read1( &s );
     uint32_t nuBits4ExSSFsize;
+    uint16_t nuExtSSHeaderSize;
     if( bHeaderSizeType == 0 )
     {
-        bs_skip( &s, 8 /*nuBits4Header*/ );
+        nuExtSSHeaderSize = bs_read( &s, 8 /*nuBits4Header*/ );
         nuBits4ExSSFsize = bs_read( &s, 16 );
     }
     else
     {
-        bs_skip( &s, 12 /*nuBits4Header*/ );
+        nuExtSSHeaderSize = bs_read( &s, 12 /*nuBits4Header*/ );
         nuBits4ExSSFsize = bs_read( &s, 20 );
     }
     memset( p_header, 0, sizeof(*p_header) );
-    p_header->b_substream = true;
+    p_header->syncword = DTS_SYNC_SUBSTREAM;
+    p_header->i_substream_header_size = nuExtSSHeaderSize + 1;
     p_header->i_frame_size = nuBits4ExSSFsize + 1;
     return VLC_SUCCESS;
 }
 
+static int dts_header_ParseLBRExtSubstream( vlc_dts_header_t *p_header,
+                                             const void *p_buffer )
+{
+    bs_t s;
+    bs_init( &s, p_buffer, VLC_DTS_HEADER_SIZE );
+    bs_skip( &s, 32 /*SYNCEXTSSH*/ );
+    uint8_t ucFmtInfoCode = bs_read( &s, 8 );
+    if( ucFmtInfoCode != 0x02 /*LBR_HDRCODE_DECODERINIT*/ )
+        return VLC_EGENERIC;
+    p_header->i_rate = bs_read( &s, 8 );
+    /* See ETSI TS 102 114, table 9-3 */
+    const unsigned int LBRsamplerates[] = {
+        8000, 16000, 32000,
+        0, 0,
+        22050, 44100,
+        0, 0, 0,
+        12000, 24000, 48000,
+    };
+    if(p_header->i_rate >= ARRAY_SIZE(LBRsamplerates))
+        return VLC_EGENERIC;
+    p_header->i_rate = LBRsamplerates[p_header->i_rate];
+    if( p_header->i_rate < 16000 )
+        p_header->i_frame_length = 1024;
+    else if( p_header->i_rate < 32000 )
+        p_header->i_frame_length = 2048;
+    else
+        p_header->i_frame_length = 4096;
+
+    uint16_t i_spkrmask = bs_read( &s, 16 );
+    dca_get_LBR_channels( i_spkrmask, &p_header->i_physical_channels );
+    bs_skip( &s, 16 );
+    bs_skip( &s, 8 );
+    uint16_t nLBRBitRateMSnybbles = bs_read( &s, 8 );
+    bs_skip( &s, 16 );
+    uint16_t nLBRScaledBitRate_LSW = bs_read( &s, 16 );
+    p_header->i_bitrate = nLBRScaledBitRate_LSW | ((nLBRBitRateMSnybbles & 0xF0) << 12);
+    return VLC_SUCCESS;
+}
+
 static int dts_header_ParseCore( vlc_dts_header_t *p_header,
-                                 const void *p_buffer, bool b_14b )
+                                 const void *p_buffer)
 {
     bs_t s;
     bs_init( &s, p_buffer, VLC_DTS_HEADER_SIZE );
@@ -289,12 +366,12 @@ static int dts_header_ParseCore( vlc_dts_header_t *p_header,
 
     bool b_lfe = i_lff == 1 || i_lff == 2;
 
-    p_header->b_substream = false;
-    p_header->b_14b = b_14b;
     p_header->i_rate = dca_get_samplerate( i_sfreq );
     p_header->i_bitrate = dca_get_bitrate( i_rate );
-    p_header->i_frame_size = !b_14b ? ( i_fsize + 1 )
-                                    : ( i_fsize + 1 ) * 16 / 14;
+    p_header->i_frame_size = i_fsize + 1;
+    if( p_header->syncword == DTS_SYNC_CORE_14BITS_LE ||
+        p_header->syncword == DTS_SYNC_CORE_14BITS_BE )
+        p_header->i_frame_size = p_header->i_frame_size * 16 / 14;
     /* See ETSI TS 102 114, table 5-2 */
     p_header->i_frame_length = (i_nblks + 1) * 32;
     p_header->i_chan_mode = 0;
@@ -316,50 +393,51 @@ ssize_t vlc_dts_header_Convert14b16b( void *p_dst, size_t i_dst,
     if( i_src <= VLC_DTS_HEADER_SIZE || i_size > i_dst )
         return -1;
 
-    enum dts_bitsteam_type bitstream_type;
-    if( !dts_header_IsSync( p_src, &bitstream_type ) )
+    enum vlc_dts_syncword_e syncword = dts_header_getSyncword( p_src );
+    if( syncword == DTS_SYNC_NONE )
         return -1;
 
-    if( bitstream_type != DTS_SYNC_CORE_14BITS_BE
-     && bitstream_type != DTS_SYNC_CORE_14BITS_LE )
+    if( syncword != DTS_SYNC_CORE_14BITS_BE
+     && syncword != DTS_SYNC_CORE_14BITS_LE )
         return -1;
 
     int i_ret = Buf14To16( p_dst, p_src, i_src,
-                           bitstream_type == DTS_SYNC_CORE_14BITS_LE, b_out_le );
+                           syncword == DTS_SYNC_CORE_14BITS_LE, b_out_le );
     return i_ret;
 }
 
 int vlc_dts_header_Parse( vlc_dts_header_t *p_header,
                           const void *p_buffer, size_t i_buffer)
 {
-    enum dts_bitsteam_type bitstream_type;
-
     if( i_buffer < VLC_DTS_HEADER_SIZE )
         return VLC_EGENERIC;
 
-    if( !dts_header_IsSync( p_buffer, &bitstream_type ) )
+    p_header->syncword = dts_header_getSyncword( p_buffer );
+    if( p_header->syncword == DTS_SYNC_NONE )
         return VLC_EGENERIC;
 
-    switch( bitstream_type )
+    switch( p_header->syncword )
     {
         case DTS_SYNC_CORE_LE:
         {
             uint8_t conv_buf[VLC_DTS_HEADER_SIZE];
             BufLeToBe( conv_buf, p_buffer, VLC_DTS_HEADER_SIZE );
-            return dts_header_ParseCore( p_header, conv_buf, false );
+            return dts_header_ParseCore( p_header, conv_buf );
         }
         case DTS_SYNC_CORE_BE:
-            return dts_header_ParseCore( p_header, p_buffer, false );
+            return dts_header_ParseCore( p_header, p_buffer );
         case DTS_SYNC_CORE_14BITS_BE:
         case DTS_SYNC_CORE_14BITS_LE:
         {
             uint8_t conv_buf[VLC_DTS_HEADER_SIZE];
             Buf14To16( conv_buf, p_buffer, VLC_DTS_HEADER_SIZE,
-                       bitstream_type == DTS_SYNC_CORE_14BITS_LE, 0 );
-            return dts_header_ParseCore( p_header, conv_buf, true );
+                       p_header->syncword == DTS_SYNC_CORE_14BITS_LE, 0 );
+            return dts_header_ParseCore( p_header, conv_buf );
         }
         case DTS_SYNC_SUBSTREAM:
             return dts_header_ParseSubstream( p_header, p_buffer );
+        case DTS_SYNC_SUBSTREAM_LBR:
+            return dts_header_ParseLBRExtSubstream( p_header, p_buffer );
         default:
             vlc_assert_unreachable();
     }


=====================================
modules/packetizer/dts_header.h
=====================================
@@ -27,15 +27,28 @@
 #define PROFILE_DTS_INVALID -1
 #define PROFILE_DTS 0
 #define PROFILE_DTS_HD 1
+#define PROFILE_DTS_EXPRESS 2
+
+enum vlc_dts_syncword_e
+{
+    DTS_SYNC_NONE = 0,
+    DTS_SYNC_CORE_BE,
+    DTS_SYNC_CORE_LE,
+    DTS_SYNC_CORE_14BITS_BE,
+    DTS_SYNC_CORE_14BITS_LE,
+    DTS_SYNC_SUBSTREAM,
+    /* Substreams internal syncs */
+    DTS_SYNC_SUBSTREAM_LBR,
+};
 
 typedef struct
 {
-    bool            b_substream;
-    bool            b_14b;
+    enum vlc_dts_syncword_e syncword;
     unsigned int    i_rate;
     unsigned int    i_bitrate;
     unsigned int    i_frame_size;
     unsigned int    i_frame_length;
+    uint32_t        i_substream_header_size;
     uint16_t        i_physical_channels;
     uint16_t        i_chan_mode;
 } vlc_dts_header_t;


=====================================
modules/packetizer/packetizer_helper.h
=====================================
@@ -33,7 +33,8 @@ enum
     STATE_HEADER,
     STATE_NEXT_SYNC,
     STATE_GET_DATA,
-    STATE_SEND_DATA
+    STATE_SEND_DATA,
+    STATE_CUSTOM_FIRST,
 };
 
 typedef void (*packetizer_reset_t)( void *p_private, bool b_broken );



View it on GitLab: https://code.videolan.org/videolan/vlc/-/compare/dfb2c62402b4441b411724e35298093f8546b474...a108715f1d0f6e7c878a5b9ba01c799f08dc78f3

-- 
View it on GitLab: https://code.videolan.org/videolan/vlc/-/compare/dfb2c62402b4441b411724e35298093f8546b474...a108715f1d0f6e7c878a5b9ba01c799f08dc78f3
You're receiving this email because of your account on code.videolan.org.




More information about the vlc-commits mailing list