[vlc-commits] [Git][videolan/vlc][master] 19 commits: demux: libmp4: read the sample rate values as uint16_t

Steve Lhomme (@robUx4) gitlab at videolan.org
Sat Nov 15 14:28:28 UTC 2025



Steve Lhomme pushed to branch master at VideoLAN / VLC


Commits:
434d185e by Steve Lhomme at 2025-11-15T14:14:48+00:00
demux: libmp4: read the sample rate values as uint16_t

As they are stored.

- - - - -
9656e774 by Steve Lhomme at 2025-11-15T14:14:48+00:00
demux: libmp4: read the "vide" depth as unsigned

This is how it's defined in ISO/IEC 14496-12.

- - - - -
c825420c by Steve Lhomme at 2025-11-15T14:14:48+00:00
demux: libmp4: read the reserved values as unsigned

- - - - -
4b55a530 by Steve Lhomme at 2025-11-15T14:14:48+00:00
demux: libmp4: mark the "vide" i_qt_data_size as reserved

This is how it's defined in ISO/IEC 14496-12:2015.

- - - - -
2fcae611 by Steve Lhomme at 2025-11-15T14:14:48+00:00
demux: libmp4: use the same type for i_depend_on_ES_ID and i_ES_ID

They are defined as bit(16) in ISO/IEC 14496-1:2004.

- - - - -
b15adf59 by Steve Lhomme at 2025-11-15T14:14:48+00:00
demux: libmp4: read the 'vmhd' fields as unsigned

This is how it's defined in ISO/IEC 14496-12:2015.

- - - - -
89bb5488 by Steve Lhomme at 2025-11-15T14:14:48+00:00
demux: libmp4: read the 'tfdt' base media decode time as unsigned

This is how it's defined in ISO/IEC 14496-12:2015.

- - - - -
e92a8fab by Steve Lhomme at 2025-11-15T14:14:48+00:00
demux: libmp4: read the 'tkhd' width/height as unsigned

This is how it's defined in ISO/IEC 14496-12:2015.

- - - - -
6a46c3ae by Steve Lhomme at 2025-11-15T14:14:48+00:00
demux: libmp4: read the DecoderConfigDescriptor fields as unsigned

They are defined as bit(32) in ISO/IEC 14496-1:2004 but they don't make sense as signed values.

- - - - -
d57225fe by Steve Lhomme at 2025-11-15T14:14:48+00:00
demux: libmp4: read the dec3 channel location in uint8_t

It is read with MP4_GET1BYTE(). We don't make use of the value anyway.

libavformat doesn't read this value.

- - - - -
b0f5fbba by Steve Lhomme at 2025-11-15T14:14:48+00:00
demux: libmp4: rename 'tkdh' alternate group variable

To match the field in ISO/IEC 14496-12:2015.

- - - - -
7daea2ee by Steve Lhomme at 2025-11-15T14:14:48+00:00
demux: libmp4: simplify string length check

- - - - -
ef02bed7 by Steve Lhomme at 2025-11-15T14:14:48+00:00
demux: libmp4: move internal macro in C file

- - - - -
7b1900f9 by Steve Lhomme at 2025-11-15T14:14:48+00:00
demux: libmp4: add a macro to skip data

Not need to fill dummy values.

- - - - -
f2b09717 by Steve Lhomme at 2025-11-15T14:14:48+00:00
demux: libmp4: skip data rather than reading into a variable

- - - - -
51281a8d by Steve Lhomme at 2025-11-15T14:14:48+00:00
demux: libmp4: skip unused flags after box version

- - - - -
9c18cb56 by Steve Lhomme at 2025-11-15T14:14:48+00:00
demux: libmp4: add a macro to read amount data at once

It's faster than copying items one by one.

- - - - -
8ce9caeb by Steve Lhomme at 2025-11-15T14:14:48+00:00
demux: libmp4: read rdrf string in one call

- - - - -
6aab1e0b by Steve Lhomme at 2025-11-15T14:14:48+00:00
demux: libmp4: read Qt double sample rate in one call

- - - - -


3 changed files:

- modules/demux/mp4/essetup.c
- modules/demux/mp4/libmp4.c
- modules/demux/mp4/libmp4.h


Changes:

