[vlc-devel] [PATCH 04/11] Display: Support rotated movies.

Matthias Keiser matthias at tristan-inc.com
Thu Mar 13 14:25:30 CET 2014



> Le jeudi 6 mars 2014, 22:26:31 Matthias Keiser a écrit :
>> Am 06.03.2014 um 21:35 schrieb Rémi Denis-Courmont <remi at remlab.net>:
>>> Is this (and all other) for the sake of the principle, because I think it
>>> is a no-op. Now that the logic was moved to chain, are you sure you need
>>> all this snippet?
>> 
>> I left it in because I thought it fixes a memory leak, but I should have
>> cleaned it up a bit, sorry (and make a separate patch).
> 
> If there is a leak, the fix should be a separate patch.

Reverted function VoutDisplayCreateRender to master.

---
 src/video_output/display.c | 67 ++++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 67 insertions(+)

diff --git a/src/video_output/display.c b/src/video_output/display.c
index 906bca0..af1cf61 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;
+    }
 }
 
 /* */
@@ -214,6 +221,10 @@ void vout_display_PlacePicture(vout_display_place_t *place,
     unsigned display_width;
     unsigned display_height;
 
+    video_format_t source_rot;
+    video_format_ApplyRotation(source, &source_rot);
+    source = &source_rot;
+
     if (cfg->is_display_filled) {
         display_width  = cfg->display.width;
         display_height = cfg->display.height;
@@ -273,6 +284,62 @@ void vout_display_PlacePicture(vout_display_place_t *place,
     }
 }
 
+void vout_display_SendMouseMovedDisplayCoordinates(vout_display_t *vd, video_orientation_t orient_display, int m_x, int m_y, v
+{
+    video_format_t source_rot = vd->source;
+    video_format_TransformTo(&source_rot, orient_display);
+
+    if (place->width > 0 && place->height > 0) {
+
+        int x = (int)(source_rot.i_x_offset +
+                            (int64_t)(m_x - place->x) * source_rot.i_visible_width / place->width);
+        int y = (int)(source_rot.i_y_offset +
+                            (int64_t)(m_y - place->y) * source_rot.i_visible_height/ place->height);
+
+        video_transform_t transform = video_format_GetTransform(vd->source.orientation, orient_display);
+
+        int store;
+
+        switch (transform) {
+
+            case TRANSFORM_R90:
+                store = x;
+                x = y;
+                y = vd->source.i_visible_height - store;
+                break;
+            case TRANSFORM_R180:
+                x = vd->source.i_visible_width - x;
+                y = vd->source.i_visible_height - y;
+                break;
+            case TRANSFORM_R270:
+                store = x;
+                x = vd->source.i_visible_width - y;
+                y = store;
+                break;
+            case TRANSFORM_HFLIP:
+                x = vd->source.i_visible_width - x;
+                break;
+            case TRANSFORM_VFLIP:
+                y = vd->source.i_visible_height - y;
+                break;
+            case TRANSFORM_TRANSPOSE:
+                store = x;
+                x = y;
+                y = store;
+                break;
+            case TRANSFORM_ANTI_TRANSPOSE:
+                store = x;
+                x = vd->source.i_visible_width - y;
+                y = vd->source.i_visible_height - store;
+                break;
+            default:
+                break;
+        }
+
+        vout_display_SendEventMouseMoved (vd, x, y);
+    }
+}
+
 struct vout_display_owner_sys_t {
     vout_thread_t   *vout;
     bool            is_wrapper;  /* Is the current display a wrapper */
-- 
1.8.3.4 (Apple Git-47)





More information about the vlc-devel mailing list