[vlc-devel] [PATCH 1/5] mp4: prhd, equi, cbmp and st3d boxes have a flag parameter

Filip Roséen filip at atch.se
Mon Dec 5 11:02:20 CET 2016


Hi Adrien,

On 2016-12-05 10:58, Adrien Maglo wrote:

> 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 a flag parameter of 4 bytes.
> 
> This commit fixes the reading of parameters contained in these boxes.
> ---
>  modules/demux/mp4/libmp4.c | 5 +++++
>  modules/demux/mp4/libmp4.h | 4 ++++
>  2 files changed, 9 insertions(+)

Is there any reason for declaring the *data-members* as `int32_t`,
instead of `uint32_t`?

Given that I expect, judging from the *data-member name*, that it is
to contain (bitwise) flags, I would recommend using an *unsigned* type
(as this is easier to work with).

> 
> diff --git a/modules/demux/mp4/libmp4.c b/modules/demux/mp4/libmp4.c
> index 9ab5bf8..4007aaa 100644
> --- a/modules/demux/mp4/libmp4.c
> +++ b/modules/demux/mp4/libmp4.c
> @@ -772,6 +772,7 @@ static int MP4_ReadBox_st3d( stream_t *p_stream, MP4_Box_t *p_box )
>      MP4_READBOX_ENTER( MP4_Box_data_st3d_t, NULL );
>  
>      MP4_Box_data_st3d_t *p_data = p_box->data.p_st3d;
> +    MP4_GET4BYTES( p_data->i_flags );
>      MP4_GET1BYTE( p_data->i_stereo_mode );
>  
>      MP4_READBOX_EXIT( 1 );
> @@ -782,6 +783,8 @@ static int MP4_ReadBox_prhd( stream_t *p_stream, MP4_Box_t *p_box )
>      MP4_READBOX_ENTER( MP4_Box_data_prhd_t, NULL );
>  
>      MP4_Box_data_prhd_t *p_data = p_box->data.p_prhd;
> +    MP4_GET4BYTES( p_data->i_flags );
> +
>      int32_t fixed16_16;
>      MP4_GET4BYTES( fixed16_16 );
>      p_data->f_pose_yaw_degrees   = (float) fixed16_16 / 65536.0f;
> @@ -800,6 +803,7 @@ static int MP4_ReadBox_equi( stream_t *p_stream, MP4_Box_t *p_box )
>      MP4_READBOX_ENTER( MP4_Box_data_equi_t, NULL );
>  
>      MP4_Box_data_equi_t *p_data = p_box->data.p_equi;
> +    MP4_GET4BYTES( p_data->i_flags );
>      MP4_GET4BYTES( p_data->i_projection_bounds_top );
>      MP4_GET4BYTES( p_data->i_projection_bounds_bottom );
>      MP4_GET4BYTES( p_data->i_projection_bounds_left );
> @@ -813,6 +817,7 @@ static int MP4_ReadBox_cbmp( stream_t *p_stream, MP4_Box_t *p_box )
>      MP4_READBOX_ENTER( MP4_Box_data_cbmp_t, NULL );
>  
>      MP4_Box_data_cbmp_t *p_data = p_box->data.p_cbmp;
> +    MP4_GET4BYTES( p_data->i_flags );
>      MP4_GET4BYTES( p_data->i_layout );
>      MP4_GET4BYTES( p_data->i_padding );
>  
> diff --git a/modules/demux/mp4/libmp4.h b/modules/demux/mp4/libmp4.h
> index 42e3e02..176c5b5 100644
> --- a/modules/demux/mp4/libmp4.h
> +++ b/modules/demux/mp4/libmp4.h
> @@ -1554,6 +1554,7 @@ typedef struct
>  
>  typedef struct
>  {
> +    int32_t i_flags;
>      enum {
>          ST3D_MONOSCOPIC = 0,
>          ST3D_STEREOSCOPIC_TOP_BOTTOM = 1,
> @@ -1564,6 +1565,7 @@ typedef struct
>  
>  typedef struct
>  {
> +    int32_t i_flags;
>      float f_pose_yaw_degrees;
>      float f_pose_pitch_degrees;
>      float f_pose_roll_degrees;
> @@ -1571,6 +1573,7 @@ typedef struct
>  
>  typedef struct
>  {
> +    int32_t i_flags;
>      uint32_t i_projection_bounds_top;
>      uint32_t i_projection_bounds_bottom;
>      uint32_t i_projection_bounds_left;
> @@ -1579,6 +1582,7 @@ typedef struct
>  
>  typedef struct
>  {
> +    int32_t i_flags;
>      uint32_t i_layout;
>      uint32_t i_padding;
>  } MP4_Box_data_cbmp_t;
> -- 
> 2.9.3
> 
> _______________________________________________
> vlc-devel mailing list
> To unsubscribe or modify your subscription options:
> https://mailman.videolan.org/listinfo/vlc-devel
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.videolan.org/pipermail/vlc-devel/attachments/20161205/85f1e10c/attachment.html>


More information about the vlc-devel mailing list