glimagesink: Post unhandled navigation events on the bus
authorFlorent Thiéry <florent.thiery@ubicast.eu>
Sat, 26 Dec 2015 21:34:29 +0000 (22:34 +0100)
committerTim-Philipp Müller <tim@centricular.com>
Sat, 9 Dec 2017 19:32:13 +0000 (19:32 +0000)
Based off xvimagesink implementation

https://bugzilla.gnome.org/show_bug.cgi?id=759869

ext/gl/gstglimagesink.c

index dc25e666536b4369fa9d593d8c709e04261638fa..4f7529e3750510a59ccbcba6e5fd1c3f0e267a75 100644 (file)
@@ -409,8 +409,8 @@ gst_glimage_sink_navigation_send_event (GstNavigation * navigation, GstStructure
     * structure)
 {
   GstGLImageSink *sink = GST_GLIMAGE_SINK (navigation);
+  gboolean handled = FALSE;
   GstEvent *event = NULL;
-  GstPad *pad = NULL;
   GstGLWindow *window;
   guint width, height;
   gdouble x, y;
@@ -427,9 +427,6 @@ gst_glimage_sink_navigation_send_event (GstNavigation * navigation, GstStructure
   height = GST_VIDEO_SINK_HEIGHT (sink);
   gst_gl_window_get_surface_dimensions (window, &width, &height);
 
-  event = gst_event_new_navigation (structure);
-
-  pad = gst_pad_get_peer (GST_VIDEO_SINK_PAD (sink));
   /* Converting pointer coordinates to the non scaled geometry */
   if (width != 0 && gst_structure_get_double (structure, "pointer_x", &x)
       && height != 0 && gst_structure_get_double (structure, "pointer_y", &y)) {
@@ -441,10 +438,17 @@ gst_glimage_sink_navigation_send_event (GstNavigation * navigation, GstStructure
         stream_x, "pointer_y", G_TYPE_DOUBLE, stream_y, NULL);
   }
 
-  if (GST_IS_PAD (pad) && GST_IS_EVENT (event))
-    gst_pad_send_event (pad, event);
+  event = gst_event_new_navigation (structure);
+  if (event) {
+    gst_event_ref (event);
+    handled = gst_pad_push_event (GST_VIDEO_SINK_PAD (sink), event);
 
-  gst_object_unref (pad);
+    if (!handled)
+      gst_element_post_message ((GstElement *) sink,
+          gst_navigation_message_new_event ((GstObject *) sink, event));
+
+    gst_event_unref (event);
+  }
   gst_object_unref (window);
 }