New Qt6 QML (OpenGL) elements

Recently, I was tasked with porting some of the existing Qt5-based QML GStreamer elements for use with Qt6. Throughout this process, the only major architectural change in Qt that affected these GStreamer elements was the Qt6 rendering overhaul for supporting multiple graphics APIs (OpenGL, Vulkan, Direct3D, Metal, etc). The process overall was relatively painless however still required understanding the new Qt6 rendering model. The result is a set of elements that mirror functionality of the existing Qt5 GStreamer elements (`qmlglsink`, `qmlglsrc`, `qmlgloverlay`). The new elements are named `qml6glsink`, `qml6glsrc`, and `qml6gloverlay`. There is also a new element called `qml6glmixer`.

qml6glsink

The Qt6 variant of qmlglsink operates the exact same as its Qt5 counterpart. There is a QML Item that needs to be retrieved from the QML scene and a GStreamer sink component that needs the QML item set as a property. Once that is achieved, the video stream is viewable in the QML scene just like the Qt5 counterpart. You can a Qt6 example of this in this qmlsink example.

qml6glsrc

The qt6 variant of qmlglsrc operates the same as its Qt5 counterpart. The required interface in this case is a `QQuickWindow *`. When QML draws to this QQuickWindow, with some careful overriding of some Qt6 signals, the output is rendered to a GStreamer controlled texture that is then pushed downstream to the next OpenGL element. An example of this can be found in this qmlsrc example.

qml6gloverlay

The Qt6 variant of qmlgloverlay operates the exact same as its Qt5 counterpart. With the qml6gloverlay GStreamer element, a QML scene is drawn including the incoming video stream. The resulting texture is then pushed downstream for further processing. The connection between the QML scene and the GStreamer input frames is also provided by a special QML item like in the qml6glsink case. An example of this can be found in this qmloverlay example.

qml6glmixer - New Element

The qml6glmixer element does not have a Qt5 counterpart. It functions much like the qml6gloverlay element, however it can source images from multiple input video streams. The application is required to connect the relevant QML item to the correct input GStreamer pad on the qml6glmixer element. The input videos can then be controlled from the QML scene in many different ways (e.g. position, fades, shaders, etc). A simple example of qml6glmixer can be found in this qmlmixer example.

I hope these elements are useful for you and I can't wait to see what you make with them.

Comments

Popular posts from this blog

GStreamer RTP Session Handling in Rust

GStreamer 1.6 and OpenGL contexts

qmlglsink - GStreamer and Qt's QML