sys/xvimage/xvimagesink.c: Check whether peer pad exists before sending navigation events to it.

Original commit message from CVS:
* sys/xvimage/xvimagesink.c:
(gst_xvimagesink_navigation_send_event):
Check whether peer pad exists before sending navigation events
to it.
This commit is contained in:
Tim-Philipp Müller 2005-11-11 17:41:04 +00:00
parent 0928b25a19
commit e6ef73471b
2 changed files with 31 additions and 16 deletions

View file

@ -1,3 +1,10 @@
2005-11-11 Tim-Philipp Müller <tim at centricular dot net>
* sys/xvimage/xvimagesink.c:
(gst_xvimagesink_navigation_send_event):
Check whether peer pad exists before sending navigation events
to it.
2005-11-11 Michael Smith <msmith@fluendo.com>
* ext/vorbis/vorbisenc.c: (gst_vorbisenc_setup),

View file

@ -1710,25 +1710,33 @@ gst_xvimagesink_navigation_send_event (GstNavigation * navigation,
GstStructure * structure)
{
GstXvImageSink *xvimagesink = GST_XVIMAGESINK (navigation);
GstEvent *event;
double x, y;
GstPad *peer;
event = gst_event_new_custom (GST_EVENT_NAVIGATION, structure);
if ((peer = gst_pad_get_peer (GST_VIDEO_SINK_PAD (xvimagesink)))) {
GstEvent *event;
gdouble x, y, xscale = 1.0, yscale = 1.0;
/* Converting pointer coordinates to the non scaled geometry */
if (gst_structure_get_double (structure, "pointer_x", &x)) {
x *= GST_VIDEO_SINK_WIDTH (xvimagesink);
x /= xvimagesink->xwindow->width;
gst_structure_set (structure, "pointer_x", G_TYPE_DOUBLE, x, NULL);
event = gst_event_new_custom (GST_EVENT_NAVIGATION, structure);
if (xvimagesink->xwindow) {
xscale = GST_VIDEO_SINK_WIDTH (xvimagesink) / xvimagesink->xwindow->width;
yscale =
GST_VIDEO_SINK_HEIGHT (xvimagesink) / xvimagesink->xwindow->height;
}
/* Converting pointer coordinates to the non scaled geometry */
if (gst_structure_get_double (structure, "pointer_x", &x)) {
gst_structure_set (structure, "pointer_x", G_TYPE_DOUBLE,
(gdouble) x * xscale, NULL);
}
if (gst_structure_get_double (structure, "pointer_y", &y)) {
gst_structure_set (structure, "pointer_y", G_TYPE_DOUBLE,
(gdouble) y * yscale, NULL);
}
gst_pad_send_event (peer, event);
gst_object_unref (peer);
}
if (gst_structure_get_double (structure, "pointer_y", &y)) {
y *= GST_VIDEO_SINK_HEIGHT (xvimagesink);
y /= xvimagesink->xwindow->height;
gst_structure_set (structure, "pointer_y", G_TYPE_DOUBLE, y, NULL);
}
gst_pad_send_event (gst_pad_get_peer (GST_VIDEO_SINK_PAD (xvimagesink)),
event);
}
static void