[vlc-commits] libvlc: media: add projection in libvlc_video_track_t

Thomas Guillem git at videolan.org
Mon Nov 28 16:37:45 CET 2016


vlc | branch: master | Thomas Guillem <thomas at gllm.fr> | Thu Nov 24 18:03:32 2016 +0100| [38aca24fb0cad5badd38d5ad07665c23844a1867] | committer: Thomas Guillem

libvlc: media: add projection in libvlc_video_track_t

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

 include/vlc/libvlc_media.h | 15 +++++++++++++++
 lib/media.c                | 15 +++++++++++++++
 2 files changed, 30 insertions(+)

diff --git a/include/vlc/libvlc_media.h b/include/vlc/libvlc_media.h
index c94acb0..01e571c 100644
--- a/include/vlc/libvlc_media.h
+++ b/include/vlc/libvlc_media.h
@@ -184,6 +184,14 @@ typedef enum libvlc_video_orient_t
     libvlc_video_orient_right_bottom    /**< Anti-transposed */
 } libvlc_video_orient_t;
 
+typedef enum libvlc_video_projection_t
+{
+    libvlc_video_projection_rectangular,
+    libvlc_video_projection_equirectangular, /**< 360 spherical */
+
+    libvlc_video_projection_cubemap_layout_standard = 0x100,
+} libvlc_video_projection_t;
+
 typedef struct libvlc_video_track_t
 {
     unsigned    i_height;
@@ -194,6 +202,13 @@ typedef struct libvlc_video_track_t
     unsigned    i_frame_rate_den;
 
     libvlc_video_orient_t       i_orientation;
+    libvlc_video_projection_t   i_projection;
+    struct {
+        float f_yaw_degrees;    /**< View point yaw in degrees ]-180;180] */
+        float f_pitch_degrees;  /**< View point pitch in degrees ]-90;90] */
+        float f_roll_degrees;   /**< View point roll in degrees ]-180;180] */
+        float f_fov_degrees;    /**< View point fov in degrees ]0;180[ */
+    } pose; /**< Initial view point */
 } libvlc_video_track_t;
 
 typedef struct libvlc_subtitle_track_t
diff --git a/lib/media.c b/lib/media.c
index ac837a2..fdd2445 100644
--- a/lib/media.c
+++ b/lib/media.c
@@ -117,6 +117,12 @@ static_assert(
     ORIENT_RIGHT_BOTTOM == (int) libvlc_video_orient_right_bottom,
     "Mismatch between libvlc_video_orient_t and video_orientation_t" );
 
+static_assert(
+    PROJECTION_MODE_RECTANGULAR             == (int) libvlc_video_projection_rectangular &&
+    PROJECTION_MODE_EQUIRECTANGULAR         == (int) libvlc_video_projection_equirectangular &&
+    PROJECTION_MODE_CUBEMAP_LAYOUT_STANDARD == (int) libvlc_video_projection_cubemap_layout_standard,
+    "Mismatch between libvlc_video_projection_t and video_projection_mode_t" );
+
 static libvlc_media_list_t *media_get_subitems( libvlc_media_t * p_md,
                                                 bool b_create )
 {
@@ -1010,6 +1016,15 @@ libvlc_media_tracks_get( libvlc_media_t *p_md, libvlc_media_track_t *** pp_es )
                     p_es->video.orientation <= ORIENT_RIGHT_BOTTOM );
             p_mes->video->i_orientation = (int) p_es->video.orientation;
 
+            assert( ( p_es->video.projection_mode >= PROJECTION_MODE_RECTANGULAR &&
+                    p_es->video.projection_mode <= PROJECTION_MODE_EQUIRECTANGULAR ) ||
+                    ( p_es->video.projection_mode == PROJECTION_MODE_CUBEMAP_LAYOUT_STANDARD ) );
+            p_mes->video->i_projection = (int) p_es->video.projection_mode;
+
+            p_mes->video->pose.f_yaw_degrees = p_es->video.pose.f_yaw_degrees;
+            p_mes->video->pose.f_pitch_degrees = p_es->video.pose.f_pitch_degrees;
+            p_mes->video->pose.f_roll_degrees = p_es->video.pose.f_roll_degrees;
+            p_mes->video->pose.f_fov_degrees = p_es->video.pose.f_fov_degrees;
             break;
         case AUDIO_ES:
             p_mes->i_type = libvlc_track_audio;



More information about the vlc-commits mailing list