diff options
author | Mathias Hasselmann <mathias.hasselmann@kdab.com> | 2013-11-06 18:29:37 +0100 |
---|---|---|
committer | Mathias Hasselmann <mathias.hasselmann@kdab.com> | 2013-11-06 18:29:37 +0100 |
commit | 6f8033b52e59cfcf1d76d70875eb7495cfeccb49 (patch) | |
tree | 69b386692f4c4a1cdd06ef84db68512d7e4a792d | |
parent | cc2a440ea05fbdd2dff76c4e52f24e959c0b8dd9 (diff) | |
download | qtquickstreamer-6f8033b52e59cfcf1d76d70875eb7495cfeccb49.tar.gz qtquickstreamer-6f8033b52e59cfcf1d76d70875eb7495cfeccb49.tar.xz |
Register GstState as GstElement::State
-rw-r--r-- | src/QuickStreamer/item.cpp | 14 | ||||
-rw-r--r-- | src/examples/piano/qml/Piano.qml | 6 |
2 files changed, 15 insertions, 5 deletions
diff --git a/src/QuickStreamer/item.cpp b/src/QuickStreamer/item.cpp index 90d06bb..0425fda 100644 --- a/src/QuickStreamer/item.cpp +++ b/src/QuickStreamer/item.cpp @@ -330,7 +330,7 @@ static void writeState(Item *item, const void *value) { const auto success = gst_element_set_state(GST_ELEMENT(item->target()), *static_cast<const GstState *>(value)); - qDebug("setState: %d", success); + qDebug("setState(%d) -> %d", *static_cast<const GstState *>(value), success); } template<typename... Args> @@ -390,12 +390,22 @@ struct TypeInfo objectBuilder.addClassInfo(QByteArrayLiteral("DefaultProperty"), property.name()); } + if (type == GST_TYPE_ELEMENT) { + auto stateEnum = objectBuilder.addEnumerator(QByteArrayLiteral("State")); + stateEnum.addKey(QByteArrayLiteral("Pending"), static_cast<int>(GST_STATE_VOID_PENDING)); + stateEnum.addKey(QByteArrayLiteral("Null"), static_cast<int>(GST_STATE_NULL)); + stateEnum.addKey(QByteArrayLiteral("Ready"), static_cast<int>(GST_STATE_READY)); + stateEnum.addKey(QByteArrayLiteral("Paused"), static_cast<int>(GST_STATE_PAUSED)); + stateEnum.addKey(QByteArrayLiteral("Playing"), static_cast<int>(GST_STATE_PLAYING)); + } + if (g_type_is_a(type, GST_TYPE_ELEMENT)) { // FIXME: also add pendingState property? auto notifier = objectBuilder.addSignal(QByteArrayLiteral("stateChanged()")); auto property = objectBuilder.addProperty(QByteArrayLiteral("state"), - QByteArrayLiteral("int"), // FIXME + //QByteArrayLiteral("int"), // FIXME + QByteArrayLiteral("GstElement::State"), // FIXME notifier.index()); property.setReadable(true); diff --git a/src/examples/piano/qml/Piano.qml b/src/examples/piano/qml/Piano.qml index d0a8711..ce73862 100644 --- a/src/examples/piano/qml/Piano.qml +++ b/src/examples/piano/qml/Piano.qml @@ -35,7 +35,7 @@ Rectangle { onPressedChanged: { audioSource.freq = frequency audioSource.volume = pressed ? 1 : 0 - pipeline.state = 4 + pipeline.state = Element.Playing } } } @@ -69,7 +69,7 @@ Rectangle { onPressedChanged: { audioSource.freq = frequency audioSource.volume = pressed ? 1 : 0 - pipeline.state = 4 + pipeline.state = Element.Playing } } } @@ -78,7 +78,7 @@ Rectangle { Pipeline { id: pipeline -// state: 4 // FIXME: this should be an enum + // state: Element.Playing // FIXME: this should be set after plugging all elements AudioTestSrc { id: audioSource |