[vlc-devel] [PATCH 1/5] mp4: fix the reading of prhd, equi, cbmp and st3d boxes
Adrien Maglo
magsoft at videolan.org
Mon Dec 5 14:17:45 CET 2016
According to the Google spatial video specification v2
https://github.com/google/spatial-media/blob/master/docs/spherical-video-v2-rfc.md
these boxes inherit from "FullBox" which has 4 additional bytes to store
version and flags.
---
modules/demux/mp4/libmp4.c | 48 ++++++++++++++++++++++++++++++++++++++++++++++
1 file changed, 48 insertions(+)
diff --git a/modules/demux/mp4/libmp4.c b/modules/demux/mp4/libmp4.c
index 9ab5bf8..8b335ea 100644
--- a/modules/demux/mp4/libmp4.c
+++ b/modules/demux/mp4/libmp4.c
@@ -771,6 +771,18 @@ static int MP4_ReadBox_st3d( stream_t *p_stream, MP4_Box_t *p_box )
{
MP4_READBOX_ENTER( MP4_Box_data_st3d_t, NULL );
+ uint8_t i_version;
+ MP4_GET1BYTE( i_version );
+ if ( i_version != 0 )
+ {
+ msg_Warn( p_stream, "'st3d' box with version != 0" );
+ MP4_READBOX_EXIT( 0 );
+ }
+
+ uint32_t i_flags;
+ VLC_UNUSED( i_flags );
+ MP4_GET3BYTES( i_flags );
+
MP4_Box_data_st3d_t *p_data = p_box->data.p_st3d;
MP4_GET1BYTE( p_data->i_stereo_mode );
@@ -781,6 +793,18 @@ static int MP4_ReadBox_prhd( stream_t *p_stream, MP4_Box_t *p_box )
{
MP4_READBOX_ENTER( MP4_Box_data_prhd_t, NULL );
+ uint8_t i_version;
+ MP4_GET1BYTE( i_version );
+ if (i_version != 0)
+ {
+ msg_Warn( p_stream, "'prhd' box with version != 0" );
+ MP4_READBOX_EXIT( 0 );
+ }
+
+ uint32_t i_flags;
+ VLC_UNUSED( i_flags );
+ MP4_GET3BYTES( i_flags );
+
MP4_Box_data_prhd_t *p_data = p_box->data.p_prhd;
int32_t fixed16_16;
MP4_GET4BYTES( fixed16_16 );
@@ -799,6 +823,18 @@ static int MP4_ReadBox_equi( stream_t *p_stream, MP4_Box_t *p_box )
{
MP4_READBOX_ENTER( MP4_Box_data_equi_t, NULL );
+ uint8_t i_version;
+ MP4_GET1BYTE( i_version );
+ if (i_version != 0)
+ {
+ msg_Warn( p_stream, "'equi' box with version != 0" );
+ MP4_READBOX_EXIT( 0 );
+ }
+
+ uint32_t i_flags;
+ VLC_UNUSED( i_flags );
+ MP4_GET3BYTES( i_flags );
+
MP4_Box_data_equi_t *p_data = p_box->data.p_equi;
MP4_GET4BYTES( p_data->i_projection_bounds_top );
MP4_GET4BYTES( p_data->i_projection_bounds_bottom );
@@ -812,6 +848,18 @@ static int MP4_ReadBox_cbmp( stream_t *p_stream, MP4_Box_t *p_box )
{
MP4_READBOX_ENTER( MP4_Box_data_cbmp_t, NULL );
+ uint8_t i_version;
+ MP4_GET1BYTE( i_version );
+ if (i_version != 0)
+ {
+ msg_Warn( p_stream, "'cbmp' box with version != 0" );
+ MP4_READBOX_EXIT( 0 );
+ }
+
+ uint32_t i_flags;
+ VLC_UNUSED( i_flags );
+ MP4_GET3BYTES( i_flags );
+
MP4_Box_data_cbmp_t *p_data = p_box->data.p_cbmp;
MP4_GET4BYTES( p_data->i_layout );
MP4_GET4BYTES( p_data->i_padding );
--
2.9.3
More information about the vlc-devel
mailing list