mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-04-13 03:24:14 +00:00
sys/xvimage/xvimagesink.c: Handle navigation events correcly with borders if applicable.
Original commit message from CVS: 2005-11-22 Julien MOUTTE <julien@moutte.net> * sys/xvimage/xvimagesink.c: (gst_xvimagesink_navigation_send_event): Handle navigation events correcly with borders if applicable.
This commit is contained in:
parent
629092a79a
commit
24cc7d9c1a
2 changed files with 36 additions and 5 deletions
|
@ -1,3 +1,9 @@
|
|||
2005-11-22 Julien MOUTTE <julien@moutte.net>
|
||||
|
||||
* sys/xvimage/xvimagesink.c:
|
||||
(gst_xvimagesink_navigation_send_event): Handle navigation
|
||||
events correcly with borders if applicable.
|
||||
|
||||
2005-11-22 Tim-Philipp Müller <tim at centricular dot net>
|
||||
|
||||
* gst/ffmpegcolorspace/gstffmpegcodecmap.c:
|
||||
|
|
|
@ -1751,22 +1751,47 @@ gst_xvimagesink_navigation_send_event (GstNavigation * navigation,
|
|||
|
||||
if ((peer = gst_pad_get_peer (GST_VIDEO_SINK_PAD (xvimagesink)))) {
|
||||
GstEvent *event;
|
||||
GstVideoRectangle src, dst, result;
|
||||
gdouble x, y, xscale = 1.0, yscale = 1.0;
|
||||
|
||||
event = gst_event_new_custom (GST_EVENT_NAVIGATION, structure);
|
||||
event = gst_event_new_navigation (structure);
|
||||
|
||||
if (xvimagesink->xwindow) {
|
||||
xscale = GST_VIDEO_SINK_WIDTH (xvimagesink) / xvimagesink->xwindow->width;
|
||||
yscale =
|
||||
GST_VIDEO_SINK_HEIGHT (xvimagesink) / xvimagesink->xwindow->height;
|
||||
/* We take the flow_lock while we look at the window */
|
||||
g_mutex_lock (xvimagesink->flow_lock);
|
||||
|
||||
if (!xvimagesink->xwindow) {
|
||||
g_mutex_unlock (xvimagesink->flow_lock);
|
||||
return;
|
||||
}
|
||||
|
||||
src.w = GST_VIDEO_SINK_WIDTH (xvimagesink);
|
||||
src.h = GST_VIDEO_SINK_HEIGHT (xvimagesink);
|
||||
dst.w = xvimagesink->xwindow->width;
|
||||
dst.h = xvimagesink->xwindow->height;
|
||||
|
||||
g_mutex_unlock (xvimagesink->flow_lock);
|
||||
|
||||
if (xvimagesink->keep_aspect) {
|
||||
gst_video_sink_center_rect (src, dst, &result, TRUE);
|
||||
} else {
|
||||
result.x = result.y = 0;
|
||||
result.w = dst.w;
|
||||
result.h = dst.h;
|
||||
}
|
||||
|
||||
xscale = (gdouble) GST_VIDEO_SINK_WIDTH (xvimagesink) / result.w;
|
||||
yscale = (gdouble) GST_VIDEO_SINK_HEIGHT (xvimagesink) / result.h;
|
||||
|
||||
/* Converting pointer coordinates to the non scaled geometry */
|
||||
if (gst_structure_get_double (structure, "pointer_x", &x)) {
|
||||
x = MIN (x, result.x + result.w);
|
||||
x = MAX (x - result.x, 0);
|
||||
gst_structure_set (structure, "pointer_x", G_TYPE_DOUBLE,
|
||||
(gdouble) x * xscale, NULL);
|
||||
}
|
||||
if (gst_structure_get_double (structure, "pointer_y", &y)) {
|
||||
y = MIN (y, result.y + result.h);
|
||||
y = MAX (y - result.y, 0);
|
||||
gst_structure_set (structure, "pointer_y", G_TYPE_DOUBLE,
|
||||
(gdouble) y * yscale, NULL);
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue