[vlc-devel] [PATCH 11/11] make xcb_x11 and xcb_glx vout modules handle rotated movies.

Matthias Keiser matthias at tristan-inc.com
Thu Mar 6 01:12:32 CET 2014


---
 modules/video_output/xcb/events.c |  7 +------
 modules/video_output/xcb/x11.c    | 14 ++++++++++----
 2 files changed, 11 insertions(+), 10 deletions(-)

diff --git a/modules/video_output/xcb/events.c b/modules/video_output/xcb/events.c
index efb3adb..d3ad55c 100644
--- a/modules/video_output/xcb/events.c
+++ b/modules/video_output/xcb/events.c
@@ -232,12 +232,7 @@ static void HandleMotionNotify (vout_display_t *vd, xcb_connection_t *conn,
     if (place.width <= 0 || place.height <= 0)
         return;
 
-    const int x = vd->source.i_x_offset +
-        (int64_t)(ev->event_x - place.x) * vd->source.i_visible_width / place.width;
-    const int y = vd->source.i_y_offset +
-        (int64_t)(ev->event_y - place.y) * vd->source.i_visible_height/ place.height;
-
-    vout_display_SendEventMouseMoved (vd, x, y);
+    vout_display_SendMouseMovedDisplayCoordinates(vd, ORIENT_NORMAL, ev->event_x, ev->event_y, &place);
 }
 
 static void HandleVisibilityNotify (vout_display_t *vd, bool *visible,
diff --git a/modules/video_output/xcb/x11.c b/modules/video_output/xcb/x11.c
index b2e782e..6b01bed 100644
--- a/modules/video_output/xcb/x11.c
+++ b/modules/video_output/xcb/x11.c
@@ -112,6 +112,9 @@ static int Open (vlc_object_t *obj)
     vd->sys = sys;
     sys->pool = NULL;
 
+    video_format_t fmt = vd->fmt;
+    video_format_ApplyRotation(&fmt, &vd->fmt);
+
     /* Get window, connect to X server */
     xcb_connection_t *conn;
     const xcb_screen_t *scr;
@@ -533,13 +536,16 @@ static int Control (vout_display_t *vd, int query, va_list ap)
         vout_display_place_t place;
         vout_display_PlacePicture (&place, &vd->source, vd->cfg, false);
 
-        vd->fmt.i_width  = vd->source.i_width  * place.width  / vd->source.i_visible_width;
-        vd->fmt.i_height = vd->source.i_height * place.height / vd->source.i_visible_height;
+        video_format_t source_rot;
+        video_format_ApplyRotation(&vd->source, &source_rot);
+
+        vd->fmt.i_width  = source_rot.i_width  * place.width  / source_rot.i_visible_width;
+        vd->fmt.i_height = source_rot.i_height * place.height / source_rot.i_visible_height;
 
         vd->fmt.i_visible_width  = place.width;
         vd->fmt.i_visible_height = place.height;
-        vd->fmt.i_x_offset = vd->source.i_x_offset * place.width  / vd->source.i_visible_width;
-        vd->fmt.i_y_offset = vd->source.i_y_offset * place.height / vd->source.i_visible_height;
+        vd->fmt.i_x_offset = source_rot.i_x_offset * place.width  / source_rot.i_visible_width;
+        vd->fmt.i_y_offset = source_rot.i_y_offset * place.height / source_rot.i_visible_height;
         return VLC_SUCCESS;
     }
 
-- 
1.8.3.4 (Apple Git-47)




More information about the vlc-devel mailing list