Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Q
qgroundcontrol
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Valentin Platzgummer
qgroundcontrol
Commits
23f57eb9
Commit
23f57eb9
authored
Feb 23, 2017
by
Don Gagne
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Move video settings to new SettingsGroup system
parent
026e6057
Changes
9
Hide whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
209 additions
and
244 deletions
+209
-244
VideoManager.cc
src/FlightDisplay/VideoManager.cc
+37
-156
VideoManager.h
src/FlightDisplay/VideoManager.h
+9
-33
SettingsGroup.video.json
src/Settings/SettingsGroup.video.json
+0
-2
Video.SettingsGroup.json
src/Settings/Video.SettingsGroup.json
+31
-0
VideoSettings.cc
src/Settings/VideoSettings.cc
+82
-1
VideoSettings.h
src/Settings/VideoSettings.h
+23
-0
VideoReceiver.cc
src/VideoStreaming/VideoReceiver.cc
+7
-13
VideoReceiver.h
src/VideoStreaming/VideoReceiver.h
+0
-2
GeneralSettings.qml
src/ui/preferences/GeneralSettings.qml
+20
-37
No files found.
src/FlightDisplay/VideoManager.cc
View file @
23f57eb9
...
...
@@ -25,19 +25,7 @@
#include "QGCToolbox.h"
#include "QGCCorePlugin.h"
#include "QGCOptions.h"
static
const
char
*
kVideoSourceKey
=
"VideoSource"
;
static
const
char
*
kVideoUDPPortKey
=
"VideoUDPPort"
;
static
const
char
*
kVideoRTSPUrlKey
=
"VideoRTSPUrl"
;
static
const
char
*
kNoVideo
=
"No Video Available"
;
#if defined(QGC_GST_STREAMING)
#if defined(QGC_ENABLE_VIDEORECORDING)
static
const
char
*
kVideoSavePathKey
=
"VideoSavePath"
;
#endif
static
const
char
*
kUDPStream
=
"UDP Video Stream"
;
static
const
char
*
kRTSPStream
=
"RTSP Video Stream"
;
#endif
#include "Settings/SettingsManager.h"
QGC_LOGGING_CATEGORY
(
VideoManagerLog
,
"VideoManagerLog"
)
...
...
@@ -47,8 +35,8 @@ VideoManager::VideoManager(QGCApplication* app)
,
_videoSurface
(
NULL
)
,
_videoReceiver
(
NULL
)
,
_videoRunning
(
false
)
,
_udpPort
(
5600
)
//-- Defalut Port 5600 == Solo UDP Port
,
_init
(
false
)
,
_videoSettings
(
NULL
)
{
}
...
...
@@ -65,31 +53,36 @@ VideoManager::setToolbox(QGCToolbox *toolbox)
QGCTool
::
setToolbox
(
toolbox
);
QQmlEngine
::
setObjectOwnership
(
this
,
QQmlEngine
::
CppOwnership
);
qmlRegisterUncreatableType
<
VideoManager
>
(
"QGroundControl.VideoManager"
,
1
,
0
,
"VideoManager"
,
"Reference only"
);
//-- Get saved settings
_videoSettings
=
toolbox
->
settingsManager
()
->
videoSettings
();
QString
videoSource
=
_videoSettings
->
videoSource
()
->
rawValue
().
toString
();
#if defined(QGC_GST_STREAMING)
QSettings
settings
;
#if defined(NO_UDP_VIDEO)
setVideoSource
(
settings
.
value
(
kVideoSourceKey
,
kRTSPStream
).
toString
());
#else
setVideoSource
(
settings
.
value
(
kVideoSourceKey
,
kUDPStream
).
toString
());
#endif
//-- Check if core plugin defines its own video requirements
if
(
qgcApp
()
->
toolbox
()
->
corePlugin
()
->
options
()
->
definesVideo
())
{
if
(
qgcApp
()
->
toolbox
()
->
corePlugin
()
->
options
()
->
videoUDPPort
())
{
setUdpPort
(
qgcApp
()
->
toolbox
()
->
corePlugin
()
->
options
()
->
videoUDPPort
());
setVideoSource
(
kUDPStream
);
}
else
{
setVideoSource
(
kRTSPStream
);
setRtspURL
(
qgcApp
()
->
toolbox
()
->
corePlugin
()
->
options
()
->
videoRSTPUrl
());
}
}
else
{
setUdpPort
(
settings
.
value
(
kVideoUDPPortKey
,
5600
).
toUInt
());
setRtspURL
(
settings
.
value
(
kVideoRTSPUrlKey
,
"rtsp://192.168.42.1:554/live"
).
toString
());
//-- Example RTSP URL
}
#if defined(QGC_ENABLE_VIDEORECORDING)
setVideoSavePath
(
settings
.
value
(
kVideoSavePathKey
,
QDir
::
homePath
()).
toString
());
#ifndef QGC_DISABLE_UVC
// If we are using a UVC camera setup the device name
QList
<
QCameraInfo
>
cameras
=
QCameraInfo
::
availableCameras
();
foreach
(
const
QCameraInfo
&
cameraInfo
,
cameras
)
{
if
(
cameraInfo
.
description
()
==
videoSource
)
{
_videoSourceID
=
cameraInfo
.
deviceName
();
emit
videoSourceIDChanged
();
qCDebug
(
VideoManagerLog
)
<<
"Found USB source:"
<<
_videoSourceID
<<
" Name:"
<<
videoSource
;
break
;
}
}
#endif
emit
isGStreamerChanged
();
qCDebug
(
VideoManagerLog
)
<<
"New Video Source:"
<<
videoSource
;
if
(
_videoReceiver
)
{
if
(
isGStreamer
())
{
_videoReceiver
->
start
();
}
else
{
_videoReceiver
->
stop
();
}
}
#endif
_init
=
true
;
#if defined(QGC_GST_STREAMING)
_updateVideo
();
...
...
@@ -105,7 +98,8 @@ VideoManager::hasVideo()
#if defined(QGC_GST_STREAMING)
return
true
;
#endif
return
!
_videoSource
.
isEmpty
();
QString
videoSource
=
_videoSettings
->
videoSource
()
->
rawValue
().
toString
();
return
!
videoSource
.
isEmpty
()
&&
videoSource
!=
VideoSettings
::
videoSourceNoVideo
;
}
//-----------------------------------------------------------------------------
...
...
@@ -113,7 +107,8 @@ bool
VideoManager
::
isGStreamer
()
{
#if defined(QGC_GST_STREAMING)
return
_videoSource
==
kUDPStream
||
_videoSource
==
kRTSPStream
;
QString
videoSource
=
_videoSettings
->
videoSource
()
->
rawValue
().
toString
();
return
videoSource
==
VideoSettings
::
videoSourceUDP
||
videoSource
==
VideoSettings
::
videoSourceRTSP
;
#else
return
false
;
#endif
...
...
@@ -128,118 +123,6 @@ VideoManager::uvcEnabled()
}
#endif
//-----------------------------------------------------------------------------
void
VideoManager
::
setVideoSource
(
QString
vSource
)
{
if
(
vSource
==
kNoVideo
)
return
;
_videoSource
=
vSource
;
QSettings
settings
;
settings
.
setValue
(
kVideoSourceKey
,
vSource
);
emit
videoSourceChanged
();
#ifndef QGC_DISABLE_UVC
QList
<
QCameraInfo
>
cameras
=
QCameraInfo
::
availableCameras
();
foreach
(
const
QCameraInfo
&
cameraInfo
,
cameras
)
{
if
(
cameraInfo
.
description
()
==
vSource
)
{
_videoSourceID
=
cameraInfo
.
deviceName
();
emit
videoSourceIDChanged
();
qCDebug
(
VideoManagerLog
)
<<
"Found USB source:"
<<
_videoSourceID
<<
" Name:"
<<
_videoSource
;
break
;
}
}
#endif
emit
isGStreamerChanged
();
qCDebug
(
VideoManagerLog
)
<<
"New Video Source:"
<<
vSource
;
/*
* Not working. Requires restart for now. (Undef KRTSP/kUDP above when enabling this)
if(isGStreamer())
_updateVideo();
*/
if
(
_videoReceiver
)
{
if
(
isGStreamer
())
{
_videoReceiver
->
start
();
}
else
{
_videoReceiver
->
stop
();
}
}
}
//-----------------------------------------------------------------------------
void
VideoManager
::
setUdpPort
(
quint16
port
)
{
_udpPort
=
port
;
QSettings
settings
;
settings
.
setValue
(
kVideoUDPPortKey
,
port
);
emit
udpPortChanged
();
/*
* Not working. Requires restart for now. (Undef KRTSP/kUDP above when enabling this)
if(_videoSource == kUDPStream)
_updateVideo();
*/
}
//-----------------------------------------------------------------------------
void
VideoManager
::
setRtspURL
(
QString
url
)
{
_rtspURL
=
url
;
QSettings
settings
;
settings
.
setValue
(
kVideoRTSPUrlKey
,
url
);
emit
rtspURLChanged
();
/*
* Not working. Requires restart for now. (Undef KRTSP/kUDP above when enabling this)
if(_videoSource == kRTSPStream)
_updateVideo();
*/
}
void
VideoManager
::
setVideoSavePathByUrl
(
QUrl
url
)
{
#if defined(QGC_ENABLE_VIDEORECORDING)
setVideoSavePath
(
url
.
toLocalFile
());
#else
Q_UNUSED
(
url
);
#endif
}
void
VideoManager
::
setVideoSavePath
(
QString
path
)
{
#if defined(QGC_ENABLE_VIDEORECORDING)
_videoSavePath
=
path
;
QSettings
settings
;
settings
.
setValue
(
kVideoSavePathKey
,
path
);
if
(
_videoReceiver
)
_videoReceiver
->
setVideoSavePath
(
_videoSavePath
);
emit
videoSavePathChanged
();
#else
Q_UNUSED
(
path
);
#endif
}
//-----------------------------------------------------------------------------
QStringList
VideoManager
::
videoSourceList
()
{
_videoSourceList
.
clear
();
#if defined(QGC_GST_STREAMING)
_videoSourceList
.
append
(
kUDPStream
);
_videoSourceList
.
append
(
kRTSPStream
);
#endif
#ifndef QGC_DISABLE_UVC
QList
<
QCameraInfo
>
cameras
=
QCameraInfo
::
availableCameras
();
foreach
(
const
QCameraInfo
&
cameraInfo
,
cameras
)
{
qCDebug
(
VideoManagerLog
)
<<
"UVC Video source ID:"
<<
cameraInfo
.
deviceName
()
<<
" Name:"
<<
cameraInfo
.
description
();
_videoSourceList
.
append
(
cameraInfo
.
description
());
}
#endif
if
(
_videoSourceList
.
count
()
==
0
)
_videoSourceList
.
append
(
kNoVideo
);
return
_videoSourceList
;
}
//-----------------------------------------------------------------------------
void
VideoManager
::
_updateTimer
()
{
...
...
@@ -292,13 +175,11 @@ void VideoManager::_updateVideo()
_videoReceiver
=
new
VideoReceiver
(
this
);
#if defined(QGC_GST_STREAMING)
_videoReceiver
->
setVideoSink
(
_videoSurface
->
videoSink
());
if
(
_videoSource
==
kUDPStream
)
_videoReceiver
->
setUri
(
QStringLiteral
(
"udp://0.0.0.0:%1"
).
arg
(
_udpPort
));
QString
videoSource
=
_videoSettings
->
videoSource
()
->
rawValue
().
toString
();
if
(
_videoSettings
->
videoSource
()
->
rawValue
().
toString
()
==
VideoSettings
::
videoSourceUDP
)
_videoReceiver
->
setUri
(
QStringLiteral
(
"udp://0.0.0.0:%1"
).
arg
(
_videoSettings
->
udpPort
()
->
rawValue
().
toInt
()));
else
_videoReceiver
->
setUri
(
_rtspURL
);
#if defined(QGC_ENABLE_VIDEORECORDING)
_videoReceiver
->
setVideoSavePath
(
_videoSavePath
);
#endif
_videoReceiver
->
setUri
(
_videoSettings
->
rtspUrl
()
->
rawValue
().
toString
());
#endif
_videoReceiver
->
start
();
}
...
...
src/FlightDisplay/VideoManager.h
View file @
23f57eb9
...
...
@@ -22,6 +22,8 @@
Q_DECLARE_LOGGING_CATEGORY
(
VideoManagerLog
)
class
VideoSettings
;
class
VideoManager
:
public
QGCTool
{
Q_OBJECT
...
...
@@ -33,28 +35,16 @@ public:
Q_PROPERTY
(
bool
hasVideo
READ
hasVideo
NOTIFY
hasVideoChanged
)
Q_PROPERTY
(
bool
isGStreamer
READ
isGStreamer
NOTIFY
isGStreamerChanged
)
Q_PROPERTY
(
QString
videoSourceID
READ
videoSourceID
NOTIFY
videoSourceIDChanged
)
Q_PROPERTY
(
QString
videoSource
READ
videoSource
WRITE
setVideoSource
NOTIFY
videoSourceChanged
)
Q_PROPERTY
(
QStringList
videoSourceList
READ
videoSourceList
NOTIFY
videoSourceListChanged
)
Q_PROPERTY
(
bool
videoRunning
READ
videoRunning
NOTIFY
videoRunningChanged
)
Q_PROPERTY
(
quint16
udpPort
READ
udpPort
WRITE
setUdpPort
NOTIFY
udpPortChanged
)
Q_PROPERTY
(
QString
rtspURL
READ
rtspURL
WRITE
setRtspURL
NOTIFY
rtspURLChanged
)
Q_PROPERTY
(
QString
videoSavePath
READ
videoSavePath
NOTIFY
videoSavePathChanged
)
Q_PROPERTY
(
bool
uvcEnabled
READ
uvcEnabled
CONSTANT
)
Q_PROPERTY
(
VideoSurface
*
videoSurface
MEMBER
_videoSurface
CONSTANT
)
Q_PROPERTY
(
VideoReceiver
*
videoReceiver
MEMBER
_videoReceiver
CONSTANT
)
Q_PROPERTY
(
bool
recordingEnabled
READ
recordingEnabled
CONSTANT
)
Q_INVOKABLE
void
setVideoSavePathByUrl
(
QUrl
url
);
bool
hasVideo
();
bool
isGStreamer
();
bool
videoRunning
()
{
return
_videoRunning
;
}
QString
videoSourceID
()
{
return
_videoSourceID
;
}
QString
videoSource
()
{
return
_videoSource
;
}
QStringList
videoSourceList
();
quint16
udpPort
()
{
return
_udpPort
;
}
QString
rtspURL
()
{
return
_rtspURL
;
}
QString
videoSavePath
()
{
return
_videoSavePath
;
}
#if defined(QGC_DISABLE_UVC)
bool
uvcEnabled
()
{
return
false
;
}
...
...
@@ -68,43 +58,29 @@ public:
bool
recordingEnabled
()
{
return
false
;
}
#endif
void
setVideoSource
(
QString
vSource
);
void
setUdpPort
(
quint16
port
);
void
setRtspURL
(
QString
url
);
void
setVideoSavePath
(
QString
path
);
// Override from QGCTool
void
setToolbox
(
QGCToolbox
*
toolbox
);
signals:
void
hasVideoChanged
();
void
videoRunningChanged
();
void
videoSourceChanged
();
void
videoSourceListChanged
();
void
isGStreamerChanged
();
void
videoSourceIDChanged
();
void
udpPortChanged
();
void
rtspURLChanged
();
void
videoSavePathChanged
();
private:
void
_updateTimer
();
void
_updateVideo
();
private:
VideoSurface
*
_videoSurface
;
VideoReceiver
*
_videoReceiver
;
bool
_videoRunning
;
VideoSurface
*
_videoSurface
;
VideoReceiver
*
_videoReceiver
;
bool
_videoRunning
;
#if defined(QGC_GST_STREAMING)
QTimer
_frameTimer
;
QTimer
_frameTimer
;
#endif
QString
_videoSource
;
QString
_videoSourceID
;
QStringList
_videoSourceList
;
quint16
_udpPort
;
QString
_rtspURL
;
QString
_videoSavePath
;
bool
_init
;
QString
_videoSourceID
;
bool
_init
;
VideoSettings
*
_videoSettings
;
};
#endif
src/Settings/SettingsGroup.video.json
deleted
100644 → 0
View file @
026e6057
[
]
src/Settings/Video.SettingsGroup.json
0 → 100644
View file @
23f57eb9
[
{
"name"
:
"VideoSource"
,
"shortDescription"
:
"Video source"
,
"longDescription"
:
"Source for video. UDP, RTSP and UVC Cameras may be supported supported depending on Vehicle and QGroundControl version."
,
"type"
:
"string"
,
"defaultValue"
:
""
},
{
"name"
:
"VideoUDPPort"
,
"shortDescription"
:
"Video UDP Port"
,
"longDescription"
:
"UDP port to bind to for video stream."
,
"type"
:
"uint16"
,
"min"
:
1025
,
"defaultValue"
:
5600
},
{
"name"
:
"VideoRTSPUrl"
,
"shortDescription"
:
"Video RTSP Url"
,
"longDescription"
:
"RTSP url address and port to bind to for video stream. Example: rtsp://192.168.42.1:554/live"
,
"type"
:
"string"
,
"defaultValue"
:
""
},
{
"name"
:
"VideoSavePath"
,
"shortDescription"
:
"Video save directory"
,
"longDescription"
:
"Directory to save videos to."
,
"type"
:
"string"
,
"defaultValue"
:
""
}
]
src/Settings/VideoSettings.cc
View file @
23f57eb9
...
...
@@ -11,12 +11,93 @@
#include <QQmlEngine>
#include <QtQml>
#include <QVariantList>
#include <QCameraInfo>
const
char
*
VideoSettings
::
videoSettingsGroupName
=
"video"
;
const
char
*
VideoSettings
::
videoSettingsGroupName
=
"Video"
;
const
char
*
VideoSettings
::
videoSourceName
=
"VideoSource"
;
const
char
*
VideoSettings
::
udpPortName
=
"VideoUDPPort"
;
const
char
*
VideoSettings
::
rtspUrlName
=
"VideoRTSPUrl"
;
const
char
*
VideoSettings
::
videoSavePathName
=
"VideoSavePath"
;
const
char
*
VideoSettings
::
videoSourceNoVideo
=
"No Video Available"
;
const
char
*
VideoSettings
::
videoSourceUDP
=
"UDP Video Stream"
;
const
char
*
VideoSettings
::
videoSourceRTSP
=
"RTSP Video Stream"
;
VideoSettings
::
VideoSettings
(
QObject
*
parent
)
:
SettingsGroup
(
videoSettingsGroupName
,
QString
()
/* root settings group */
,
parent
)
,
_videoSourceFact
(
NULL
)
,
_udpPortFact
(
NULL
)
,
_rtspUrlFact
(
NULL
)
,
_videoSavePathFact
(
NULL
)
{
QQmlEngine
::
setObjectOwnership
(
this
,
QQmlEngine
::
CppOwnership
);
qmlRegisterUncreatableType
<
VideoSettings
>
(
"QGroundControl.SettingsManager"
,
1
,
0
,
"VideoSettings"
,
"Reference only"
);
// Setup enum values for videoSource settings into meta data
QStringList
videoSourceList
;
#ifdef QGC_GST_STREAMING
#ifndef NO_UDP_VIDEO
videoSourceList
.
append
(
videoSourceUDP
);
#endif
videoSourceList
.
append
(
videoSourceRTSP
);
#endif
#ifndef QGC_DISABLE_UVC
QList
<
QCameraInfo
>
cameras
=
QCameraInfo
::
availableCameras
();
foreach
(
const
QCameraInfo
&
cameraInfo
,
cameras
)
{
videoSourceList
.
append
(
cameraInfo
.
description
());
}
#endif
if
(
videoSourceList
.
count
()
==
0
)
{
videoSourceList
.
append
(
videoSourceNoVideo
);
}
QVariantList
videoSourceVarList
;
foreach
(
const
QString
&
videoSource
,
videoSourceList
)
{
videoSourceVarList
.
append
(
QVariant
::
fromValue
(
videoSource
));
}
_nameToMetaDataMap
[
videoSourceName
]
->
setEnumInfo
(
videoSourceList
,
videoSourceVarList
);
// Set default value for videoSource
#if defined(NO_UDP_VIDEO)
_nameToMetaDataMap
[
videoSourceName
]
->
setRawDefaultValue
(
videoSourceRTSP
);
#else
_nameToMetaDataMap
[
videoSourceName
]
->
setRawDefaultValue
(
videoSourceUDP
);
#endif
}
Fact
*
VideoSettings
::
videoSource
(
void
)
{
if
(
!
_videoSourceFact
)
{
_videoSourceFact
=
_createSettingsFact
(
videoSourceName
);
}
return
_videoSourceFact
;
}
Fact
*
VideoSettings
::
udpPort
(
void
)
{
if
(
!
_udpPortFact
)
{
_udpPortFact
=
_createSettingsFact
(
udpPortName
);
}
return
_udpPortFact
;
}
Fact
*
VideoSettings
::
rtspUrl
(
void
)
{
if
(
!
_rtspUrlFact
)
{
_rtspUrlFact
=
_createSettingsFact
(
rtspUrlName
);
}
return
_rtspUrlFact
;
}
Fact
*
VideoSettings
::
videoSavePath
(
void
)
{
if
(
!
_videoSavePathFact
)
{
_videoSavePathFact
=
_createSettingsFact
(
videoSavePathName
);
}
return
_videoSavePathFact
;
}
src/Settings/VideoSettings.h
View file @
23f57eb9
...
...
@@ -19,9 +19,32 @@ class VideoSettings : public SettingsGroup
public:
VideoSettings
(
QObject
*
parent
=
NULL
);
Q_PROPERTY
(
Fact
*
videoSource
READ
videoSource
CONSTANT
)
Q_PROPERTY
(
Fact
*
udpPort
READ
udpPort
CONSTANT
)
Q_PROPERTY
(
Fact
*
rtspUrl
READ
rtspUrl
CONSTANT
)
Q_PROPERTY
(
Fact
*
videoSavePath
READ
videoSavePath
CONSTANT
)
Fact
*
videoSource
(
void
);
Fact
*
udpPort
(
void
);
Fact
*
rtspUrl
(
void
);
Fact
*
videoSavePath
(
void
);
static
const
char
*
videoSettingsGroupName
;
static
const
char
*
videoSourceName
;
static
const
char
*
udpPortName
;
static
const
char
*
rtspUrlName
;
static
const
char
*
videoSavePathName
;
static
const
char
*
videoSourceNoVideo
;
static
const
char
*
videoSourceUDP
;
static
const
char
*
videoSourceRTSP
;
private:
SettingsFact
*
_videoSourceFact
;
SettingsFact
*
_udpPortFact
;
SettingsFact
*
_rtspUrlFact
;
SettingsFact
*
_videoSavePathFact
;
};
#endif
src/VideoStreaming/VideoReceiver.cc
View file @
23f57eb9
...
...
@@ -15,6 +15,9 @@
*/
#include "VideoReceiver.h"
#include "SettingsManager.h"
#include "QGCApplication.h"
#include <QDebug>
#include <QUrl>
#include <QDir>
...
...
@@ -348,16 +351,6 @@ void VideoReceiver::setUri(const QString & uri)
_uri
=
uri
;
}
void
VideoReceiver
::
setVideoSavePath
(
const
QString
&
path
)
{
#if defined(QGC_ENABLE_VIDEORECORDING)
_path
=
path
;
qCDebug
(
VideoReceiverLog
)
<<
"New Path:"
<<
_path
;
#else
Q_UNUSED
(
path
);
#endif
}
#if defined(QGC_GST_STREAMING)
void
VideoReceiver
::
_shutdownPipeline
()
{
if
(
!
_pipeline
)
{
...
...
@@ -467,8 +460,9 @@ void VideoReceiver::startRecording(void)
return
;
}
if
(
_path
.
isEmpty
())
{
qWarning
()
<<
"VideoReceiver::startRecording Empty Path!"
;
QString
savePath
=
qgcApp
()
->
toolbox
()
->
settingsManager
()
->
videoSettings
()
->
videoSavePath
()
->
rawValue
().
toString
();
if
(
savePath
.
isEmpty
())
{
qgcApp
()
->
showMessage
(
"Unabled to record video. Video save path must be specified in Settings."
);
return
;
}
...
...
@@ -485,7 +479,7 @@ void VideoReceiver::startRecording(void)
}
QString
videoFile
;
videoFile
=
_p
ath
+
"/QGC-"
+
QDateTime
::
currentDateTime
().
toString
(
"yyyy-MM-dd_hh.mm.ss"
)
+
".mkv"
;
videoFile
=
saveP
ath
+
"/QGC-"
+
QDateTime
::
currentDateTime
().
toString
(
"yyyy-MM-dd_hh.mm.ss"
)
+
".mkv"
;
g_object_set
(
G_OBJECT
(
_sink
->
filesink
),
"location"
,
qPrintable
(
videoFile
),
NULL
);
qCDebug
(
VideoReceiverLog
)
<<
"New video file:"
<<
videoFile
;
...
...
src/VideoStreaming/VideoReceiver.h
View file @
23f57eb9
...
...
@@ -62,7 +62,6 @@ public slots:
void
start
();
void
stop
();
void
setUri
(
const
QString
&
uri
);
void
setVideoSavePath
(
const
QString
&
path
);
void
stopRecording
();
void
startRecording
();
...
...
@@ -105,7 +104,6 @@ private:
#endif
QString
_uri
;
QString
_path
;
#if defined(QGC_GST_STREAMING)
GstElement
*
_pipeline
;
...
...
src/ui/preferences/GeneralSettings.qml
View file @
23f57eb9
...
...
@@ -453,84 +453,68 @@ QGCView {
anchors.margins
:
ScreenTools
.
defaultFontPixelWidth
anchors.horizontalCenter
:
parent
.
horizontalCenter
visible
:
QGroundControl
.
settingsManager
.
videoSettings
.
visible
Column
{
id
:
videoCol
spacing
:
ScreenTools
.
defaultFontPixelWidth
anchors.centerIn
:
parent
Row
{
spacing
:
ScreenTools
.
defaultFontPixelWidth
visible
:
QGroundControl
.
settingsManager
.
videoSettings
.
videoSource
.
visible
QGCLabel
{
anchors.baseline
:
videoSource
.
baseline
text
:
qsTr
(
"
Video Source:
"
)
width
:
_labelWidth
}
QGCComboBox
{
id
:
videoSource
width
:
_editFieldWidth
model
:
QGroundControl
.
videoManager
.
videoSourceList
Component.onCompleted
:
{
var
index
=
videoSource
.
find
(
QGroundControl
.
videoManager
.
videoSource
)
if
(
index
>=
0
)
{
videoSource
.
currentIndex
=
index
}
}
onActivated
:
{
if
(
index
!=
-
1
)
{
currentIndex
=
index
QGroundControl
.
videoManager
.
videoSource
=
model
[
index
]
}
}
FactComboBox
{
id
:
videoSource
width
:
_editFieldWidth
indexModel
:
false
fact
:
QGroundControl
.
settingsManager
.
videoSettings
.
videoSource
}
}
Row
{
spacing
:
ScreenTools
.
defaultFontPixelWidth
visible
:
QGroundControl
.
videoManager
.
isGStreamer
&&
videoSource
.
currentIndex
===
0
visible
:
QGroundControl
.
settingsManager
.
videoSettings
.
udpPort
.
visible
&&
QGroundControl
.
videoManager
.
isGStreamer
&&
videoSource
.
currentIndex
===
0
QGCLabel
{
anchors.baseline
:
udpField
.
baseline
text
:
qsTr
(
"
UDP Port:
"
)
width
:
_labelWidth
}
QGC
TextField
{
Fact
TextField
{
id
:
udpField
width
:
_editFieldWidth
text
:
QGroundControl
.
videoManager
.
udpPort
validator
:
IntValidator
{
bottom
:
1024
;
top
:
65535
;}
inputMethodHints
:
Qt
.
ImhDigitsOnly
onEditingFinished
:
{
QGroundControl
.
videoManager
.
udpPort
=
parseInt
(
text
)
}
fact
:
QGroundControl
.
settingsManager
.
videoSettings
.
udpPort
}
}
Row
{
spacing
:
ScreenTools
.
defaultFontPixelWidth
visible
:
QGroundControl
.
videoManager
.
isGStreamer
&&
videoSource
.
currentIndex
===
1
visible
:
QGroundControl
.
settingsManager
.
videoSettings
.
rtspUrl
.
visible
&&
QGroundControl
.
videoManager
.
isGStreamer
&&
videoSource
.
currentIndex
===
1
QGCLabel
{
anchors.baseline
:
rtspField
.
baseline
text
:
qsTr
(
"
RTSP URL:
"
)
width
:
_labelWidth
}
QGC
TextField
{
Fact
TextField
{
id
:
rtspField
width
:
_editFieldWidth
text
:
QGroundControl
.
videoManager
.
rtspURL
onEditingFinished
:
{
QGroundControl
.
videoManager
.
rtspURL
=
text
}
fact
:
QGroundControl
.
settingsManager
.
videoSettings
.
rtspUrl
}
}
Row
{
spacing
:
ScreenTools
.
defaultFontPixelWidth
visible
:
QGroundControl
.
videoManager
.
isGStreamer
&&
QGroundControl
.
videoManager
.
recordingEnabled
visible
:
QGroundControl
.
settingsManager
.
videoSettings
.
videoSavePath
.
visible
&&
QGroundControl
.
videoManager
.
isGStreamer
&&
QGroundControl
.
videoManager
.
recordingEnabled
QGCLabel
{
anchors.baseline
:
pathField
.
baseline
text
:
qsTr
(
"
Save Path:
"
)
width
:
_labelWidth
}
QGC
TextField
{
Fact
TextField
{
id
:
pathField
width
:
_editFieldWidth
readOnly
:
true
text
:
QGroundControl
.
videoManager
.
videoSavePath
fact
:
QGroundControl
.
settingsManager
.
videoSettings
.
videoSavePath
}
QGCButton
{
text
:
"
Browse
"
...
...
@@ -541,13 +525,12 @@ QGCView {
title
:
"
Choose a location to save video files.
"
folder
:
shortcuts
.
home
selectFolder
:
true
onAccepted
:
QGroundControl
.
videoManager
.
setVideoSavePathByUrl
(
f
ileDialog
.
fileUrl
)
onAccepted
:
QGroundControl
.
settingsManager
.
videoSettings
.
videoSavePath
.
value
=
QGroundControl
.
urlToLocalFile
(
videoLocationF
ileDialog
.
fileUrl
)
}
}
}
}
}
}
// Video Source - Rectangle
QGCLabel
{
anchors.horizontalCenter
:
parent
.
horizontalCenter
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment