gstreamer/tests/examples/qt/qmloverlay/overlay2.qml
Matthew Waters 7a25fb5b08 qt: add a qml overlay filter element [part 2]
It takes a qml scene description and renders it using a possible input
stream.

Currently supported on GLX and WGL.

Follow up to (as that MR had an old version of the commit):
- https://gitlab.freedesktop.org/gstreamer/gst-plugins-good/-/merge_requests/475
- 4778d7166a: qt: add a qml overlay filter element
2020-03-19 17:26:54 +11:00

57 lines
1.3 KiB
QML

import QtQuick 2.4
import org.freedesktop.gstreamer.GLVideoItem 1.0
Item {
/* render upside down for GStreamer */
transform: Scale { origin.x : 0; origin.y : height / 2.; yScale : -1 }
GstGLVideoItem {
id: video
objectName: "inputVideoItem"
anchors.centerIn: parent
width: parent.width
height: parent.height
}
Text {
id: rotatingText
anchors.centerIn: parent
text: "Qt Quick\nrendered to\na texture"
font.pointSize: 20
color: "black"
style: Text.Outline
styleColor: "white"
RotationAnimator {
target: rotatingText;
from: 0;
to: 360;
duration: 10000
running: true
loops: Animation.Infinite
}
}
Text {
property int elapsedTime: 0
id: time
anchors.bottom: rotatingText.top
anchors.horizontalCenter: rotatingText.horizontalCenter
font.pointSize: 12
style: Text.Outline
styleColor: "red"
color: "black"
Timer {
interval: 1000
running: true
repeat: true
onTriggered: {
parent.elapsedTime += interval / 1000
parent.text = "overlay: " + parent.elapsedTime.toString() + " seconds"
}
}
}
}