xvimagesink: refactor to use gst_pad_push_event

Right now navigation events are being sent via gst_pad_send_event
after getting the peer pad of the sinkpad.
But the same functionality can be done using gst_pad_push_event
without need of getting peer pad in xvimagesink.

https://bugzilla.gnome.org/show_bug.cgi?id=752059
This commit is contained in:
Vineeth T M 2015-07-07 19:55:44 +09:00 committed by Luis de Bethencourt
parent a1f8fb32cb
commit efdb0fc281

View file

@ -1112,11 +1112,9 @@ gst_xv_image_sink_navigation_send_event (GstNavigation * navigation,
GstStructure * structure) GstStructure * structure)
{ {
GstXvImageSink *xvimagesink = GST_XV_IMAGE_SINK (navigation); GstXvImageSink *xvimagesink = GST_XV_IMAGE_SINK (navigation);
GstPad *peer;
gboolean handled = FALSE; gboolean handled = FALSE;
GstEvent *event = NULL; GstEvent *event = NULL;
if ((peer = gst_pad_get_peer (GST_VIDEO_SINK_PAD (xvimagesink)))) {
GstVideoRectangle src = { 0, }; GstVideoRectangle src = { 0, };
GstVideoRectangle dst = { 0, }; GstVideoRectangle dst = { 0, };
GstVideoRectangle result; GstVideoRectangle result;
@ -1128,7 +1126,6 @@ gst_xv_image_sink_navigation_send_event (GstNavigation * navigation,
if (!(xwindow = xvimagesink->xwindow)) { if (!(xwindow = xvimagesink->xwindow)) {
g_mutex_unlock (&xvimagesink->flow_lock); g_mutex_unlock (&xvimagesink->flow_lock);
gst_object_unref (peer);
return; return;
} }
@ -1169,18 +1166,16 @@ gst_xv_image_sink_navigation_send_event (GstNavigation * navigation,
} }
event = gst_event_new_navigation (structure); event = gst_event_new_navigation (structure);
if (event) {
gst_event_ref (event); gst_event_ref (event);
handled = gst_pad_send_event (peer, event); handled = gst_pad_push_event (GST_VIDEO_SINK_PAD (xvimagesink), event);
gst_object_unref (peer);
}
if (!handled && event) { if (!handled)
gst_element_post_message ((GstElement *) xvimagesink, gst_element_post_message ((GstElement *) xvimagesink,
gst_navigation_message_new_event ((GstObject *) xvimagesink, event)); gst_navigation_message_new_event ((GstObject *) xvimagesink, event));
}
if (event)
gst_event_unref (event); gst_event_unref (event);
}
} }
static void static void