We are using the NXP Yocto hardknott BSP on a custom IMX8MP board for video processing within a qt5 application.
We are trying to output a GStreamer video into a QWidget using the GStreamwer waylandsink GStreamer module.
In general we have this working setting the QWidget with the Qt::WA_NativeWindow, Qt::WA_DontCreateNativeAncestors and Qt::WA_TransparentForMouseEvents attributes and passing the QWidgets' Wayland surface to the waylandsink module with (rough code bits there is more):
struct wl_surface* surface = static_cast<struct wl_surface*>(native->nativeResourceForWindow("surface", owVideo1->windowHandle()));
gst_video_overlay_set_window_handle(GST_VIDEO_OVERLAY(ogstVideoSink), (guintptr)surface);
However, we need the video QWidgets window to be within a QStackedWidget so that separate "pages" of information, settings and the video can be shown. Unfortunately it appears that the QStackedWidget effectively uses setVisible(0) in the QWidget tree when hiding the widget and if you then subsequently show the video "page" the gstreamer video output is no longer shown probably as Qt has deleted the underlying Wayland surface or something like that.
I have tried using a QStackedLayout with mode QStackedLayout::StackAll, and this works sort of (uses raise()/lower()), however the video window remains above others even with the lower(). A move of the QWidget (move(4096, 0)) does make it disappear so this can work just. But this messes up the QT keyboard tabbing in all of the other widgets in the QStackedLayout.
We have also tried parenting the QWidget used for video from a higher level widget so the QStackedLayout can work properly with tabbing and then move the QWidget over the stacked area when the video page is shown. This works but then messes up operation with QScrolledAreas within the stacked widgets for some reason.
Any ideas on how we can properly output gstreamer to a QWidget in a Wayland/Weston environment in a QWidget that can be shown/hidden by some means (With X11 it works fine) ?
Is there a way to stop Qt using the hide()/show() on a particular QWidget within a QStackedLayout ?
Is there a way to get GStreamers waylandsink to use a, I presume, new surface when a new one is created when the QStackedLayout shows the QWidget ?
Any ideas ?
Terry
Thanks for the reply.
Yes, Weston is simple and simple is good
I am guessing you mean that we should use the Gnome compositor rather than Weston rather than the whole of Ubuntu ?
From my current experimentation it seems like the problem is due to a mixture of the gstreamer waylandsink, Qt5 and the compositor in use. I have tried the KDE compositor as well as Weston and they do behave differently, but neither fix this problem. It is looking like Qt is setting the QWidget's Wayland surface as "inactive" and the waylandsink's subsurface of this is kept hidden even when written to. This Wayland concept is a complex mess from what I can see, oh for X11!
Yes, that's my original meaning.Have you serach such issue in QT community?
Hi
The wayland using by weston is simple, you can use Ubuntu Desktop BSP:
https://www.nxp.com/webapp/Download?colCode=i.MX_Desktop_POC_GA_Docs