[vlc-commits] mp4: fix the reading of prhd, equi, cbmp and st3d boxes

Adrien Maglo git at videolan.org
Tue Jan 3 16:59:48 CET 2017


vlc | branch: master | Adrien Maglo <magsoft at videolan.org> | Mon Dec  5 14:17:45 2016 +0100| [8d997bc0695eed22fcd27d82c6448200c79824ab] | committer: Francois Cartegnie

mp4: fix the reading of prhd, equi, cbmp and st3d boxes

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.

Signed-off-by: Francois Cartegnie <fcvlcdev at free.fr>

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=8d997bc0695eed22fcd27d82c6448200c79824ab
---

 modules/demux/mp4/libmp4.c | 36 ++++++++++++++++++++++++++++++++++++
 1 file changed, 36 insertions(+)

diff --git a/modules/demux/mp4/libmp4.c b/modules/demux/mp4/libmp4.c
index 9ab5bf8..7717423 100644
--- a/modules/demux/mp4/libmp4.c
+++ b/modules/demux/mp4/libmp4.c
@@ -771,6 +771,15 @@ 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 )
+        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 +790,15 @@ 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)
+        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 +817,15 @@ 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)
+        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 +839,15 @@ 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)
+        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 );



More information about the vlc-commits mailing list