[vlc-devel] [PATCH] libvlc: media: add projection in libvlc_video_track_t

Thomas Guillem thomas at gllm.fr
Thu Nov 24 18:07:42 CET 2016


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

diff --git a/include/vlc/libvlc_media.h b/include/vlc/libvlc_media.h
index fcbe2db..0905b37 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_90,             /**< or right_top */
 } 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 b30bbc4..bc6a523 100644
--- a/lib/media.c
+++ b/lib/media.c
@@ -122,6 +122,21 @@ static libvlc_video_orient_t vlc_to_libvlc_orient(video_orientation_t orient)
     }
 }
 
+static libvlc_video_projection_t
+vlc_to_libvlc_projection(video_projection_mode_t mode)
+{
+    switch (mode)
+    {
+        case PROJECTION_MODE_RECTANGULAR:
+            return libvlc_video_projection_rectangular;
+        case PROJECTION_MODE_EQUIRECTANGULAR:
+            return libvlc_video_projection_equirectangular;
+        case PROJECTION_MODE_CUBEMAP_LAYOUT_STANDARD:
+            return libvlc_video_projection_cubemap_layout_standard;
+        default: vlc_assert_unreachable();
+    }
+}
+
 static libvlc_media_list_t *media_get_subitems( libvlc_media_t * p_md,
                                                 bool b_create )
 {
@@ -1012,6 +1027,12 @@ libvlc_media_tracks_get( libvlc_media_t *p_md, libvlc_media_track_t *** pp_es )
             p_mes->video->i_frame_rate_den = p_es->video.i_frame_rate_base;
             p_mes->video->i_orientation =
                 vlc_to_libvlc_orient(p_es->video.orientation);
+            p_mes->video->i_projection =
+                vlc_to_libvlc_projection(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;
-- 
2.9.3



More information about the vlc-devel mailing list