mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-01-23 15:48:23 +00:00
36b794f9ff
GstGLVideoItem is required to render input video in the overlay's qml. And currently qmlgloverlay requires to set this GstGLVideoItem to its widget property. Instead of fetching GstGLVideoItem from the overlay's root object (root-item prop), and setting it back as a widget (widget prop), proposing to use found GstGLVideoItem in the current object hierarchy (passed in qml-scene) by default. Also useful in Python, which solves the issue when casting gpointer <=> QQuickItem* is required. Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-good/-/merge_requests/919>
28 lines
717 B
Python
28 lines
717 B
Python
#!/usr/bin/env python
|
|
|
|
import signal
|
|
signal.signal(signal.SIGINT, signal.SIG_DFL)
|
|
|
|
import sys
|
|
import gi
|
|
gi.require_version('Gst', '1.0')
|
|
|
|
from gi.repository import Gst, GLib
|
|
from PySide2.QtGui import QGuiApplication
|
|
from PySide2.QtQuick import QQuickItem
|
|
|
|
def main(args):
|
|
app = QGuiApplication(args)
|
|
Gst.init(args)
|
|
|
|
pipeline = Gst.parse_launch("""videotestsrc ! glupload ! qmlgloverlay name=o ! gldownload ! videoconvert ! autovideosink""")
|
|
o = pipeline.get_by_name('o')
|
|
f = open('overlay.qml', 'r')
|
|
o.set_property('qml-scene', f.read())
|
|
|
|
pipeline.set_state(Gst.State.PLAYING)
|
|
app.exec_()
|
|
pipeline.set_state(Gst.State.NULL)
|
|
|
|
if __name__ == '__main__':
|
|
sys.exit(main(sys.argv))
|