[vlc-devel] [PATCH 8/9] Make the following vout modules handle rotated movies: macosx, xcb_x11, xcb_glx, sdl.
Matthias Keiser
matthias at tristan-inc.com
Wed Mar 5 17:01:29 CET 2014
---
modules/video_output/macosx.m | 15 ++++-----------
modules/video_output/sdl.c | 10 ++++++----
modules/video_output/xcb/events.c | 7 +------
modules/video_output/xcb/x11.c | 14 ++++++++++----
4 files changed, 21 insertions(+), 25 deletions(-)
diff --git a/modules/video_output/macosx.m b/modules/video_output/macosx.m
index f0ca190..4267310 100644
--- a/modules/video_output/macosx.m
+++ b/modules/video_output/macosx.m
@@ -213,7 +213,6 @@ static int Open (vlc_object_t *this)
sys->gl.getProcAddress = OurGetProcAddress;
sys->gl.sys = sys;
const vlc_fourcc_t *subpicture_chromas;
- video_format_t fmt = vd->fmt;
sys->vgl = vout_display_opengl_New (&vd->fmt, &subpicture_chromas, &sys->gl);
if (!sys->vgl) {
@@ -238,7 +237,7 @@ static int Open (vlc_object_t *this)
vd->control = Control;
/* */
- vout_display_SendEventDisplaySize (vd, vd->source.i_visible_width, vd->source.i_visible_height, false);
+ vout_display_SendEventDisplaySize (vd, vd->fmt.i_visible_width, vd->fmt.i_visible_height, false);
return VLC_SUCCESS;
@@ -784,16 +783,10 @@ static void OpenglSwap (vlc_gl_t *gl)
if (b_inside) {
@synchronized (self) {
if (vd) {
- vout_display_place_t place = vd->sys->place;
- if (place.width > 0 && place.height > 0) {
- const int x = vd->source.i_x_offset +
- (int64_t)(ml.x - place.x) * vd->source.i_visible_width / place.width;
- const int y = vd->source.i_y_offset +
- (int64_t)((int)s_rect.size.height - (int)ml.y - place.y) * vd->source.i_visible_height / place.height;
-
- vout_display_SendEventMouseMoved (vd, x, y);
- }
+ vout_display_SendMouseMovedDisplayCoordinates(vd, ORIENT_NORMAL,
+ (int)ml.x, s_rect.size.height - (int)ml.y,
+ &vd->sys->place);
}
}
}
diff --git a/modules/video_output/sdl.c b/modules/video_output/sdl.c
index 5520bb2..a93f201 100644
--- a/modules/video_output/sdl.c
+++ b/modules/video_output/sdl.c
@@ -165,6 +165,8 @@ static int Open(vlc_object_t *object)
/* */
video_format_t fmt = vd->fmt;
+ video_format_ApplyRotation(&fmt, &vd->fmt);
+ fmt = vd->fmt;
/* */
vout_display_info_t info = vd->info;
@@ -638,11 +640,11 @@ static void Manage(vout_display_t *vd)
if (sys->place.width <= 0 || sys->place.height <= 0)
break;
- const int x = (int64_t)(event.motion.x - sys->place.x) * vd->source.i_width / sys->place.width;
- const int y = (int64_t)(event.motion.y - sys->place.y) * vd->source.i_height / sys->place.height;
-
SDL_ShowCursor(1);
- vout_display_SendEventMouseMoved(vd, x, y);
+
+ vout_display_SendMouseMovedDisplayCoordinates(vd, ORIENT_NORMAL,
+ event.motion.x, event.motion.y,
+ &sys->place);
break;
}
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