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
6d83c57d
Commit
6d83c57d
authored
Oct 20, 2017
by
Don Gagne
Committed by
GitHub
Oct 20, 2017
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #5729 from bluerobotics/pr-video-limit
Add option to disable video auto-delete
parents
bef3967b
df78b98d
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
69 additions
and
28 deletions
+69
-28
Video.SettingsGroup.json
src/Settings/Video.SettingsGroup.json
+10
-1
VideoSettings.cc
src/Settings/VideoSettings.cc
+11
-0
VideoSettings.h
src/Settings/VideoSettings.h
+4
-0
VideoReceiver.cc
src/VideoStreaming/VideoReceiver.cc
+29
-26
GeneralSettings.qml
src/ui/preferences/GeneralSettings.qml
+15
-1
No files found.
src/Settings/Video.SettingsGroup.json
View file @
6d83c57d
...
@@ -75,7 +75,16 @@
...
@@ -75,7 +75,16 @@
"type"
:
"uint32"
,
"type"
:
"uint32"
,
"min"
:
100
,
"min"
:
100
,
"units"
:
"MB"
,
"units"
:
"MB"
,
"defaultValue"
:
2048
"defaultValue"
:
10240
,
"mobileDefaultValue"
:
2048
},
{
"name"
:
"EnableStorageLimit"
,
"shortDescription"
:
"Enable/Disable Limits on Storage Usage"
,
"longDescription"
:
"When enabled, old video files will be auto-deleted when the total size of QGC-recorded video exceeds the maximum video storage usage."
,
"type"
:
"bool"
,
"defaultValue"
:
false
,
"mobileDefaultValue"
:
true
},
},
{
{
"name"
:
"RtspTimeout"
,
"name"
:
"RtspTimeout"
,
...
...
src/Settings/VideoSettings.cc
View file @
6d83c57d
...
@@ -28,6 +28,7 @@ const char* VideoSettings::videoGridLinesName = "VideoGridLines";
...
@@ -28,6 +28,7 @@ const char* VideoSettings::videoGridLinesName = "VideoGridLines";
const
char
*
VideoSettings
::
showRecControlName
=
"ShowRecControl"
;
const
char
*
VideoSettings
::
showRecControlName
=
"ShowRecControl"
;
const
char
*
VideoSettings
::
recordingFormatName
=
"RecordingFormat"
;
const
char
*
VideoSettings
::
recordingFormatName
=
"RecordingFormat"
;
const
char
*
VideoSettings
::
maxVideoSizeName
=
"MaxVideoSize"
;
const
char
*
VideoSettings
::
maxVideoSizeName
=
"MaxVideoSize"
;
const
char
*
VideoSettings
::
enableStorageLimitName
=
"EnableStorageLimit"
;
const
char
*
VideoSettings
::
rtspTimeoutName
=
"RtspTimeout"
;
const
char
*
VideoSettings
::
rtspTimeoutName
=
"RtspTimeout"
;
const
char
*
VideoSettings
::
videoSourceNoVideo
=
"No Video Available"
;
const
char
*
VideoSettings
::
videoSourceNoVideo
=
"No Video Available"
;
...
@@ -47,6 +48,7 @@ VideoSettings::VideoSettings(QObject* parent)
...
@@ -47,6 +48,7 @@ VideoSettings::VideoSettings(QObject* parent)
,
_showRecControlFact
(
NULL
)
,
_showRecControlFact
(
NULL
)
,
_recordingFormatFact
(
NULL
)
,
_recordingFormatFact
(
NULL
)
,
_maxVideoSizeFact
(
NULL
)
,
_maxVideoSizeFact
(
NULL
)
,
_enableStorageLimitFact
(
NULL
)
,
_rtspTimeoutFact
(
NULL
)
,
_rtspTimeoutFact
(
NULL
)
{
{
QQmlEngine
::
setObjectOwnership
(
this
,
QQmlEngine
::
CppOwnership
);
QQmlEngine
::
setObjectOwnership
(
this
,
QQmlEngine
::
CppOwnership
);
...
@@ -169,6 +171,15 @@ Fact* VideoSettings::maxVideoSize(void)
...
@@ -169,6 +171,15 @@ Fact* VideoSettings::maxVideoSize(void)
return
_maxVideoSizeFact
;
return
_maxVideoSizeFact
;
}
}
Fact
*
VideoSettings
::
enableStorageLimit
(
void
)
{
if
(
!
_enableStorageLimitFact
)
{
_enableStorageLimitFact
=
_createSettingsFact
(
enableStorageLimitName
);
}
return
_enableStorageLimitFact
;
}
Fact
*
VideoSettings
::
rtspTimeout
(
void
)
Fact
*
VideoSettings
::
rtspTimeout
(
void
)
{
{
if
(
!
_rtspTimeoutFact
)
{
if
(
!
_rtspTimeoutFact
)
{
...
...
src/Settings/VideoSettings.h
View file @
6d83c57d
...
@@ -28,6 +28,7 @@ public:
...
@@ -28,6 +28,7 @@ public:
Q_PROPERTY
(
Fact
*
showRecControl
READ
showRecControl
CONSTANT
)
Q_PROPERTY
(
Fact
*
showRecControl
READ
showRecControl
CONSTANT
)
Q_PROPERTY
(
Fact
*
recordingFormat
READ
recordingFormat
CONSTANT
)
Q_PROPERTY
(
Fact
*
recordingFormat
READ
recordingFormat
CONSTANT
)
Q_PROPERTY
(
Fact
*
maxVideoSize
READ
maxVideoSize
CONSTANT
)
Q_PROPERTY
(
Fact
*
maxVideoSize
READ
maxVideoSize
CONSTANT
)
Q_PROPERTY
(
Fact
*
enableStorageLimit
READ
enableStorageLimit
CONSTANT
)
Q_PROPERTY
(
Fact
*
rtspTimeout
READ
rtspTimeout
CONSTANT
)
Q_PROPERTY
(
Fact
*
rtspTimeout
READ
rtspTimeout
CONSTANT
)
Fact
*
videoSource
(
void
);
Fact
*
videoSource
(
void
);
...
@@ -39,6 +40,7 @@ public:
...
@@ -39,6 +40,7 @@ public:
Fact
*
showRecControl
(
void
);
Fact
*
showRecControl
(
void
);
Fact
*
recordingFormat
(
void
);
Fact
*
recordingFormat
(
void
);
Fact
*
maxVideoSize
(
void
);
Fact
*
maxVideoSize
(
void
);
Fact
*
enableStorageLimit
(
void
);
Fact
*
rtspTimeout
(
void
);
Fact
*
rtspTimeout
(
void
);
static
const
char
*
videoSettingsGroupName
;
static
const
char
*
videoSettingsGroupName
;
...
@@ -52,6 +54,7 @@ public:
...
@@ -52,6 +54,7 @@ public:
static
const
char
*
showRecControlName
;
static
const
char
*
showRecControlName
;
static
const
char
*
recordingFormatName
;
static
const
char
*
recordingFormatName
;
static
const
char
*
maxVideoSizeName
;
static
const
char
*
maxVideoSizeName
;
static
const
char
*
enableStorageLimitName
;
static
const
char
*
rtspTimeoutName
;
static
const
char
*
rtspTimeoutName
;
static
const
char
*
videoSourceNoVideo
;
static
const
char
*
videoSourceNoVideo
;
...
@@ -70,6 +73,7 @@ private:
...
@@ -70,6 +73,7 @@ private:
SettingsFact
*
_showRecControlFact
;
SettingsFact
*
_showRecControlFact
;
SettingsFact
*
_recordingFormatFact
;
SettingsFact
*
_recordingFormatFact
;
SettingsFact
*
_maxVideoSizeFact
;
SettingsFact
*
_maxVideoSizeFact
;
SettingsFact
*
_enableStorageLimitFact
;
SettingsFact
*
_rtspTimeoutFact
;
SettingsFact
*
_rtspTimeoutFact
;
};
};
...
...
src/VideoStreaming/VideoReceiver.cc
View file @
6d83c57d
...
@@ -549,33 +549,36 @@ VideoReceiver::_onBusMessage(GstBus* bus, GstMessage* msg, gpointer data)
...
@@ -549,33 +549,36 @@ VideoReceiver::_onBusMessage(GstBus* bus, GstMessage* msg, gpointer data)
void
void
VideoReceiver
::
_cleanupOldVideos
()
VideoReceiver
::
_cleanupOldVideos
()
{
{
QString
savePath
=
qgcApp
()
->
toolbox
()
->
settingsManager
()
->
appSettings
()
->
videoSavePath
();
//-- Only perform cleanup if storage limit is enabled
QDir
videoDir
=
QDir
(
savePath
);
if
(
qgcApp
()
->
toolbox
()
->
settingsManager
()
->
videoSettings
()
->
enableStorageLimit
()
->
rawValue
().
toBool
())
{
videoDir
.
setFilter
(
QDir
::
Files
|
QDir
::
Readable
|
QDir
::
NoSymLinks
|
QDir
::
Writable
);
QString
savePath
=
qgcApp
()
->
toolbox
()
->
settingsManager
()
->
appSettings
()
->
videoSavePath
();
videoDir
.
setSorting
(
QDir
::
Time
);
QDir
videoDir
=
QDir
(
savePath
);
//-- All the movie extensions we support
videoDir
.
setFilter
(
QDir
::
Files
|
QDir
::
Readable
|
QDir
::
NoSymLinks
|
QDir
::
Writable
);
QStringList
nameFilters
;
videoDir
.
setSorting
(
QDir
::
Time
);
for
(
uint32_t
i
=
0
;
i
<
NUM_MUXES
;
i
++
)
{
//-- All the movie extensions we support
nameFilters
<<
QString
(
"*."
)
+
QString
(
kVideoExtensions
[
i
]);
QStringList
nameFilters
;
}
for
(
uint32_t
i
=
0
;
i
<
NUM_MUXES
;
i
++
)
{
videoDir
.
setNameFilters
(
nameFilters
);
nameFilters
<<
QString
(
"*."
)
+
QString
(
kVideoExtensions
[
i
]);
//-- get the list of videos stored
QFileInfoList
vidList
=
videoDir
.
entryInfoList
();
if
(
!
vidList
.
isEmpty
())
{
uint64_t
total
=
0
;
//-- Settings are stored using MB
uint64_t
maxSize
=
(
qgcApp
()
->
toolbox
()
->
settingsManager
()
->
videoSettings
()
->
maxVideoSize
()
->
rawValue
().
toUInt
()
*
1024
*
1024
);
//-- Compute total used storage
for
(
int
i
=
0
;
i
<
vidList
.
size
();
i
++
)
{
total
+=
vidList
[
i
].
size
();
}
}
//-- Remove old movies until max size is satisfied.
videoDir
.
setNameFilters
(
nameFilters
);
while
(
total
>=
maxSize
&&
!
vidList
.
isEmpty
())
{
//-- get the list of videos stored
total
-=
vidList
.
last
().
size
();
QFileInfoList
vidList
=
videoDir
.
entryInfoList
();
qCDebug
(
VideoReceiverLog
)
<<
"Removing old video file:"
<<
vidList
.
last
().
filePath
();
if
(
!
vidList
.
isEmpty
())
{
QFile
file
(
vidList
.
last
().
filePath
());
uint64_t
total
=
0
;
file
.
remove
();
//-- Settings are stored using MB
vidList
.
removeLast
();
uint64_t
maxSize
=
(
qgcApp
()
->
toolbox
()
->
settingsManager
()
->
videoSettings
()
->
maxVideoSize
()
->
rawValue
().
toUInt
()
*
1024
*
1024
);
//-- Compute total used storage
for
(
int
i
=
0
;
i
<
vidList
.
size
();
i
++
)
{
total
+=
vidList
[
i
].
size
();
}
//-- Remove old movies until max size is satisfied.
while
(
total
>=
maxSize
&&
!
vidList
.
isEmpty
())
{
total
-=
vidList
.
last
().
size
();
qCDebug
(
VideoReceiverLog
)
<<
"Removing old video file:"
<<
vidList
.
last
().
filePath
();
QFile
file
(
vidList
.
last
().
filePath
());
file
.
remove
();
vidList
.
removeLast
();
}
}
}
}
}
}
}
...
...
src/ui/preferences/GeneralSettings.qml
View file @
6d83c57d
...
@@ -630,7 +630,21 @@ QGCView {
...
@@ -630,7 +630,21 @@ QGCView {
anchors.centerIn
:
parent
anchors.centerIn
:
parent
Row
{
Row
{
spacing
:
ScreenTools
.
defaultFontPixelWidth
spacing
:
ScreenTools
.
defaultFontPixelWidth
visible
:
QGroundControl
.
videoManager
.
isGStreamer
&&
videoSource
.
currentIndex
&&
videoSource
.
currentIndex
<
4
&&
QGroundControl
.
settingsManager
.
videoSettings
.
maxVideoSize
.
visible
visible
:
QGroundControl
.
videoManager
.
isGStreamer
&&
videoSource
.
currentIndex
&&
videoSource
.
currentIndex
<
4
&&
QGroundControl
.
settingsManager
.
videoSettings
.
enableStorageLimit
.
visible
QGCLabel
{
text
:
qsTr
(
"
Auto-Delete Files:
"
)
width
:
_labelWidth
anchors.verticalCenter
:
parent
.
verticalCenter
}
FactCheckBox
{
text
:
""
fact
:
QGroundControl
.
settingsManager
.
videoSettings
.
enableStorageLimit
anchors.verticalCenter
:
parent
.
verticalCenter
}
}
Row
{
spacing
:
ScreenTools
.
defaultFontPixelWidth
visible
:
QGroundControl
.
videoManager
.
isGStreamer
&&
videoSource
.
currentIndex
&&
videoSource
.
currentIndex
<
4
&&
QGroundControl
.
settingsManager
.
videoSettings
.
maxVideoSize
.
visible
&&
QGroundControl
.
settingsManager
.
videoSettings
.
enableStorageLimit
.
value
QGCLabel
{
QGCLabel
{
text
:
qsTr
(
"
Max Storage Usage:
"
)
text
:
qsTr
(
"
Max Storage Usage:
"
)
width
:
_labelWidth
width
:
_labelWidth
...
...
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