[vlc-commits] libvlc: media: add orientation 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:03 2016 +0100| [08670a3de27d4c6221dac5d11490f9d353f312c4] | committer: Thomas Guillem

libvlc: media: add orientation in libvlc_video_track_t

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

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

diff --git a/include/vlc/libvlc_media.h b/include/vlc/libvlc_media.h
index 8fd13fe..c94acb0 100644
--- a/include/vlc/libvlc_media.h
+++ b/include/vlc/libvlc_media.h
@@ -172,6 +172,18 @@ typedef struct libvlc_audio_track_t
     unsigned    i_rate;
 } libvlc_audio_track_t;
 
+typedef enum libvlc_video_orient_t
+{
+    libvlc_video_orient_top_left,       /**< Normal. Top line represents top, left column left. */
+    libvlc_video_orient_top_right,      /**< Flipped horizontally */
+    libvlc_video_orient_bottom_left,    /**< Flipped vertically */
+    libvlc_video_orient_bottom_right,   /**< Rotated 180 degrees */
+    libvlc_video_orient_left_top,       /**< Transposed */
+    libvlc_video_orient_left_bottom,    /**< Rotated 90 degrees clockwise (or 270 anti-clockwise) */
+    libvlc_video_orient_right_top,      /**< Rotated 90 degrees anti-clockwise */
+    libvlc_video_orient_right_bottom    /**< Anti-transposed */
+} libvlc_video_orient_t;
+
 typedef struct libvlc_video_track_t
 {
     unsigned    i_height;
@@ -180,6 +192,8 @@ typedef struct libvlc_video_track_t
     unsigned    i_sar_den;
     unsigned    i_frame_rate_num;
     unsigned    i_frame_rate_den;
+
+    libvlc_video_orient_t       i_orientation;
 } libvlc_video_track_t;
 
 typedef struct libvlc_subtitle_track_t
diff --git a/lib/media.c b/lib/media.c
index 8e07930..ac837a2 100644
--- a/lib/media.c
+++ b/lib/media.c
@@ -106,6 +106,17 @@ static const libvlc_meta_t vlc_to_libvlc_meta[] =
     [vlc_meta_DiscTotal]    = libvlc_meta_DiscTotal
 };
 
+static_assert(
+    ORIENT_TOP_LEFT     == (int) libvlc_video_orient_top_left &&
+    ORIENT_TOP_RIGHT    == (int) libvlc_video_orient_top_right &&
+    ORIENT_BOTTOM_LEFT  == (int) libvlc_video_orient_bottom_left &&
+    ORIENT_BOTTOM_RIGHT == (int) libvlc_video_orient_bottom_right &&
+    ORIENT_LEFT_TOP     == (int) libvlc_video_orient_left_top &&
+    ORIENT_LEFT_BOTTOM  == (int) libvlc_video_orient_left_bottom &&
+    ORIENT_RIGHT_TOP    == (int) libvlc_video_orient_right_top &&
+    ORIENT_RIGHT_BOTTOM == (int) libvlc_video_orient_right_bottom,
+    "Mismatch between libvlc_video_orient_t and video_orientation_t" );
+
 static libvlc_media_list_t *media_get_subitems( libvlc_media_t * p_md,
                                                 bool b_create )
 {
@@ -994,6 +1005,11 @@ libvlc_media_tracks_get( libvlc_media_t *p_md, libvlc_media_track_t *** pp_es )
             p_mes->video->i_sar_den = p_es->video.i_sar_den;
             p_mes->video->i_frame_rate_num = p_es->video.i_frame_rate;
             p_mes->video->i_frame_rate_den = p_es->video.i_frame_rate_base;
+
+            assert( p_es->video.orientation >= ORIENT_TOP_LEFT &&
+                    p_es->video.orientation <= ORIENT_RIGHT_BOTTOM );
+            p_mes->video->i_orientation = (int) p_es->video.orientation;
+
             break;
         case AUDIO_ES:
             p_mes->i_type = libvlc_track_audio;



More information about the vlc-commits mailing list