Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Valentin Platzgummer
qgroundcontrol
Commits
2037cdcd
Commit
2037cdcd
authored
Jan 02, 2018
by
Gus Grubba
Browse files
Allow setting a path and filename for the recorded video (optional)
parent
35743f65
Changes
2
Hide whitespace changes
Inline
Side-by-side
src/VideoStreaming/VideoReceiver.cc
View file @
2037cdcd
...
...
@@ -609,7 +609,7 @@ VideoReceiver::_cleanupOldVideos()
// | |
// +--------------------------------------+
void
VideoReceiver
::
startRecording
(
void
)
VideoReceiver
::
startRecording
(
const
QString
&
videoFile
)
{
#if defined(QGC_GST_STREAMING)
...
...
@@ -620,12 +620,6 @@ VideoReceiver::startRecording(void)
return
;
}
QString
savePath
=
qgcApp
()
->
toolbox
()
->
settingsManager
()
->
appSettings
()
->
videoSavePath
();
if
(
savePath
.
isEmpty
())
{
qgcApp
()
->
showMessage
(
tr
(
"Unabled to record video. Video save path must be specified in Settings."
));
return
;
}
uint32_t
muxIdx
=
_videoSettings
->
recordingFormat
()
->
rawValue
().
toUInt
();
if
(
muxIdx
>=
NUM_MUXES
)
{
qgcApp
()
->
showMessage
(
tr
(
"Invalid video format defined."
));
...
...
@@ -648,11 +642,20 @@ VideoReceiver::startRecording(void)
return
;
}
QString
videoFile
;
videoFile
=
savePath
+
"/"
+
QDateTime
::
currentDateTime
().
toString
(
"yyyy-MM-dd_hh.mm.ss"
)
+
"."
+
kVideoExtensions
[
muxIdx
];
if
(
videoFile
.
isEmpty
())
{
QString
savePath
=
qgcApp
()
->
toolbox
()
->
settingsManager
()
->
appSettings
()
->
videoSavePath
();
if
(
savePath
.
isEmpty
())
{
qgcApp
()
->
showMessage
(
tr
(
"Unabled to record video. Video save path must be specified in Settings."
));
return
;
}
_videoFile
=
savePath
+
"/"
+
QDateTime
::
currentDateTime
().
toString
(
"yyyy-MM-dd_hh.mm.ss"
)
+
"."
+
kVideoExtensions
[
muxIdx
];
}
else
{
_videoFile
=
videoFile
;
}
emit
videoFileChanged
();
g_object_set
(
G_OBJECT
(
_sink
->
filesink
),
"location"
,
qPrintable
(
videoFile
),
NULL
);
qCDebug
(
VideoReceiverLog
)
<<
"New video file:"
<<
videoFile
;
g_object_set
(
G_OBJECT
(
_sink
->
filesink
),
"location"
,
qPrintable
(
_
videoFile
),
NULL
);
qCDebug
(
VideoReceiverLog
)
<<
"New video file:"
<<
_
videoFile
;
gst_object_ref
(
_sink
->
queue
);
gst_object_ref
(
_sink
->
parse
);
...
...
src/VideoStreaming/VideoReceiver.h
View file @
2037cdcd
...
...
@@ -42,6 +42,7 @@ public:
Q_PROPERTY
(
VideoSurface
*
videoSurface
READ
videoSurface
CONSTANT
)
Q_PROPERTY
(
bool
videoRunning
READ
videoRunning
NOTIFY
videoRunningChanged
)
Q_PROPERTY
(
QString
imageFile
READ
imageFile
NOTIFY
imageFileChanged
)
Q_PROPERTY
(
QString
videoFile
READ
videoFile
NOTIFY
videoFileChanged
)
Q_PROPERTY
(
bool
showFullScreen
READ
showFullScreen
WRITE
setShowFullScreen
NOTIFY
showFullScreenChanged
)
explicit
VideoReceiver
(
QObject
*
parent
=
0
);
...
...
@@ -58,6 +59,7 @@ public:
VideoSurface
*
videoSurface
()
{
return
_videoSurface
;
}
bool
videoRunning
()
{
return
_videoRunning
;
}
QString
imageFile
()
{
return
_imageFile
;
}
QString
videoFile
()
{
return
_videoFile
;
}
bool
showFullScreen
()
{
return
_showFullScreen
;
}
void
grabImage
(
QString
imageFile
);
...
...
@@ -67,6 +69,7 @@ public:
signals:
void
videoRunningChanged
();
void
imageFileChanged
();
void
videoFileChanged
();
void
showFullScreenChanged
();
#if defined(QGC_GST_STREAMING)
void
recordingChanged
();
...
...
@@ -80,7 +83,7 @@ public slots:
void
stop
();
void
setUri
(
const
QString
&
uri
);
void
stopRecording
();
void
startRecording
();
void
startRecording
(
const
QString
&
videoFile
=
QString
()
);
private
slots
:
void
_updateTimer
();
...
...
@@ -136,6 +139,7 @@ private:
QString
_uri
;
QString
_imageFile
;
QString
_videoFile
;
VideoSurface
*
_videoSurface
;
bool
_videoRunning
;
bool
_showFullScreen
;
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new 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