mp4: save the multiview_mode meta-data encoded with the spatial media specification v1
authorAdrien Maglo <magsoft@videolan.org>
Wed, 26 Jul 2017 19:24:27 +0000 (21:24 +0200)
committerFrancois Cartegnie <fcvlcdev@free.fr>
Wed, 26 Jul 2017 22:10:59 +0000 (00:10 +0200)
https://github.com/google/spatial-media/blob/master/docs/spherical-video-rfc.md#stereo-mode

Signed-off-by: Francois Cartegnie <fcvlcdev@free.fr>
modules/demux/mp4/essetup.c
modules/demux/mp4/libmp4.c
modules/demux/mp4/libmp4.h

index 94ae10c..8e53e20 100644 (file)
@@ -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" );
index ba9fe06..7f85541 100644 (file)
@@ -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 );
 
index 56f71c0..a37d6fd 100644 (file)
@@ -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;