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
05c8fde3
Commit
05c8fde3
authored
Jan 04, 2017
by
Jacob Walser
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add button in general settings to select location to save video files
parent
ac4080a1
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
72 additions
and
7 deletions
+72
-7
VideoManager.cc
src/FlightDisplay/VideoManager.cc
+14
-0
VideoManager.h
src/FlightDisplay/VideoManager.h
+5
-0
VideoReceiver.cc
src/VideoStreaming/VideoReceiver.cc
+15
-2
VideoReceiver.h
src/VideoStreaming/VideoReceiver.h
+7
-5
GeneralSettings.qml
src/ui/preferences/GeneralSettings.qml
+31
-0
No files found.
src/FlightDisplay/VideoManager.cc
View file @
05c8fde3
...
...
@@ -27,6 +27,7 @@
static
const
char
*
kVideoSourceKey
=
"VideoSource"
;
static
const
char
*
kVideoUDPPortKey
=
"VideoUDPPort"
;
static
const
char
*
kVideoRTSPUrlKey
=
"VideoRTSPUrl"
;
static
const
char
*
kVideoSavePathKey
=
"VideoSaveDir"
;
#if defined(QGC_GST_STREAMING)
static
const
char
*
kUDPStream
=
"UDP Video Stream"
;
static
const
char
*
kRTSPStream
=
"RTSP Video Stream"
;
...
...
@@ -80,6 +81,7 @@ 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
}
setVideoSavePath
(
settings
.
value
(
kVideoSavePathKey
,
QDir
::
homePath
()).
toString
());
#endif
_init
=
true
;
#if defined(QGC_GST_STREAMING)
...
...
@@ -186,6 +188,17 @@ VideoManager::setRtspURL(QString url)
*/
}
void
VideoManager
::
setVideoSavePath
(
QString
path
)
{
_videoSavePath
=
path
;
QSettings
settings
;
settings
.
setValue
(
kVideoSavePathKey
,
path
);
if
(
_videoReceiver
)
_videoReceiver
->
setVideoSavePath
(
_videoSavePath
);
emit
videoSavePathChanged
();
}
//-----------------------------------------------------------------------------
QStringList
VideoManager
::
videoSourceList
()
...
...
@@ -265,6 +278,7 @@ void VideoManager::_updateVideo()
_videoReceiver
->
setUri
(
QStringLiteral
(
"udp://0.0.0.0:%1"
).
arg
(
_udpPort
));
else
_videoReceiver
->
setUri
(
_rtspURL
);
_videoReceiver
->
setVideoSavePath
(
_videoSavePath
);
#endif
_videoReceiver
->
start
();
}
...
...
src/FlightDisplay/VideoManager.h
View file @
05c8fde3
...
...
@@ -37,6 +37,7 @@ public:
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
WRITE
setVideoSavePath
NOTIFY
videoSavePathChanged
)
Q_PROPERTY
(
bool
uvcEnabled
READ
uvcEnabled
CONSTANT
)
Q_PROPERTY
(
VideoSurface
*
videoSurface
MEMBER
_videoSurface
CONSTANT
)
Q_PROPERTY
(
VideoReceiver
*
videoReceiver
MEMBER
_videoReceiver
CONSTANT
)
...
...
@@ -49,6 +50,7 @@ public:
QStringList
videoSourceList
();
quint16
udpPort
()
{
return
_udpPort
;
}
QString
rtspURL
()
{
return
_rtspURL
;
}
QString
videoSavePath
()
{
return
_videoSavePath
;
}
#if defined(QGC_DISABLE_UVC)
bool
uvcEnabled
()
{
return
false
;
}
...
...
@@ -59,6 +61,7 @@ public:
void
setVideoSource
(
QString
vSource
);
void
setUdpPort
(
quint16
port
);
void
setRtspURL
(
QString
url
);
void
setVideoSavePath
(
QString
path
);
// Override from QGCTool
void
setToolbox
(
QGCToolbox
*
toolbox
);
...
...
@@ -72,6 +75,7 @@ signals:
void
videoSourceIDChanged
();
void
udpPortChanged
();
void
rtspURLChanged
();
void
videoSavePathChanged
();
private:
void
_updateTimer
();
...
...
@@ -89,6 +93,7 @@ private:
QStringList
_videoSourceList
;
quint16
_udpPort
;
QString
_rtspURL
;
QString
_videoSavePath
;
bool
_init
;
};
...
...
src/VideoStreaming/VideoReceiver.cc
View file @
05c8fde3
...
...
@@ -19,6 +19,7 @@
#include <QUrl>
#include <QDir>
#include <QDateTime>
#include <QSysInfo>
VideoReceiver
::
Sink
*
VideoReceiver
::
_sink
=
NULL
;
GstElement
*
VideoReceiver
::
_pipeline
=
NULL
;
...
...
@@ -127,8 +128,14 @@ void VideoReceiver::startRecording(void)
_sink
->
filesink
=
gst_element_factory_make
(
"filesink"
,
NULL
);
_sink
->
removing
=
false
;
QString
filename
=
QDir
::
homePath
()
+
"/"
+
QDateTime
::
currentDateTime
().
toString
()
+
".mkv"
;
g_object_set
(
G_OBJECT
(
_sink
->
filesink
),
"location"
,
qPrintable
(
filename
),
NULL
);
QString
fileName
;
if
(
QSysInfo
::
WindowsVersion
!=
QSysInfo
::
WV_None
)
{
fileName
=
_path
+
"
\\
QGC-"
+
QDateTime
::
currentDateTime
().
toString
(
"yyyy-MM-dd-hh:mm:ss"
)
+
".mkv"
;
}
else
{
fileName
=
_path
+
"/QGC-"
+
QDateTime
::
currentDateTime
().
toString
(
"yyyy-MM-dd-hh:mm:ss"
)
+
".mkv"
;
}
g_object_set
(
G_OBJECT
(
_sink
->
filesink
),
"location"
,
qPrintable
(
fileName
),
NULL
);
qDebug
()
<<
"New video file:"
<<
fileName
;
gst_object_ref
(
_sink
->
queue
);
gst_object_ref
(
_sink
->
mux
);
...
...
@@ -482,6 +489,12 @@ void VideoReceiver::setUri(const QString & uri)
_uri
=
uri
;
}
void
VideoReceiver
::
setVideoSavePath
(
const
QString
&
path
)
{
_path
=
path
;
qDebug
()
<<
"New Path:"
<<
_path
;
}
#if defined(QGC_GST_STREAMING)
void
VideoReceiver
::
_onBusMessage
(
GstMessage
*
msg
)
{
...
...
src/VideoStreaming/VideoReceiver.h
View file @
05c8fde3
...
...
@@ -47,11 +47,12 @@ signals:
void
streamingChanged
();
public
slots
:
void
start
();
void
stop
();
void
setUri
(
const
QString
&
uri
);
void
stopRecording
();
void
startRecording
();
void
start
();
void
stop
();
void
setUri
(
const
QString
&
uri
);
void
setVideoSavePath
(
const
QString
&
path
);
void
stopRecording
();
void
startRecording
();
private
slots
:
#if defined(QGC_GST_STREAMING)
...
...
@@ -85,6 +86,7 @@ private:
#endif
QString
_uri
;
QString
_path
;
#if defined(QGC_GST_STREAMING)
static
GstElement
*
_pipeline
;
...
...
src/ui/preferences/GeneralSettings.qml
View file @
05c8fde3
...
...
@@ -41,6 +41,18 @@ QGCView {
QGCPalette
{
id
:
qgcPal
}
FileDialog
{
id
:
fileDialog
title
:
"
Choose a location to save video files.
"
folder
:
shortcuts
.
home
selectFolder
:
true
onAccepted
:
{
var
path
=
fileDialog
.
fileUrl
.
toString
();
path
=
path
.
replace
(
/^
(
file:
\/{2})
/
,
""
);
QGroundControl
.
videoManager
.
videoSavePath
=
path
}
}
QGCViewPanel
{
id
:
panel
anchors.fill
:
parent
...
...
@@ -499,6 +511,25 @@ QGCView {
}
}
}
Row
{
spacing
:
ScreenTools
.
defaultFontPixelWidth
visible
:
QGroundControl
.
videoManager
.
isGStreamer
QGCLabel
{
anchors.baseline
:
pathField
.
baseline
text
:
qsTr
(
"
Save Path:
"
)
width
:
_labelWidth
}
QGCTextField
{
id
:
pathField
width
:
_editFieldWidth
readOnly
:
true
text
:
QGroundControl
.
videoManager
.
videoSavePath
}
Button
{
text
:
"
Browse
"
onClicked
:
fileDialog
.
visible
=
true
}
}
}
}
...
...
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