gst-plugins-base: (examples) qt-videooverlay not functional
Adding it here as a bug for follow up while we look for a solution (discussed on IRC with @tpm
gst-plugins-base has a number of examples to illustrate the integration of GStreamer within different frameworks (e.g. Qt en Gtk).
When changing the application qt-videooverlay.cpp to use the following pipeline:
rfbsrc uri=rfb://:testme@10.40.216/126 ! videoconvert ! autovideosink
instead of
videotestsrc ! autovideosink
This should allow to connect to a VNC server and use it with keyboard/mouse interaction.
However, only the keyboard events are traveling upstream to the VNC server (tightvncserver).
Much to my surprise, the gtk-videooverlay.c application did work. However, I noticed that the rendered window was not the GTK window, but a different window.
This lead me to the fact that the GTK code did not return the window handle (embed_xid = GDK_WINDOW_XID (video_window_xwindow);
) and '0' was passed to gst_video_overlay_set_window_handle (GST_VIDEO_OVERLAY (sink), embed_xid);
.
This resulted in the different window.
In the QT application; a correct handle was passed.
The difference is that in
./subprojects/gst-plugins-base/sys/xvimage/xvimagesink.c
, an internal window is generated instead using the existing one.
Finally, I traced down the rabbit hole and changed the following in ./subprojects/gst-plugins-base/sys/xvimage/xvcontext.c
diff --git a/subprojects/gst-plugins-base/sys/xvimage/xvcontext.c b/subprojects/gst-plugins-base/sys/xvimage/xvcontext.c
index a67194c21c..61413eb573 100644
--- a/subprojects/gst-plugins-base/sys/xvimage/xvcontext.c
+++ b/subprojects/gst-plugins-base/sys/xvimage/xvcontext.c
@@ -1057,7 +1057,10 @@ gst_xvcontext_create_xwindow_from_xid (GstXvContext * context, XID xid)
window = g_slice_new0 (GstXWindow);
- window->win = xid;
+ /*window->win = xid;*/
+ window->win = XCreateSimpleWindow (context->disp,
+ context->root, 0, 0, 360, 260, 0, 0, context->black);
+
window->context = gst_xvcontext_ref (context);
/* Set the event we want to receive and create a GC */
This resulted in getting the mouse move events passed upstream (so create a new X window instead of using the window passed to us). Since the changes are only X related; I don't think that this is really a GStreamer issue (tm); but it might be helpful to trace the issue in order to fix the example code.