[vlc-devel] [PATCH 1/3] mp4: save the multiview_mode meta-data encoded with the spatial media specification v1

Adrien Maglo magsoft at videolan.org
Wed Jul 26 21:24:27 CEST 2017


https://github.com/google/spatial-media/blob/master/docs/spherical-video-rfc.md#stereo-mode
---
 modules/demux/mp4/essetup.c | 14 ++++++++++++++
 modules/demux/mp4/libmp4.c  |  6 ++++++
 modules/demux/mp4/libmp4.h  |  5 +++++
 3 files changed, 25 insertions(+)

diff --git a/modules/demux/mp4/essetup.c b/modules/demux/mp4/essetup.c
index 6f995568a7..46adef6686 100644
--- a/modules/demux/mp4/essetup.c
+++ b/modules/demux/mp4/essetup.c
@@ -356,7 +356,21 @@ int SetupVideoES( demux_t *p_demux, mp4_track_t *p_track, MP4_Box_t *p_sample )
         if( p_uuid->i_type == ATOM_uuid
             && !CmpUUID( &p_uuid->i_uuid, &XML360BoxUUID )
             && p_uuid->data.p_360 )
+        {
             p_track->fmt.video.projection_mode = p_uuid->data.p_360->i_projection_mode;
+            switch (p_uuid->data.p_360->e_stereo_mode)
+            {
+            case XML360_STEREOSCOPIC_TOP_BOTTOM:
+                p_track->fmt.video.multiview_mode = MULTIVIEW_STEREO_TB;
+                break;
+            case XML360_STEREOSCOPIC_LEFT_RIGHT:
+                p_track->fmt.video.multiview_mode = MULTIVIEW_STEREO_SBS;
+                break;
+            default:
+                p_track->fmt.video.multiview_mode = MULTIVIEW_2D;
+                break;
+            }
+        }
     }
 
     const MP4_Box_t *p_st3d = MP4_BoxGet( p_sample, "st3d" );
diff --git a/modules/demux/mp4/libmp4.c b/modules/demux/mp4/libmp4.c
index 0eeac770b0..d66e7a47ce 100644
--- a/modules/demux/mp4/libmp4.c
+++ b/modules/demux/mp4/libmp4.c
@@ -742,10 +742,16 @@ static int MP4_ReadBox_XML360( stream_t *p_stream, MP4_Box_t *p_box )
 
     /* Try to find the stero mode. */
     if ( strcasestr( psz_rdf, "left-right" ) )
+    {
         msg_Dbg( p_stream, "Left-right stereo mode" );
+        p_360_data->e_stereo_mode = XML360_STEREOSCOPIC_LEFT_RIGHT;
+    }
 
     if ( strcasestr( psz_rdf, "top-bottom" ) )
+    {
         msg_Dbg( p_stream, "Top-bottom stereo mode" );
+        p_360_data->e_stereo_mode = XML360_STEREOSCOPIC_TOP_BOTTOM;
+    }
 
     free( psz_rdf );
 
diff --git a/modules/demux/mp4/libmp4.h b/modules/demux/mp4/libmp4.h
index 7d7285b4b2..7725381978 100644
--- a/modules/demux/mp4/libmp4.h
+++ b/modules/demux/mp4/libmp4.h
@@ -1579,6 +1579,11 @@ typedef struct
 typedef struct
 {
     uint32_t i_projection_mode;
+    enum {
+        XML360_MONOSCOPIC = 0,
+        XML360_STEREOSCOPIC_TOP_BOTTOM = 1,
+        XML360_STEREOSCOPIC_LEFT_RIGHT = 2,
+    } e_stereo_mode;
 } MP4_Box_data_360_t;
 
 
-- 
2.11.0



More information about the vlc-devel mailing list