Waylandsink with Qt QWidget

Terry Barnaby terry1 at beam.ltd.uk
Tue Nov 29 08:10:32 UTC 2022


On 28/11/2022 16:45, Nicolas Dufresne wrote:
> Le lundi 28 novembre 2022 à 07:14 +0000, Terry Barnaby via gstreamer-devel a
> écrit :
>> I am trying to output a video stream into a Qt QWidget using the waylandsink
>> plugin. This is with gstreamer 1.20 and QT 5.15.2.
>> In general this is working, but if the QWidget gets hidden as the result of
>> being in something like a QStackedWindow and then raised the video is no
>> longer shown.
>> I am using the Weston compositor on an embedded platform, but I have also
>> tried the KDE compositor under Fedora35 with the same effect.
>> It may be related to the issue I saw in
>> https://bugs.kde.org/show_bug.cgi?id=445631 where waylandsink's subsurface is
>> not drawn as its parent (QWidget) surface remains in a "hidden" state.
>> I'm not sure which of the Qt, waylandsink, Wayland compositor is really at
>> fault here, but I assume that either waylandsink, which has access to all of
>> the surfaces and subsurfaces, could "wake up" the QWidget's surface when it
>> wants to draw or perhaps better the QWidget should somehow "wakeup" it's
>> surface when it is raised.
>> Any ideas ?
> I've met that issue before. I needed to place my waylandsink behind my main
> surface, but waylandsink does not yet have surface ordering support. So to avoid
> having to hack the GStreamer, I create an extra subsurface, similar to your
> videoWidget subsurface. But in order to make it mapped, I created 1x1 buffer and
> attached it. Except on Weston, I would show/hide my video by detaching/attaching
> that 1x1 buffer. I believe this Weston bug has been fixed now.
>
> So my recommendation would be to map some content to your videoWidget
> subsurface.
>
> Nicolas

Thanks for the reply and info. Looking at my case in more detail, with 
Qt5.15.2 at least, when the QStackedWindow hides my video display 
QWidget the QWidget has its Wayland surface destroyed, which messes up 
things for waylandsink (although no errors that its parent surface no 
longer exists ?).

If I parent my QWidget from a widget above QStackedWindow and move its 
position over where i want it then at least this doesn't happen but then 
I get the issue you have overcome. I have tried a move(4096, 0) on this 
QWidget and it did remove it from display at least with the Weston 
compositor. But then that messes up QScroilledArea's in my 
QStackedWindow stack for some reason.

I will have a go at creating a subsurface layer below my video QWidget 
as you suggest and try lowering/raising that at the Wayland level. 
However it seems very difficult to do this with Qt as it hides the 
Wayland handles away to well.

My experience with Wayland so far has been hell!

Terry



More information about the gstreamer-devel mailing list