Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion qgroundcontrol.qrc
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,11 @@
<file alias="ESP8266ComponentSummary.qml">src/AutoPilotPlugins/Common/ESP8266ComponentSummary.qml</file>
<file alias="ExitWithErrorWindow.qml">src/UI/ExitWithErrorWindow.qml</file>
<file alias="FirmwareUpgrade.qml">src/VehicleSetup/FirmwareUpgrade.qml</file>
<file alias="QGroundControl/FlightDisplay/QGCVideoBackground.qml">src/FlightDisplay/QGCVideoBackground.qml</file>
<file alias="FlightDisplayViewDummy.qml">src/FlightDisplay/FlightDisplayViewDummy.qml</file>
<file alias="FlightDisplayViewUVC.qml">src/FlightDisplay/FlightDisplayViewUVC.qml</file>
<file alias="QGroundControl/FlightDisplay/FlightDisplayViewGStreamer.qml">src/FlightDisplay/FlightDisplayViewGStreamer.qml</file>
<file alias="QGroundControl/FlightDisplay/FlightDisplayViewQtMultimedia.qml">src/FlightDisplay/FlightDisplayViewQtMultimedia.qml</file>
<file alias="FlyViewSettings.qml">src/UI/preferences/FlyViewSettings.qml</file>
<file alias="FWLandingPatternEditor.qml">src/PlanView/FWLandingPatternEditor.qml</file>
<file alias="GeneralSettings.qml">src/UI/preferences/GeneralSettings.qml</file>
Expand Down Expand Up @@ -285,7 +288,6 @@
<file alias="QGroundControl/FlightMap/QGCAttitudeWidget.qml">src/FlightMap/Widgets/QGCAttitudeWidget.qml</file>
<file alias="QGroundControl/FlightMap/QGCCompassWidget.qml">src/FlightMap/Widgets/QGCCompassWidget.qml</file>
<file alias="QGroundControl/FlightMap/QGCPitchIndicator.qml">src/FlightMap/Widgets/QGCPitchIndicator.qml</file>
<file alias="QGroundControl/FlightMap/QGCVideoBackground.qml">src/FlightMap/QGCVideoBackground.qml</file>
<file alias="QGroundControl/FlightMap/qmldir">src/QmlControls/QGroundControl/FlightMap/qmldir</file>
<file alias="QGroundControl/FlightMap/VehicleMapItem.qml">src/FlightMap/MapItems/VehicleMapItem.qml</file>
<file alias="QGroundControl/ScreenTools/qmldir">src/QmlControls/QGroundControl/ScreenTools/qmldir</file>
Expand Down
28 changes: 13 additions & 15 deletions src/API/QGCCorePlugin.cc
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,12 @@
#include "AppMessages.h"
#include "QmlObjectListModel.h"
#include "JoystickManager.h"
#if defined(QGC_GST_STREAMING)
#ifdef QGC_GST_STREAMING
#include "GStreamer.h"
#endif
#include "VideoManager.h"
#ifdef QGC_QT_STREAMING
#include "QtMultimediaReceiver.h"
#endif
#include "VideoReceiver.h"
#include "HorizontalFactValueGrid.h"
#include "InstrumentValueData.h"
Expand Down Expand Up @@ -323,38 +325,34 @@ QmlObjectListModel* QGCCorePlugin::customMapItems()
return &_p->_emptyCustomMapItems;
}

VideoManager* QGCCorePlugin::createVideoManager(QGCApplication *app, QGCToolbox *toolbox)
{
return new VideoManager(app, toolbox);
}

VideoReceiver* QGCCorePlugin::createVideoReceiver(QObject* parent)
{
#if defined(QGC_GST_STREAMING)
#ifdef QGC_GST_STREAMING
return GStreamer::createVideoReceiver(parent);
#elif defined(QGC_QT_STREAMING)
return QtMultimediaReceiver::createVideoReceiver(parent);
#else
Q_UNUSED(parent)
return nullptr;
#endif
}