=====================================
modules/demux/mp4/essetup.c
=====================================
@@ -448,7 +448,7 @@ int SetupVideoES( demux_t *p_demux, const mp4_track_t *p_track, const MP4_Box_t
                     p_fmt->i_codec = VLC_CODEC_GREY;
                     break;
                 default:
-                    msg_Dbg( p_demux, "Unrecognized raw video format (depth = %d)",
+                    msg_Dbg( p_demux, "Unrecognized raw video format (depth = %" PRIu16 ")",
                              p_vide->i_depth );
                     p_fmt->i_codec = i_sample_type;
                     break;
@@ -1080,7 +1080,7 @@ int SetupAudioES( demux_t *p_demux, const mp4_track_t *p_track,
         case VLC_FOURCC( 'm', 'l', 'p', 'a' ):
             /* spec violation: 32 bits rate instead of fixed point */
             p_fmt->i_codec = VLC_CODEC_TRUEHD;
-            p_fmt->audio.i_rate = (p_soun->i_sampleratehi << 16) | p_soun->i_sampleratelo;
+            p_fmt->audio.i_rate = ((unsigned int)p_soun->i_sampleratehi << 16) | p_soun->i_sampleratelo;
             break;
 
         case ATOM_dtsc: /* DTS */
@@ -1135,7 +1135,7 @@ int SetupAudioES( demux_t *p_demux, const mp4_track_t *p_track,
             if( p_track->i_timescale != p_soun->i_sampleratehi && p_soun->i_qt_version == 0 )
             {
                 msg_Warn( p_demux, "i_timescale (%"PRId32") != i_sampleratehi "
-                          "(%u), making both equal (report any problem).",
+                          "(%"PRIu16"), making both equal (report any problem).",
                           p_track->i_timescale, p_soun->i_sampleratehi );
 
                 if( p_soun->i_sampleratehi != 0 )


=====================================
modules/demux/mp4/libmp4.c
=====================================
@@ -86,6 +86,36 @@ static char * MP4_Time2Str( stime_t i_duration, uint32_t i_scale )
         } \
     } while(0)
 
+#define MP4_COPY_BYTES( dst, size ) \
+    do \
+    { \
+        if( (i_read) >= (size) ) \
+        { \
+            memcpy( &dst, p_peek, size ); \
+            p_peek += (size); \
+            i_read -= (size); \
+        } \
+        else \
+        { \
+            dst = 0; \
+            i_read = 0; \
+        } \
+    } while(0)
+
+#define MP4_SKIPBYTES(size) \
+    do \
+    { \
+        if( (i_read) >= (size) ) \
+        { \
+            p_peek += (size); \
+            i_read -= (size); \
+        } \
+        else \
+        { \
+            i_read = 0; \
+        } \
+    } while(0)
+
 #define MP4_GET1BYTE( dst )  MP4_GETX_PRIVATE( dst, *p_peek, 1 )
 #define MP4_GET2BYTES( dst ) MP4_GETX_PRIVATE( dst, GetWBE(p_peek), 2 )
 #define MP4_GET3BYTES( dst ) MP4_GETX_PRIVATE( dst, Get24bBE(p_peek), 3 )
@@ -101,6 +131,17 @@ static char * MP4_Time2Str( stime_t i_duration, uint32_t i_scale )
     MP4_GET1BYTE( p_void->i_version ); \
     MP4_GET3BYTES( p_void->i_flags )
 
+#define READ_SAMPLE_DESC_COMMON_8BYTES_HEADER \
+    do\
+    {\
+        if( i_read < 8 )\
+            MP4_READBOX_EXIT( 0 );\
+        for( unsigned i = 0; i < 6 ; i++ )\
+            MP4_GET1BYTE( p_box->data.p_sample_gen->i_reserved1[i] );\
+        MP4_GET2BYTES( p_box->data.p_sample_gen->i_data_reference_index );\
+    } while(0)
+
+
 static char *mp4_getstringz( uint8_t **restrict in, uint64_t *restrict size )
 {
     assert( *size <= SSIZE_MAX );
@@ -171,8 +212,7 @@ static video_palette_t * ReadQuicktimePalette( uint8_t **pp_peek, uint64_t *pi_r
         return NULL;
     for( uint16_t i=0; i<i_colors_count; i++ )
     {
-        uint16_t dummy;
-        MP4_GET2BYTES(dummy); VLC_UNUSED(dummy);
+        MP4_SKIPBYTES(2);
         MP4_GET2BYTES(p_palette->palette[i][0]);
         MP4_GET2BYTES(p_palette->palette[i][1]);
         MP4_GET2BYTES(p_palette->palette[i][2]);
@@ -962,9 +1002,7 @@ static int MP4_ReadBox_st3d( stream_t *p_stream, MP4_Box_t *p_box )
     if ( i_version != 0 )
         MP4_READBOX_EXIT( 0 );
 
-    uint32_t i_flags;
-    VLC_UNUSED( i_flags );
-    MP4_GET3BYTES( i_flags );
+    MP4_SKIPBYTES( 3 ); // flags
 
     MP4_Box_data_st3d_t *p_data = p_box->data.p_st3d;
     MP4_GET1BYTE( p_data->i_stereo_mode );
@@ -981,9 +1019,7 @@ static int MP4_ReadBox_prhd( stream_t *p_stream, MP4_Box_t *p_box )
     if (i_version != 0)
         MP4_READBOX_EXIT( 0 );
 
-    uint32_t i_flags;
-    VLC_UNUSED( i_flags );
-    MP4_GET3BYTES( i_flags );
+    MP4_SKIPBYTES( 3 ); // flags
 
     MP4_Box_data_prhd_t *p_data = p_box->data.p_prhd;
     int32_t fixed16_16;
@@ -1008,9 +1044,7 @@ static int MP4_ReadBox_equi( stream_t *p_stream, MP4_Box_t *p_box )
     if (i_version != 0)
         MP4_READBOX_EXIT( 0 );
 
-    uint32_t i_flags;
-    VLC_UNUSED( i_flags );
-    MP4_GET3BYTES( i_flags );
+    MP4_SKIPBYTES( 3 ); // flags
 
     MP4_Box_data_equi_t *p_data = p_box->data.p_equi;
     MP4_GET4BYTES( p_data->i_projection_bounds_top );
@@ -1030,9 +1064,7 @@ static int MP4_ReadBox_cbmp( stream_t *p_stream, MP4_Box_t *p_box )
     if (i_version != 0)
         MP4_READBOX_EXIT( 0 );
 
-    uint32_t i_flags;
-    VLC_UNUSED( i_flags );
-    MP4_GET3BYTES( i_flags );
+    MP4_SKIPBYTES( 3 ); // flags
 
     MP4_Box_data_cbmp_t *p_data = p_box->data.p_cbmp;
     MP4_GET4BYTES( p_data->i_layout );
@@ -1067,10 +1099,9 @@ static int MP4_ReadBox_sidx(  stream_t *p_stream, MP4_Box_t *p_box )
         MP4_GET8BYTES( p_sidx_data->i_first_offset );
     }
 
-    uint16_t i_reserved, i_count;
+    uint16_t i_count;
 
-    VLC_UNUSED(i_reserved);
-    MP4_GET2BYTES( i_reserved );
+    MP4_SKIPBYTES( 2 ); // reserved
     MP4_GET2BYTES( i_count );
     if( i_count == 0 )
         MP4_READBOX_EXIT( 1 );
@@ -1285,7 +1316,7 @@ static int MP4_ReadBox_tkhd(  stream_t *p_stream, MP4_Box_t *p_box )
         MP4_GET4BYTES( p_box->data.p_tkhd->i_reserved2[i] );
     }
     MP4_GET2BYTES( p_box->data.p_tkhd->i_layer );
-    MP4_GET2BYTES( p_box->data.p_tkhd->i_predefined );
+    MP4_GET2BYTES( p_box->data.p_tkhd->i_alternate_group );
     MP4_GET2BYTES( p_box->data.p_tkhd->i_volume );
     MP4_GET2BYTES( p_box->data.p_tkhd->i_reserved3 );
 
@@ -1416,9 +1447,6 @@ static void MP4_FreeBox_hdlr( MP4_Box_t *p_box )
 
 static int MP4_ReadBox_hdlr( stream_t *p_stream, MP4_Box_t *p_box )
 {
-    int32_t i_reserved;
-    VLC_UNUSED(i_reserved);
-
     MP4_READBOX_ENTER( MP4_Box_data_hdlr_t, MP4_FreeBox_hdlr );
 
     MP4_GETVERSIONFLAGS( p_box->data.p_hdlr );
@@ -1426,9 +1454,7 @@ static int MP4_ReadBox_hdlr( stream_t *p_stream, MP4_Box_t *p_box )
     MP4_GETFOURCC( p_box->data.p_hdlr->i_predefined );
     MP4_GETFOURCC( p_box->data.p_hdlr->i_handler_type );
 
-    MP4_GET4BYTES( i_reserved );
-    MP4_GET4BYTES( i_reserved );
-    MP4_GET4BYTES( i_reserved );
+    MP4_SKIPBYTES( 3*4 ); // reserved[3]
     p_box->data.p_hdlr->psz_name = NULL;
 
     if( i_read >= SSIZE_MAX )
@@ -1479,7 +1505,7 @@ static int MP4_ReadBox_vmhd( stream_t *p_stream, MP4_Box_t *p_box )
     }
 
 #ifdef MP4_VERBOSE
-    msg_Dbg( p_stream, "read box: \"vmhd\" graphics-mode %d opcolor (%d, %d, %d)",
+    msg_Dbg( p_stream, "read box: \"vmhd\" graphics-mode %" PRIu16 " opcolor (%" PRIu16 ", %" PRIu16 ", %" PRIu16 ")",
                       p_box->data.p_vmhd->i_graphics_mode,
                       p_box->data.p_vmhd->i_opcolor[0],
                       p_box->data.p_vmhd->i_opcolor[1],
@@ -1713,10 +1739,9 @@ static int MP4_ReadBox_cslg( stream_t *p_stream, MP4_Box_t *p_box )
 {
     MP4_READBOX_ENTER( MP4_Box_data_cslg_t, NULL );
 
-    unsigned i_version, i_flags;
+    uint8_t i_version;
     MP4_GET1BYTE( i_version );
-    MP4_GET3BYTES( i_flags );
-    VLC_UNUSED(i_flags);
+    MP4_SKIPBYTES( 3 ); // flags
 
     if( i_version > 1 )
         MP4_READBOX_EXIT( 0 );
@@ -1991,9 +2016,7 @@ static int MP4_ReadBox_vpcC( stream_t *p_stream, MP4_Box_t *p_box )
         MP4_READBOX_EXIT( 0 );
 
     /* Skip flags */
-    uint32_t i_flags;
-    MP4_GET3BYTES( i_flags );
-    VLC_UNUSED( i_flags );
+    MP4_SKIPBYTES( 3 ); // flags
 
     MP4_GET1BYTE( p_vpcC->i_profile );
     MP4_GET1BYTE( p_vpcC->i_level );
@@ -2045,10 +2068,8 @@ static int MP4_ReadBox_SmDm( stream_t *p_stream, MP4_Box_t *p_box )
     if( p_box->i_type != ATOM_mdcv )
     {
         uint8_t i_version;
-        uint32_t i_flags;
         MP4_GET1BYTE( i_version );
-        MP4_GET3BYTES( i_flags );
-        VLC_UNUSED(i_flags);
+        MP4_SKIPBYTES( 3 ); // flags
         if( i_version != 0 )
             MP4_READBOX_EXIT( 0 );
     }
@@ -2093,10 +2114,8 @@ static int MP4_ReadBox_CoLL( stream_t *p_stream, MP4_Box_t *p_box )
     if( p_box->i_type != ATOM_clli )
     {
         uint8_t i_version;
-        uint32_t i_flags;
         MP4_GET1BYTE( i_version );
-        MP4_GET3BYTES( i_flags );
-        VLC_UNUSED(i_flags);
+        MP4_SKIPBYTES( 3 ); // flags
         if( i_version != 0 )
             MP4_READBOX_EXIT( 0 );
     }
@@ -2448,9 +2467,7 @@ static int MP4_ReadBox_stsdext_srat( stream_t *p_stream, MP4_Box_t *p_box )
     if ( i_read != 8 )
         MP4_READBOX_EXIT( 0 );
 
-    uint32_t i_dummy;
-    VLC_UNUSED( i_dummy );
-    MP4_GET4BYTES( i_dummy ); /* version flags */
+    MP4_SKIPBYTES( 4 ); /* version flags */
     MP4_GET4BYTES( p_srat->i_sample_rate );
 
     MP4_READBOX_EXIT( 1 );
@@ -2681,7 +2698,6 @@ static int MP4_ReadBox_sample_soun( stream_t *p_stream, MP4_Box_t *p_box )
     {
         /* SoundDescriptionV2 */
         double f_sample_rate;
-        int64_t i_dummy64;
         uint32_t i_channel, i_extoffset, i_dummy32;
 
         /* Checks */
@@ -2698,11 +2714,10 @@ static int MP4_ReadBox_sample_soun( stream_t *p_stream, MP4_Box_t *p_box )
         /* !Checks */
 
         MP4_GET4BYTES( i_extoffset ); /* offset to stsd extensions */
-        MP4_GET8BYTES( i_dummy64 );
-        memcpy( &f_sample_rate, &i_dummy64, 8 );
+        MP4_COPY_BYTES( f_sample_rate, 8 );
         msg_Dbg( p_stream, "read box: %f Hz", f_sample_rate );
         /* Rounding error with lo, but we don't care since we do not support fractional audio rate */
-        p_box->data.p_sample_soun->i_sampleratehi = (uint32_t)f_sample_rate;
+        p_box->data.p_sample_soun->i_sampleratehi = (uint16_t)f_sample_rate;
         p_box->data.p_sample_soun->i_sampleratelo = (f_sample_rate - p_box->data.p_sample_soun->i_sampleratehi);
 
         MP4_GET4BYTES( i_channel );
@@ -2823,7 +2838,7 @@ int MP4_ReadBox_sample_vide( stream_t *p_stream, MP4_Box_t *p_box )
     MP4_GET4BYTES( p_box->data.p_sample_vide->i_horizresolution );
     MP4_GET4BYTES( p_box->data.p_sample_vide->i_vertresolution );
 
-    MP4_GET4BYTES( p_box->data.p_sample_vide->i_qt_data_size );
+    MP4_GET4BYTES( p_box->data.p_sample_vide->reserved );
     MP4_GET2BYTES( p_box->data.p_sample_vide->i_qt_frame_count );
 
     if ( i_read < 32 )
@@ -3410,9 +3425,8 @@ static int MP4_ReadBox_elst( stream_t *p_stream, MP4_Box_t *p_box )
     MP4_Box_data_elst_t *p_elst = p_box->data.p_elst;
 
     uint8_t i_version;
-    uint32_t dummy;
     MP4_GET1BYTE( i_version );
-    MP4_GET3BYTES( dummy ); VLC_UNUSED(dummy);
+    MP4_SKIPBYTES( 3 );  // flags
 
     if( i_version > 1 )
         MP4_READBOX_EXIT( 0 );
@@ -3652,19 +3666,14 @@ static int MP4_ReadBox_rdrf( stream_t *p_stream, MP4_Box_t *p_box )
     MP4_GETVERSIONFLAGS( p_box->data.p_rdrf );
     MP4_GETFOURCC( p_box->data.p_rdrf->i_ref_type );
     MP4_GET4BYTES( i_len );
-    i_len++;
 
-    if( i_len > 0 )
+    if( i_len != 0 )
     {
-        p_box->data.p_rdrf->psz_ref = malloc( i_len );
+        p_box->data.p_rdrf->psz_ref = malloc( i_len + 1 );
         if( p_box->data.p_rdrf->psz_ref == NULL )
             MP4_READBOX_EXIT( 0 );
-        i_len--;
 
-        for( unsigned i = 0; i < i_len; i++ )
-        {
-            MP4_GET1BYTE( p_box->data.p_rdrf->psz_ref[i] );
-        }
+        MP4_COPY_BYTES( p_box->data.p_rdrf->psz_ref, i_len );
         p_box->data.p_rdrf->psz_ref[i_len] = '\0';
     }
     else
@@ -3860,8 +3869,6 @@ static void MP4_FreeBox_chpl( MP4_Box_t *p_box )
 static int MP4_ReadBox_chpl( stream_t *p_stream, MP4_Box_t *p_box )
 {
     MP4_Box_data_chpl_t *p_chpl;
-    uint32_t i_dummy;
-    VLC_UNUSED(i_dummy);
     int i;
     MP4_READBOX_ENTER( MP4_Box_data_chpl_t, MP4_FreeBox_chpl );
 
@@ -3872,7 +3879,7 @@ static int MP4_ReadBox_chpl( stream_t *p_stream, MP4_Box_t *p_box )
     if ( i_read < 5 || p_chpl->i_version != 0x1 )
         MP4_READBOX_EXIT( 0 );
 
-    MP4_GET4BYTES( i_dummy );
+    MP4_SKIPBYTES( 4 );
 
     MP4_GET1BYTE( p_chpl->i_chapter );
 
@@ -4194,14 +4201,11 @@ static int MP4_ReadBox_meta( stream_t *p_stream, MP4_Box_t *p_box )
 
 static int MP4_ReadBox_iods( stream_t *p_stream, MP4_Box_t *p_box )
 {
-    char i_unused;
-    VLC_UNUSED(i_unused);
-
     MP4_READBOX_ENTER( MP4_Box_data_iods_t, NULL );
     MP4_GETVERSIONFLAGS( p_box->data.p_iods );
 
-    MP4_GET1BYTE( i_unused ); /* tag */
-    MP4_GET1BYTE( i_unused ); /* length */
+    MP4_SKIPBYTES( 1 ); /* tag */
+    MP4_SKIPBYTES( 1 ); /* length */
 
     MP4_GET2BYTES( p_box->data.p_iods->i_object_descriptor ); /* 10bits, 6 other bits
                                                               are used for other flags */
@@ -4632,10 +4636,8 @@ static int MP4_ReadBox_iloc( stream_t *p_stream, MP4_Box_t *p_box )
     uint16_t i_foo;
 
     uint8_t i_version;
-    uint32_t i_flags;
     MP4_GET1BYTE( i_version );
-    MP4_GET3BYTES( i_flags );
-    VLC_UNUSED(i_flags);
+    MP4_SKIPBYTES( 3 ); // flags
 
     MP4_GET1BYTE( p_data->i_offset_size );
     p_data->i_length_size = p_data->i_offset_size & 0x0F;
@@ -4755,9 +4757,8 @@ static int MP4_ReadBox_iinf( stream_t *p_stream, MP4_Box_t *p_box )
         MP4_READBOX_EXIT( 0 );
 
     uint8_t i_version;
-    uint32_t i_flags;
     MP4_GET1BYTE( i_version );
-    MP4_GET3BYTES( i_flags ); VLC_UNUSED(i_flags);
+    MP4_SKIPBYTES( 3 ); // flags
     if( i_version > 2 )
         MP4_READBOX_EXIT( 0 );
 
@@ -4858,9 +4859,8 @@ static int MP4_ReadBox_pitm( stream_t *p_stream, MP4_Box_t *p_box )
     MP4_Box_data_pitm_t *p_data = p_box->data.p_pitm;
 
     uint8_t i_version;
-    uint32_t i_flags;
     MP4_GET1BYTE( i_version );
-    MP4_GET3BYTES( i_flags ); VLC_UNUSED(i_flags);
+    MP4_SKIPBYTES( 3 ); // flags
 
     if( i_version == 0 )
         MP4_GET2BYTES( p_data->i_item_id );
@@ -4876,9 +4876,8 @@ static int MP4_ReadBox_ispe( stream_t *p_stream, MP4_Box_t *p_box )
     MP4_Box_data_ispe_t *p_data = p_box->data.p_ispe;
 
     uint8_t i_version;
-    uint32_t i_flags;
     MP4_GET1BYTE( i_version );
-    MP4_GET3BYTES( i_flags ); VLC_UNUSED(i_flags);
+    MP4_SKIPBYTES( 3 ); // flags
     if( i_version > 0 )
         MP4_READBOX_EXIT( 0 );
 


=====================================
modules/demux/mp4/libmp4.h
=====================================
@@ -540,7 +540,7 @@ typedef struct MP4_Box_data_mvhd_s
 
     int32_t  i_rate;
     int16_t  i_volume;
-    int16_t  i_reserved1;
+    uint16_t i_reserved1;
     uint32_t i_reserved2[2];
     int32_t  i_matrix[9];
     uint32_t i_predefined[6];
@@ -564,13 +564,13 @@ typedef struct MP4_Box_data_tkhd_s
 
     uint32_t i_reserved2[2];
     int16_t  i_layer;
-    int16_t  i_predefined;
+    int16_t  i_alternate_group;
 
     int16_t  i_volume;
     uint16_t i_reserved3;
     int32_t  i_matrix[9];
-    int32_t  i_width;
-    int32_t  i_height;
+    uint32_t i_width;
+    uint32_t i_height;
     float    f_rotation;
     int      i_flip;
 
@@ -620,8 +620,8 @@ typedef struct MP4_Box_data_vmhd_s
     uint8_t  i_version;
     uint32_t i_flags;
 
-    int16_t  i_graphics_mode;
-    int16_t  i_opcolor[3];
+    uint16_t i_graphics_mode;
+    uint16_t i_opcolor[3];
 
 } MP4_Box_data_vmhd_t;
 
@@ -631,7 +631,7 @@ typedef struct MP4_Box_data_smhd_s
     uint32_t i_flags;
 
     int16_t  i_balance;
-    int16_t  i_reserved;
+    uint16_t i_reserved;
 
 } MP4_Box_data_smhd_t;
 
@@ -745,16 +745,6 @@ typedef struct
     uint8_t  i_reserved1[6];\
     uint16_t i_data_reference_index
 
-#define READ_SAMPLE_DESC_COMMON_8BYTES_HEADER \
-    do\
-    {\
-        if( i_read < 8 )\
-            MP4_READBOX_EXIT( 0 );\
-        for( unsigned i = 0; i < 6 ; i++ )\
-            MP4_GET1BYTE( p_box->data.p_sample_gen->i_reserved1[i] );\
-        MP4_GET2BYTES( p_box->data.p_sample_gen->i_data_reference_index );\
-    } while(0)
-
 typedef struct
 {
     SAMPLE_DESC_COMMON_HEADER;
@@ -768,8 +758,8 @@ typedef struct
     uint16_t i_samplesize;
     uint16_t i_compressionid;
     uint16_t i_reserved3;
-    uint32_t i_sampleratehi; /* timescale of track */
-    uint32_t i_sampleratelo;
+    uint16_t i_sampleratehi; /* timescale of track */
+    uint16_t i_sampleratelo;
 
     /* for version 1 (i_reserved1[0] == 1) */
     uint32_t i_sample_per_packet;
@@ -806,11 +796,11 @@ typedef struct
     uint32_t i_horizresolution;
     uint32_t i_vertresolution;
 
-    uint32_t i_qt_data_size;
+    uint32_t reserved;
     uint16_t i_qt_frame_count;
 
     char     sz_compressorname[32];
-    int16_t  i_depth;
+    uint16_t i_depth;
 
     int16_t  i_qt_color_table;
     video_palette_t *p_palette;
@@ -1023,9 +1013,9 @@ typedef struct MP4_descriptor_decoder_config_s
     uint8_t i_objectProfileIndication;
     uint8_t i_streamType;
     int     b_upStream;
-    int     i_buffer_sizeDB;
-    int     i_max_bitrate;
-    int     i_avg_bitrate;
+    uint32_t i_buffer_sizeDB;
+    uint32_t i_max_bitrate;
+    uint32_t i_avg_bitrate;
 
     int     i_decoder_specific_info_len;
     uint8_t *p_decoder_specific_info;
@@ -1049,7 +1039,7 @@ typedef struct MP4_descriptor_ES_s /* ISO/IEC 14496-1 8.3.3 ES_DescrTag */
     int      b_OCRstream;
     int      i_stream_priority;
 
-    int      i_depend_on_ES_ID; /* if b_stream_dependence set */
+    uint16_t  i_depend_on_ES_ID; /* if b_stream_dependence set */
 
     unsigned char *psz_URL;
 
@@ -1239,7 +1229,7 @@ typedef struct MP4_Box_data_tfdt_s
 {
     uint8_t  i_version;
     uint32_t i_flags;
-    int64_t  i_base_media_decode_time;
+    uint64_t i_base_media_decode_time;
 
 } MP4_Box_data_tfdt_t;
 
@@ -1422,7 +1412,7 @@ typedef struct
         uint8_t i_acmod;
         uint8_t i_lfeon;
         uint8_t i_num_dep_sub;
-        uint16_t i_chan_loc;
+        uint8_t i_chan_loc;
     } stream[8];
 
 } MP4_Box_data_dec3_t;



View it on GitLab: https://code.videolan.org/videolan/vlc/-/compare/7e03d42a055cd44cf9b8cc52828a9d784b8070a3...6aab1e0b2b25971eb2e217c93b68a5ca831f5334

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


VideoLAN code repository instance


More information about the vlc-commits mailing list