diff options
author | Tim Blechmann <tim@klingt.org> | 2024-03-20 11:18:42 +0800 |
---|---|---|
committer | Qt Cherry-pick Bot <cherrypick_bot@qt-project.org> | 2024-03-20 15:19:50 +0000 |
commit | e598ecab5473d74ee875b80ec6624018f8c2d429 (patch) | |
tree | 2ed969d13b972da96ac03e9655f0b2a00f6a999c | |
parent | a23fb78b7487103f425ba6cdf8ed5d3b941001fc (diff) |
tests: add manual test for GStreamer's RTP stream receiver
Task-number: QTBUG-112999
Pick-to: 6.5
Change-Id: I588ad68fdcf53fa3d6f1475b5128e7aa0ef8ed19
Reviewed-by: Artem Dyomin <artem.dyomin@qt.io>
(cherry picked from commit 3ffe29e4603841acf36a66ab5d989470938e0d12)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
(cherry picked from commit 644e012377f69bf0b00198987fd0c7eefe7a1ac0)
-rw-r--r-- | tests/manual/CMakeLists.txt | 4 | ||||
-rw-r--r-- | tests/manual/qml-gstreamer-rtp/CMakeLists.txt | 42 | ||||
-rw-r--r-- | tests/manual/qml-gstreamer-rtp/Info.plist.in | 46 | ||||
-rw-r--r-- | tests/manual/qml-gstreamer-rtp/qml-gstreamer-rtp.cpp | 32 | ||||
-rw-r--r-- | tests/manual/qml-gstreamer-rtp/qml-gstreamer-rtp.qml | 29 |
5 files changed, 153 insertions, 0 deletions
diff --git a/tests/manual/CMakeLists.txt b/tests/manual/CMakeLists.txt index 35fcf76d9..257ed0127 100644 --- a/tests/manual/CMakeLists.txt +++ b/tests/manual/CMakeLists.txt @@ -9,4 +9,8 @@ add_subdirectory(wasm) if(TARGET Qt::Quick) add_subdirectory(qml-minimal-camera) add_subdirectory(qml-minimal-player) + + if (QT_FEATURE_gstreamer) + add_subdirectory(qml-gstreamer-rtp) + endif() endif() diff --git a/tests/manual/qml-gstreamer-rtp/CMakeLists.txt b/tests/manual/qml-gstreamer-rtp/CMakeLists.txt new file mode 100644 index 000000000..29ea2a46a --- /dev/null +++ b/tests/manual/qml-gstreamer-rtp/CMakeLists.txt @@ -0,0 +1,42 @@ +# Copyright (C) 2024 The Qt Company Ltd. +# SPDX-License-Identifier: BSD-3-Clause + +cmake_minimum_required(VERSION 3.16) +project(sidepanel LANGUAGES CXX) + +set(CMAKE_AUTOMOC ON) + +if(NOT DEFINED INSTALL_EXAMPLESDIR) + set(INSTALL_EXAMPLESDIR "examples") +endif() + +set(INSTALL_EXAMPLEDIR "${INSTALL_EXAMPLESDIR}/multimedia/qml-gstreamer-rtp") + +find_package(Qt6 REQUIRED COMPONENTS Core Gui Multimedia Qml Quick) + +qt_add_executable( qml-gstreamer-rtp WIN32 MACOSX_BUNDLE + qml-gstreamer-rtp.cpp +) + +qt_add_qml_module( qml-gstreamer-rtp + URI QmlMinimalplayer + NO_RESOURCE_TARGET_PATH + QML_FILES + "qml-gstreamer-rtp.qml" +) + +target_link_libraries( qml-gstreamer-rtp PUBLIC + Qt::Core + Qt::Gui + Qt::Quick +) + +install(TARGETS qml-gstreamer-rtp + RUNTIME DESTINATION "${INSTALL_EXAMPLEDIR}" + BUNDLE DESTINATION "${INSTALL_EXAMPLEDIR}" + LIBRARY DESTINATION "${INSTALL_EXAMPLEDIR}" +) + +set_target_properties( qml-gstreamer-rtp PROPERTIES + MACOSX_BUNDLE_INFO_PLIST ${CMAKE_CURRENT_SOURCE_DIR}/Info.plist.in +) diff --git a/tests/manual/qml-gstreamer-rtp/Info.plist.in b/tests/manual/qml-gstreamer-rtp/Info.plist.in new file mode 100644 index 000000000..46a9ecf2d --- /dev/null +++ b/tests/manual/qml-gstreamer-rtp/Info.plist.in @@ -0,0 +1,46 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> +<plist version="1.0"> +<dict> + <key>CFBundleInfoDictionaryVersion</key> + <string>6.0</string> + <key>CFBundlePackageType</key> + <string>APPL</string> + + <key>CFBundleName</key> + <string>${MACOSX_BUNDLE_BUNDLE_NAME}</string> + <key>CFBundleIdentifier</key> + <string>${MACOSX_BUNDLE_GUI_IDENTIFIER}</string> + <key>CFBundleExecutable</key> + <string>${MACOSX_BUNDLE_EXECUTABLE_NAME}</string> + + <key>CFBundleVersion</key> + <string>${MACOSX_BUNDLE_BUNDLE_VERSION}</string> + <key>CFBundleShortVersionString</key> + <string>${MACOSX_BUNDLE_SHORT_VERSION_STRING}</string> + <key>CFBundleLongVersionString</key> + <string>${MACOSX_BUNDLE_LONG_VERSION_STRING}</string> + + <key>LSMinimumSystemVersion</key> + <string>${CMAKE_OSX_DEPLOYMENT_TARGET}</string> + + <key>CFBundleGetInfoString</key> + <string>${MACOSX_BUNDLE_INFO_STRING}</string> + <key>NSHumanReadableCopyright</key> + <string>${MACOSX_BUNDLE_COPYRIGHT}</string> + + <key>CFBundleIconFile</key> + <string>${MACOSX_BUNDLE_ICON_FILE}</string> + + <key>CFBundleDevelopmentRegion</key> + <string>English</string> + + <key>NSCameraUsageDescription</key> + <string>Qt Multimedia Example</string> + <key>NSMicrophoneUsageDescription</key> + <string>Qt Multimedia Example</string> + + <key>NSSupportsAutomaticGraphicsSwitching</key> + <true/> +</dict> +</plist> diff --git a/tests/manual/qml-gstreamer-rtp/qml-gstreamer-rtp.cpp b/tests/manual/qml-gstreamer-rtp/qml-gstreamer-rtp.cpp new file mode 100644 index 000000000..133603bf6 --- /dev/null +++ b/tests/manual/qml-gstreamer-rtp/qml-gstreamer-rtp.cpp @@ -0,0 +1,32 @@ +// Copyright (C) 2024 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause + +#include <QGuiApplication> +#include <QProcess> +#include <QQmlApplicationEngine> +#include <QtEnvironmentVariables> + +int main(int argc, char *argv[]) +{ + qputenv("QT_MEDIA_BACKEND", "gstreamer"); + + QProcess process; + process.startCommand( + "gst-launch-1.0 videotestsrc ! x264enc ! udpsink host=127.0.0.1 port=50004"); + + auto scopeGuard = qScopeGuard([&] { + process.terminate(); + process.waitForFinished(); + }); + + QGuiApplication app(argc, argv); + QQmlApplicationEngine engine; + + process.waitForStarted(); + + engine.load(QUrl("qrc:/qml-gstreamer-rtp.qml")); + if (engine.rootObjects().isEmpty()) + return -1; + + return app.exec(); +} diff --git a/tests/manual/qml-gstreamer-rtp/qml-gstreamer-rtp.qml b/tests/manual/qml-gstreamer-rtp/qml-gstreamer-rtp.qml new file mode 100644 index 000000000..e70367842 --- /dev/null +++ b/tests/manual/qml-gstreamer-rtp/qml-gstreamer-rtp.qml @@ -0,0 +1,29 @@ +// Copyright (C) 2024 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause +import QtQuick +import QtQuick.Controls +import QtMultimedia + +ApplicationWindow { + id: window + width: 800 + height: 600 + visible: true + title: qsTr("GStreamer RTP receiver") + + MediaPlayer { + id: player + videoOutput: output + + source: "udp://127.0.0.1:50004" + } + + Component.onCompleted: { + player.play() + } + + VideoOutput { + id: output + anchors.fill: parent + } +} |