[vlc-commits] mp4: save the multiview_mode meta-data encoded with the spatial media specification v1

Adrien Maglo git at videolan.org
Thu Jul 27 00:13:52 CEST 2017


vlc | branch: master | Adrien Maglo <magsoft at videolan.org> | Wed Jul 26 21:24:27 2017 +0200| [0fe27309aedb10c01288a41dcd9556efa12618a4] | committer: Francois Cartegnie

mp4: save the multiview_mode meta-data encoded with the spatial media specification v1

https://github.com/google/spatial-media/blob/master/docs/spherical-video-rfc.md#stereo-mode

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

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

 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 94ae10c7e2..8e53e204f4 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 ba9fe06fda..7f85541332 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 56f71c0309..a37d6fd0da 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;
 
 



More information about the vlc-commits mailing list