[vlc-devel] [PATCH 2/7] Support for rotated MP4 Movies (bug #2882)

Matthias Keiser matthias at tristan-inc.com
Mon Feb 17 01:28:15 CET 2014


---
 include/vlc_vout_display.h |  3 +++
 include/vlc_vout_wrapper.h |  1 +
 src/video_output/display.c | 17 +++++++++++++++++
 3 files changed, 21 insertions(+)

diff --git a/include/vlc_vout_display.h b/include/vlc_vout_display.h
index d99cf7e..965d6c5 100644
--- a/include/vlc_vout_display.h
+++ b/include/vlc_vout_display.h
@@ -173,6 +173,9 @@ enum {
 
     /* Ask an opengl interface if available. */
     VOUT_DISPLAY_GET_OPENGL,           /* vlc_gl_t ** */
+
+    /* Ask the display if it handles video format orientations. */
+    VOUT_DISPLAY_CAN_HANDLE_ORIENTATION /* bool * */
 };
 
 /**
diff --git a/include/vlc_vout_wrapper.h b/include/vlc_vout_wrapper.h
index 26d1d85..4496eba 100644
--- a/include/vlc_vout_wrapper.h
+++ b/include/vlc_vout_wrapper.h
@@ -93,6 +93,7 @@ VLC_API void vout_SetDisplayCrop(vout_display_t *, unsigned crop_num, unsigned c
 
 struct vlc_gl_t;
 VLC_API struct vlc_gl_t * vout_GetDisplayOpengl(vout_display_t *);
+VLC_API bool vout_CanDisplayHandleOrientation(vout_display_t *);
 
 #endif /* VLC_VOUT_WRAPPER_H */
 
diff --git a/src/video_output/display.c b/src/video_output/display.c
index 906bca0..4fb1c69 100644
--- a/src/video_output/display.c
+++ b/src/video_output/display.c
@@ -197,6 +197,13 @@ void vout_display_GetDefaultDisplaySize(unsigned *width, unsigned *height,
 
     *width  = *width  * cfg->zoom.num / cfg->zoom.den;
     *height = *height * cfg->zoom.num / cfg->zoom.den;
+
+    if (ORIENT_IS_SWAP(source->orientation)) {
+
+        unsigned store = *width;
+        *width = *height;
+        *height = store;
+    }
 }
 
 /* */
@@ -1222,6 +1229,16 @@ struct vlc_gl_t *vout_GetDisplayOpengl(vout_display_t *vd)
     return gl;
 }
 
+bool vout_CanDisplayHandleOrientation(vout_display_t *vd)
+{
+    bool result;
+
+    if (vout_display_Control(vd, VOUT_DISPLAY_CAN_HANDLE_ORIENTATION, &result))
+        return false;
+    return result;
+}
+
+
 static vout_display_t *DisplayNew(vout_thread_t *vout,
                                   const video_format_t *source,
                                   const vout_display_state_t *state,
-- 
1.8.3.4 (Apple Git-47)





More information about the vlc-devel mailing list