void* QGCCorePlugin::createVideoSink(QObject* parent, QQuickItem* widget)
{
#if defined(QGC_GST_STREAMING)
#ifdef QGC_GST_STREAMING
return GStreamer::createVideoSink(parent, widget);
#elif defined(QGC_QT_STREAMING)
return QtMultimediaReceiver::createVideoSink(parent, widget);
#else
Q_UNUSED(parent)
Q_UNUSED(widget)
return nullptr;
#endif
}

void QGCCorePlugin::releaseVideoSink(void* sink)
{
#if defined(QGC_GST_STREAMING)
#ifdef QGC_GST_STREAMING
GStreamer::releaseVideoSink(sink);
#else
Q_UNUSED(sink)
#elif defined(QGC_QT_STREAMING)
QtMultimediaReceiver::releaseVideoSink(sink);
#endif
}

Expand Down
2 changes: 0 additions & 2 deletions src/API/QGCCorePlugin.h
Original file line number Diff line number Diff line change
Expand Up @@ -110,8 +110,6 @@ class QGCCorePlugin : public QGCTool
/// Allows the plugin to override the creation of the root (native) window.
virtual void createRootWindow(QQmlApplicationEngine* qmlEngine);

/// Allows the plugin to override the creation of VideoManager.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Isn't this going to hose custom builds folks who already use this?

Copy link
Collaborator Author

@HTRamsey HTRamsey Sep 6, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I debated on leaving it, but it's not used anywhere so it does absolutely nothing right now, also i think a custom videomanager doesn't really make much sense like a videoreceiver does.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

but it's not used anywhere so it does absolutely nothing right now

Ok. Was it always like that or was it changed somewhere along the way. Guess we can remove and see if someone yells. I think some amount of this stuff was added by Auterion ages ago for their custom QGC. But they are so far forked from upstream they can never come back, so no longer important.

virtual VideoManager* createVideoManager(QGCApplication* app, QGCToolbox* toolbox);
/// Allows the plugin to override the creation of VideoReceiver.
virtual VideoReceiver* createVideoReceiver(QObject* parent);
/// Allows the plugin to override the creation of VideoSink.
Expand Down
17 changes: 17 additions & 0 deletions src/FlightDisplay/FlightDisplayViewQtMultimedia.qml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
/****************************************************************************
*
* (c) 2009-2020 QGROUNDCONTROL PROJECT <http://www.qgroundcontrol.org>
*
* QGroundControl is licensed according to the terms in the file
* COPYING.md in the root of the source code directory.
*
****************************************************************************/

import QtQuick
import QtMultimedia

VideoOutput {
id: videoOutput
anchors.fill: parent
fillMode: VideoOutput.PreserveAspectCrop
}
4 changes: 2 additions & 2 deletions src/FlightDisplay/FlyViewVideo.qml
Original file line number Diff line number Diff line change
Expand Up @@ -58,13 +58,13 @@ Item {
id: videoStreaming
anchors.fill: parent
useSmallFont: _root.pipState.state !== _root.pipState.fullState
visible: QGroundControl.videoManager.isGStreamer
visible: QGroundControl.videoManager.isStreamSource
}
//-- UVC Video (USB Camera or Video Device)
Loader {
id: cameraLoader
anchors.fill: parent
visible: !QGroundControl.videoManager.isGStreamer
visible: !QGroundControl.videoManager.isStreamSource
source: QGroundControl.videoManager.uvcEnabled ? "qrc:/qml/FlightDisplayViewUVC.qml" : "qrc:/qml/FlightDisplayViewDummy.qml"
}

Expand Down
15 changes: 15 additions & 0 deletions src/FlightDisplay/QGCVideoBackground.qml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
/****************************************************************************
*
* (c) 2009-2020 QGROUNDCONTROL PROJECT <http://www.qgroundcontrol.org>
*
* QGroundControl is licensed according to the terms in the file
* COPYING.md in the root of the source code directory.
*
****************************************************************************/

