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
5766d7df
Commit
5766d7df
authored
Feb 02, 2017
by
Gus Grubba
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Allow disabling video recording
parent
78711fb9
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
57 additions
and
21 deletions
+57
-21
FlightDisplayView.qml
src/FlightDisplay/FlightDisplayView.qml
+1
-1
VideoManager.cc
src/FlightDisplay/VideoManager.cc
+19
-4
VideoManager.h
src/FlightDisplay/VideoManager.h
+19
-12
VideoReceiver.cc
src/VideoStreaming/VideoReceiver.cc
+8
-3
VideoStreaming.pri
src/VideoStreaming/VideoStreaming.pri
+9
-0
GeneralSettings.qml
src/ui/preferences/GeneralSettings.qml
+1
-1
No files found.
src/FlightDisplay/FlightDisplayView.qml
View file @
5766d7df
...
...
@@ -268,7 +268,7 @@ QGCView {
anchors.right
:
_flightVideo
.
right
height
:
ScreenTools
.
defaultFontPixelHeight
*
2
width
:
height
visible
:
QGroundControl
.
videoManager
.
videoRunning
visible
:
QGroundControl
.
videoManager
.
videoRunning
&&
QGroundControl
.
videoManager
.
recordingEnabled
opacity
:
0.75
Rectangle
{
...
...
src/FlightDisplay/VideoManager.cc
View file @
5766d7df
...
...
@@ -29,12 +29,15 @@
static
const
char
*
kVideoSourceKey
=
"VideoSource"
;
static
const
char
*
kVideoUDPPortKey
=
"VideoUDPPort"
;
static
const
char
*
kVideoRTSPUrlKey
=
"VideoRTSPUrl"
;
static
const
char
*
kVideoSavePathKey
=
"VideoSavePath"
;
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
static
const
char
*
kNoVideo
=
"No Video Available"
;
QGC_LOGGING_CATEGORY
(
VideoManagerLog
,
"VideoManagerLog"
)
...
...
@@ -83,7 +86,9 @@ VideoManager::setToolbox(QGCToolbox *toolbox)
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
());
#endif
#endif
_init
=
true
;
#if defined(QGC_GST_STREAMING)
...
...
@@ -192,18 +197,26 @@ VideoManager::setRtspURL(QString url)
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
}
//-----------------------------------------------------------------------------
...
...
@@ -277,14 +290,16 @@ void VideoManager::_updateVideo()
delete
_videoSurface
;
_videoSurface
=
new
VideoSurface
;
_videoReceiver
=
new
VideoReceiver
(
this
);
#if defined(QGC_GST_STREAMING)
#if defined(QGC_GST_STREAMING)
_videoReceiver
->
setVideoSink
(
_videoSurface
->
videoSink
());
if
(
_videoSource
==
kUDPStream
)
_videoReceiver
->
setUri
(
QStringLiteral
(
"udp://0.0.0.0:%1"
).
arg
(
_udpPort
));
else
_videoReceiver
->
setUri
(
_rtspURL
);
#if defined(QGC_ENABLE_VIDEORECORDING)
_videoReceiver
->
setVideoSavePath
(
_videoSavePath
);
#endif
#endif
#endif
_videoReceiver
->
start
();
}
}
src/FlightDisplay/VideoManager.h
View file @
5766d7df
...
...
@@ -30,18 +30,19 @@ public:
VideoManager
(
QGCApplication
*
app
);
~
VideoManager
();
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
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
);
...
...
@@ -61,6 +62,12 @@ public:
bool
uvcEnabled
();
#endif
#if defined(QGC_GST_STREAMING) && defined(QGC_ENABLE_VIDEORECORDING)
bool
recordingEnabled
()
{
return
true
;
}
#else
bool
recordingEnabled
()
{
return
false
;
}
#endif
void
setVideoSource
(
QString
vSource
);
void
setUdpPort
(
quint16
port
);
void
setRtspURL
(
QString
url
);
...
...
src/VideoStreaming/VideoReceiver.cc
View file @
5766d7df
...
...
@@ -346,10 +346,14 @@ void VideoReceiver::setUri(const QString & uri)
_uri
=
uri
;
}
void
VideoReceiver
::
setVideoSavePath
(
const
QString
&
path
)
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)
...
...
@@ -452,7 +456,8 @@ gboolean VideoReceiver::_onBusMessage(GstBus* bus, GstMessage* msg, gpointer dat
// +--------------------------------------+
void
VideoReceiver
::
startRecording
(
void
)
{
#if defined(QGC_GST_STREAMING)
#if defined(QGC_GST_STREAMING) && defined(QGC_ENABLE_VIDEORECORDING)
qCDebug
(
VideoReceiverLog
)
<<
"startRecording()"
;
// exit immediately if we are already recording
if
(
_pipeline
==
NULL
||
_recording
)
{
...
...
@@ -506,7 +511,7 @@ void VideoReceiver::startRecording(void)
void
VideoReceiver
::
stopRecording
(
void
)
{
#if defined(QGC_GST_STREAMING)
#if defined(QGC_GST_STREAMING)
&& defined(QGC_ENABLE_VIDEORECORDING)
qCDebug
(
VideoReceiverLog
)
<<
"stopRecording()"
;
// exit immediately if we are not recording
if
(
_pipeline
==
NULL
||
!
_recording
)
{
...
...
src/VideoStreaming/VideoStreaming.pri
View file @
5766d7df
...
...
@@ -120,6 +120,15 @@ VideoEnabled {
message("Including support for video streaming")
contains (CONFIG, DISABLE_VIDEORECORDING) {
message("Skipping support for video recording (manual override from command line)")
# Otherwise the user can still disable this feature in the user_config.pri file.
} else:exists($$BASEDIR/user_config.pri):infile($$BASEDIR/user_config.pri, DEFINES, DISABLE_VIDEORECORDING) {
message("Skipping support for video recording (manual override from user_config.pri)")
} else {
DEFINES += QGC_ENABLE_VIDEORECORDING
}
DEFINES += \
QGC_GST_STREAMING \
GST_PLUGIN_BUILD_STATIC \
...
...
src/ui/preferences/GeneralSettings.qml
View file @
5766d7df
...
...
@@ -535,7 +535,7 @@ QGCView {
}
Row
{
spacing
:
ScreenTools
.
defaultFontPixelWidth
visible
:
QGroundControl
.
videoManager
.
isGStreamer
visible
:
QGroundControl
.
videoManager
.
isGStreamer
&&
QGroundControl
.
videoManager
.
recordingEnabled
QGCLabel
{
anchors.baseline
:
pathField
.
baseline
text
:
qsTr
(
"
Save Path:
"
)
...
...
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