Commit ebda2a12 authored by Gus Grubba's avatar Gus Grubba Committed by GitHub

Merge pull request #5386 from mavlink/defaultVideo

Set default video streaming to Disabled.
parents 851aeb31 9b74e3df
...@@ -114,11 +114,8 @@ VideoManager::_rtspUrlChanged() ...@@ -114,11 +114,8 @@ VideoManager::_rtspUrlChanged()
bool bool
VideoManager::hasVideo() VideoManager::hasVideo()
{ {
#if defined(QGC_GST_STREAMING)
return true;
#endif
QString videoSource = _videoSettings->videoSource()->rawValue().toString(); QString videoSource = _videoSettings->videoSource()->rawValue().toString();
return !videoSource.isEmpty() && videoSource != VideoSettings::videoSourceNoVideo; return !videoSource.isEmpty() && videoSource != VideoSettings::videoSourceNoVideo && videoSource != VideoSettings::videoDisabled;
} }
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
...@@ -150,7 +147,7 @@ VideoManager::_updateSettings() ...@@ -150,7 +147,7 @@ VideoManager::_updateSettings()
return; return;
if (_videoSettings->videoSource()->rawValue().toString() == VideoSettings::videoSourceUDP) if (_videoSettings->videoSource()->rawValue().toString() == VideoSettings::videoSourceUDP)
_videoReceiver->setUri(QStringLiteral("udp://0.0.0.0:%1").arg(_videoSettings->udpPort()->rawValue().toInt())); _videoReceiver->setUri(QStringLiteral("udp://0.0.0.0:%1").arg(_videoSettings->udpPort()->rawValue().toInt()));
else else if (_videoSettings->videoSource()->rawValue().toString() == VideoSettings::videoSourceRTSP)
_videoReceiver->setUri(_videoSettings->rtspUrl()->rawValue().toString()); _videoReceiver->setUri(_videoSettings->rtspUrl()->rawValue().toString());
} }
......
...@@ -29,6 +29,7 @@ const char* VideoSettings::recordingFormatName = "RecordingFormat"; ...@@ -29,6 +29,7 @@ const char* VideoSettings::recordingFormatName = "RecordingFormat";
const char* VideoSettings::maxVideoSizeName = "MaxVideoSize"; const char* VideoSettings::maxVideoSizeName = "MaxVideoSize";
const char* VideoSettings::videoSourceNoVideo = "No Video Available"; const char* VideoSettings::videoSourceNoVideo = "No Video Available";
const char* VideoSettings::videoDisabled = "Video Stream Disabled";
const char* VideoSettings::videoSourceUDP = "UDP Video Stream"; const char* VideoSettings::videoSourceUDP = "UDP Video Stream";
const char* VideoSettings::videoSourceRTSP = "RTSP Video Stream"; const char* VideoSettings::videoSourceRTSP = "RTSP Video Stream";
...@@ -47,6 +48,7 @@ VideoSettings::VideoSettings(QObject* parent) ...@@ -47,6 +48,7 @@ VideoSettings::VideoSettings(QObject* parent)
qmlRegisterUncreatableType<VideoSettings>("QGroundControl.SettingsManager", 1, 0, "VideoSettings", "Reference only"); qmlRegisterUncreatableType<VideoSettings>("QGroundControl.SettingsManager", 1, 0, "VideoSettings", "Reference only");
// Setup enum values for videoSource settings into meta data // Setup enum values for videoSource settings into meta data
bool noVideo = false;
QStringList videoSourceList; QStringList videoSourceList;
#ifdef QGC_GST_STREAMING #ifdef QGC_GST_STREAMING
#ifndef NO_UDP_VIDEO #ifndef NO_UDP_VIDEO
...@@ -61,7 +63,10 @@ VideoSettings::VideoSettings(QObject* parent) ...@@ -61,7 +63,10 @@ VideoSettings::VideoSettings(QObject* parent)
} }
#endif #endif
if (videoSourceList.count() == 0) { if (videoSourceList.count() == 0) {
noVideo = true;
videoSourceList.append(videoSourceNoVideo); videoSourceList.append(videoSourceNoVideo);
} else {
videoSourceList.insert(0, videoDisabled);
} }
QVariantList videoSourceVarList; QVariantList videoSourceVarList;
foreach (const QString& videoSource, videoSourceList) { foreach (const QString& videoSource, videoSourceList) {
...@@ -70,11 +75,11 @@ VideoSettings::VideoSettings(QObject* parent) ...@@ -70,11 +75,11 @@ VideoSettings::VideoSettings(QObject* parent)
_nameToMetaDataMap[videoSourceName]->setEnumInfo(videoSourceList, videoSourceVarList); _nameToMetaDataMap[videoSourceName]->setEnumInfo(videoSourceList, videoSourceVarList);
// Set default value for videoSource // Set default value for videoSource
#if defined(NO_UDP_VIDEO) if (noVideo) {
_nameToMetaDataMap[videoSourceName]->setRawDefaultValue(videoSourceRTSP); _nameToMetaDataMap[videoSourceName]->setRawDefaultValue(videoSourceNoVideo);
#else } else {
_nameToMetaDataMap[videoSourceName]->setRawDefaultValue(videoSourceUDP); _nameToMetaDataMap[videoSourceName]->setRawDefaultValue(videoDisabled);
#endif }
} }
Fact* VideoSettings::videoSource(void) Fact* VideoSettings::videoSource(void)
......
...@@ -49,6 +49,7 @@ public: ...@@ -49,6 +49,7 @@ public:
static const char* maxVideoSizeName; static const char* maxVideoSizeName;
static const char* videoSourceNoVideo; static const char* videoSourceNoVideo;
static const char* videoDisabled;
static const char* videoSourceUDP; static const char* videoSourceUDP;
static const char* videoSourceRTSP; static const char* videoSourceRTSP;
......
...@@ -220,10 +220,11 @@ VideoReceiver::start() ...@@ -220,10 +220,11 @@ VideoReceiver::start()
_starting = true; _starting = true;
bool isUdp = _uri.contains("udp://"); bool isUdp = _uri.contains("udp://");
bool isRtsp = _uri.contains("rtsp://");
//-- For RTSP, check to see if server is there first //-- For RTSP, check to see if server is there first
if(!_serverPresent && !isUdp) { if(!_serverPresent && isRtsp) {
_timer.start(100); _timer.start(100);
return; return;
} }
...@@ -776,7 +777,7 @@ VideoReceiver::_updateTimer() ...@@ -776,7 +777,7 @@ VideoReceiver::_updateTimer()
stop(); stop();
} }
} else { } else {
if(!running()) { if(!running() && !_uri.isEmpty()) {
start(); start();
} }
} }
......
...@@ -529,7 +529,7 @@ QGCView { ...@@ -529,7 +529,7 @@ QGCView {
} }
Row { Row {
spacing: ScreenTools.defaultFontPixelWidth spacing: ScreenTools.defaultFontPixelWidth
visible: QGroundControl.settingsManager.videoSettings.udpPort.visible && QGroundControl.videoManager.isGStreamer && videoSource.currentIndex === 0 visible: QGroundControl.settingsManager.videoSettings.udpPort.visible && QGroundControl.videoManager.isGStreamer && videoSource.currentIndex === 1
QGCLabel { QGCLabel {
text: qsTr("UDP Port:") text: qsTr("UDP Port:")
width: _labelWidth width: _labelWidth
...@@ -543,7 +543,7 @@ QGCView { ...@@ -543,7 +543,7 @@ QGCView {
} }
Row { Row {
spacing: ScreenTools.defaultFontPixelWidth spacing: ScreenTools.defaultFontPixelWidth
visible: QGroundControl.settingsManager.videoSettings.rtspUrl.visible && QGroundControl.videoManager.isGStreamer && videoSource.currentIndex === 1 visible: QGroundControl.settingsManager.videoSettings.rtspUrl.visible && QGroundControl.videoManager.isGStreamer && videoSource.currentIndex === 2
QGCLabel { QGCLabel {
anchors.verticalCenter: parent.verticalCenter anchors.verticalCenter: parent.verticalCenter
text: qsTr("RTSP URL:") text: qsTr("RTSP URL:")
...@@ -557,7 +557,7 @@ QGCView { ...@@ -557,7 +557,7 @@ QGCView {
} }
Row { Row {
spacing: ScreenTools.defaultFontPixelWidth spacing: ScreenTools.defaultFontPixelWidth
visible: QGroundControl.videoManager.isGStreamer && videoSource.currentIndex < 2 && QGroundControl.settingsManager.videoSettings.aspectRatio.visible visible: QGroundControl.videoManager.isGStreamer && videoSource.currentIndex && videoSource.currentIndex < 3 && QGroundControl.settingsManager.videoSettings.aspectRatio.visible
QGCLabel { QGCLabel {
text: qsTr("Aspect Ratio:") text: qsTr("Aspect Ratio:")
width: _labelWidth width: _labelWidth
...@@ -571,7 +571,7 @@ QGCView { ...@@ -571,7 +571,7 @@ QGCView {
} }
Row { Row {
spacing: ScreenTools.defaultFontPixelWidth spacing: ScreenTools.defaultFontPixelWidth
visible: QGroundControl.videoManager.isGStreamer && videoSource.currentIndex < 2 && QGroundControl.settingsManager.videoSettings.gridLines.visible visible: QGroundControl.videoManager.isGStreamer && videoSource.currentIndex && videoSource.currentIndex < 3 && QGroundControl.settingsManager.videoSettings.gridLines.visible
QGCLabel { QGCLabel {
text: qsTr("Grid Lines:") text: qsTr("Grid Lines:")
width: _labelWidth width: _labelWidth
...@@ -613,7 +613,7 @@ QGCView { ...@@ -613,7 +613,7 @@ QGCView {
anchors.centerIn: parent anchors.centerIn: parent
Row { Row {
spacing: ScreenTools.defaultFontPixelWidth spacing: ScreenTools.defaultFontPixelWidth
visible: QGroundControl.videoManager.isGStreamer && videoSource.currentIndex < 2 && QGroundControl.settingsManager.videoSettings.maxVideoSize.visible visible: QGroundControl.videoManager.isGStreamer && videoSource.currentIndex && videoSource.currentIndex < 3 && QGroundControl.settingsManager.videoSettings.maxVideoSize.visible
QGCLabel { QGCLabel {
text: qsTr("Max Storage Usage:") text: qsTr("Max Storage Usage:")
width: _labelWidth width: _labelWidth
...@@ -627,7 +627,7 @@ QGCView { ...@@ -627,7 +627,7 @@ QGCView {
} }
Row { Row {
spacing: ScreenTools.defaultFontPixelWidth spacing: ScreenTools.defaultFontPixelWidth
visible: QGroundControl.videoManager.isGStreamer && videoSource.currentIndex < 2 && QGroundControl.settingsManager.videoSettings.recordingFormat.visible visible: QGroundControl.videoManager.isGStreamer && videoSource.currentIndex && videoSource.currentIndex < 3 && QGroundControl.settingsManager.videoSettings.recordingFormat.visible
QGCLabel { QGCLabel {
text: qsTr("Video File Format:") text: qsTr("Video File Format:")
width: _labelWidth width: _labelWidth
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment