From 8d997bc0695eed22fcd27d82c6448200c79824ab Mon Sep 17 00:00:00 2001 From: Adrien Maglo Date: Mon, 5 Dec 2016 14:17:45 +0100 Subject: [PATCH] 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 --- 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 9ab5bf8c5a..7717423b69 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 ); -- 2.11.4.GIT