import QtQuick
import QtQuick.Controls

FlightDisplayViewGStreamer {
id: videoBackground
}
2 changes: 1 addition & 1 deletion src/QGCApplication.cc
Original file line number Diff line number Diff line change
Expand Up @@ -405,7 +405,7 @@ void QGCApplication::init()

void QGCApplication::_initForNormalAppBoot()
{
#ifdef Q_OS_DARWIN
#ifdef QGC_GST_STREAMING
// Gstreamer video playback requires OpenGL
QQuickWindow::setGraphicsApi(QSGRendererInterface::OpenGL);
#endif
Expand Down
3 changes: 3 additions & 0 deletions src/QmlControls/QGroundControl/FlightDisplay/qmldir
Original file line number Diff line number Diff line change
Expand Up @@ -42,3 +42,6 @@ ObstacleDistanceOverlayMap 1.0 ObstacleDistanceOverlayMap.qml
ObstacleDistanceOverlayVideo 1.0 ObstacleDistanceOverlayVideo.qml
GripperMenu 1.0 GripperMenu.qml
OnScreenGimbalController 1.0 OnScreenGimbalController.qml
FlightDisplayViewGStreamer 1.0 FlightDisplayViewGStreamer.qml
FlightDisplayViewQtMultimedia 1.0 FlightDisplayViewQtMultimedia.qml
QGCVideoBackground 1.0 QGCVideoBackground.qml
1 change: 0 additions & 1 deletion src/QmlControls/QGroundControl/FlightMap/qmldir
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ Module QGroundControl.FlightMap

# Main view controls
FlightMap 1.0 FlightMap.qml
QGCVideoBackground 1.0 QGCVideoBackground.qml

# Widgets
CenterMapDropButton 1.0 CenterMapDropButton.qml
Expand Down
8 changes: 3 additions & 5 deletions src/Settings/VideoSettings.cc
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@ DECLARE_SETTINGGROUP(Video, "Video")

// Setup enum values for videoSource settings into meta data
QVariantList videoSourceList;
#ifdef QGC_GST_STREAMING
videoSourceList.append(videoSourceRTSP);
videoSourceList.append(videoSourceUDPH264);
videoSourceList.append(videoSourceUDPH265);
Expand All @@ -36,7 +35,6 @@ DECLARE_SETTINGGROUP(Video, "Video")
videoSourceList.append(videoSourceYuneecMantisG);
videoSourceList.append(videoSourceHerelinkAirUnit);
videoSourceList.append(videoSourceHerelinkHotspot);
#endif
#ifndef QGC_DISABLE_UVC
QList<QCameraDevice> videoInputs = QMediaDevices::videoInputs();
for (const auto& cameraDevice: videoInputs) {
Expand Down Expand Up @@ -131,10 +129,10 @@ DECLARE_SETTINGSFACT_NO_FUNC(VideoSettings, forceVideoDecoder)
_forceVideoDecoderFact = _createSettingsFact(forceVideoDecoderName);

_forceVideoDecoderFact->setVisible(
#ifdef Q_OS_IOS
false
#else
#ifdef QGC_GST_STREAMING
true
#else
false
#endif
);

Expand Down
23 changes: 12 additions & 11 deletions src/UI/preferences/VideoSettings.qml
Original file line number Diff line number Diff line change
Expand Up @@ -23,12 +23,13 @@ SettingsPage {
property var _videoManager: QGroundControl.videoManager
property var _videoSettings: _settingsManager.videoSettings
property string _videoSource: _videoSettings.videoSource.rawValue
property bool _isGst: _videoManager.isGStreamer
property bool _isUDP264: _isGst && _videoSource === _videoSettings.udp264VideoSource
property bool _isUDP265: _isGst && _videoSource === _videoSettings.udp265VideoSource
property bool _isRTSP: _isGst && _videoSource === _videoSettings.rtspVideoSource
property bool _isTCP: _isGst && _videoSource === _videoSettings.tcpVideoSource
property bool _isMPEGTS: _isGst && _videoSource === _videoSettings.mpegtsVideoSource
property bool _isGST: _videoManager.gstreamerEnabled
property bool _isStreamSource: _videoManager.isStreamSource
property bool _isUDP264: _isStreamSource && (_videoSource === _videoSettings.udp264VideoSource)
property bool _isUDP265: _isStreamSource && (_videoSource === _videoSettings.udp265VideoSource)
property bool _isRTSP: _isStreamSource && (_videoSource === _videoSettings.rtspVideoSource)
property bool _isTCP: _isStreamSource && (_videoSource === _videoSettings.tcpVideoSource)
property bool _isMPEGTS: _isStreamSource && (_videoSource === _videoSettings.mpegtsVideoSource)
property bool _videoAutoStreamConfig: _videoManager.autoStreamConfigured
property real _urlFieldWidth: ScreenTools.defaultFontPixelWidth * 25
property bool _requiresUDPPort: _isUDP264 || _isUDP265 || _isMPEGTS
Expand Down Expand Up @@ -85,23 +86,23 @@ SettingsPage {
Layout.fillWidth: true
label: qsTr("Aspect Ratio")
fact: _videoSettings.aspectRatio
visible: !_videoAutoStreamConfig && _isGst && _videoSettings.aspectRatio.visible
visible: !_videoAutoStreamConfig && _isStreamSource && _videoSettings.aspectRatio.visible
}

FactCheckBoxSlider {
Layout.fillWidth: true
text: qsTr("Stop recording when disarmed")
fact: _videoSettings.disableWhenDisarmed
visible: !_videoAutoStreamConfig && _isGst && fact.visible
visible: !_videoAutoStreamConfig && _isStreamSource && fact.visible
}

FactCheckBoxSlider {
Layout.fillWidth: true
text: qsTr("Low Latency Mode")
fact: _videoSettings.lowLatencyMode
visible: !_videoAutoStreamConfig && _isGst && fact.visible
visible: !_videoAutoStreamConfig && _isStreamSource && fact.visible && _isGST
}

LabelledFactComboBox {
Layout.fillWidth: true
label: qsTr("Video decode priority")
Expand All @@ -114,7 +115,7 @@ SettingsPage {
SettingsGroupLayout {
Layout.fillWidth: true
heading: qsTr("Local Video Storage")

LabelledFactComboBox {
Layout.fillWidth: true
label: qsTr("Record File Format")
Expand Down
19 changes: 10 additions & 9 deletions src/VideoManager/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,11 +1,3 @@
# option(QGC_ENABLE_VIDEOSTREAMING "Enable video streaming" ON)
# if(NOT QGC_ENABLE_VIDEOSTREAMING)
# return()
# endif()
# message(STATUS "Enabling video streaming support")

add_subdirectory(VideoReceiver)

find_package(Qt6 REQUIRED COMPONENTS Core)

qt_add_library(VideoManager STATIC
Expand All @@ -15,19 +7,28 @@ qt_add_library(VideoManager STATIC
VideoManager.h
)

# option(QGC_ENABLE_VIDEOSTREAMING "Enable video streaming" ON)
# if(NOT QGC_ENABLE_VIDEOSTREAMING)
# return()
# endif()
# message(STATUS "Enabling video streaming support")

add_subdirectory(VideoReceiver)

target_link_libraries(VideoManager
PRIVATE
API
Camera
FactSystem
QmlControls
QtMultimediaReceiver
Settings
Utilities
Vehicle
VideoReceiver
PUBLIC
Qt6::Core
GStreamerReceiver
QtMultimediaReceiver
QGC
)

Expand Down
Loading
Loading