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
c34a1a20
Unverified
Commit
c34a1a20
authored
Nov 21, 2018
by
Gus Grubba
Committed by
GitHub
Nov 21, 2018
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #7031 from mavlink/uvcWork
Fix UVC handling
parents
76dd261e
994712c5
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
66 additions
and
15 deletions
+66
-15
FlightDisplayViewUVC.qml
src/FlightDisplay/FlightDisplayViewUVC.qml
+23
-1
VideoManager.cc
src/FlightDisplay/VideoManager.cc
+20
-9
VideoManager.h
src/FlightDisplay/VideoManager.h
+3
-2
VideoSettings.cc
src/Settings/VideoSettings.cc
+15
-3
VideoSettings.h
src/Settings/VideoSettings.h
+5
-0
No files found.
src/FlightDisplay/FlightDisplayViewUVC.qml
View file @
c34a1a20
...
...
@@ -13,12 +13,34 @@ import QtMultimedia 5.5
import
QGroundControl
1.0
Rectangle
{
anchors.fill
:
parent
id
:
_root
width
:
parent
.
width
height
:
parent
.
height
anchors.centerIn
:
parent
color
:
Qt
.
rgba
(
0
,
0
,
0
,
0.75
)
function
adjustAspectRatio
()
{
//-- Set aspect ratio
var
size
=
camera
.
viewfinder
.
resolution
if
(
size
.
height
>
0
&&
size
.
width
>
0
)
{
var
ar
=
size
.
width
/
size
.
height
_root
.
height
=
parent
.
height
*
ar
}
}
Camera
{
id
:
camera
deviceId
:
QGroundControl
.
videoManager
.
videoSourceID
captureMode
:
Camera
.
CaptureViewfinder
onDeviceIdChanged
:
{
adjustAspectRatio
()
}
onCameraStateChanged
:
{
if
(
camera
.
cameraStatus
===
Camera
.
ActiveStatus
)
{
adjustAspectRatio
()
}
}
}
VideoOutput
{
source
:
camera
...
...
src/FlightDisplay/VideoManager.cc
View file @
c34a1a20
...
...
@@ -65,15 +65,7 @@ VideoManager::setToolbox(QGCToolbox *toolbox)
#if defined(QGC_GST_STREAMING)
#ifndef QGC_DISABLE_UVC
// If we are using a UVC camera setup the device name
QList
<
QCameraInfo
>
cameras
=
QCameraInfo
::
availableCameras
();
for
(
const
QCameraInfo
&
cameraInfo
:
cameras
)
{
if
(
cameraInfo
.
description
()
==
videoSource
)
{
_videoSourceID
=
cameraInfo
.
deviceName
();
emit
videoSourceIDChanged
();
qCDebug
(
VideoManagerLog
)
<<
"Found USB source:"
<<
_videoSourceID
<<
" Name:"
<<
videoSource
;
break
;
}
}
_updateUVC
();
#endif
emit
isGStreamerChanged
();
...
...
@@ -89,10 +81,29 @@ VideoManager::setToolbox(QGCToolbox *toolbox)
#endif
}
//-----------------------------------------------------------------------------
void
VideoManager
::
_updateUVC
()
{
#ifndef QGC_DISABLE_UVC
QString
videoSource
=
_videoSettings
->
videoSource
()
->
rawValue
().
toString
();
QList
<
QCameraInfo
>
cameras
=
QCameraInfo
::
availableCameras
();
for
(
const
QCameraInfo
&
cameraInfo
:
cameras
)
{
if
(
cameraInfo
.
description
()
==
videoSource
)
{
_videoSourceID
=
cameraInfo
.
deviceName
();
emit
videoSourceIDChanged
();
qCDebug
(
VideoManagerLog
)
<<
"Found USB source:"
<<
_videoSourceID
<<
" Name:"
<<
videoSource
;
break
;
}
}
#endif
}
//-----------------------------------------------------------------------------
void
VideoManager
::
_videoSourceChanged
()
{
_updateUVC
();
emit
hasVideoChanged
();
emit
isGStreamerChanged
();
_restartVideo
();
...
...
src/FlightDisplay/VideoManager.h
View file @
c34a1a20
...
...
@@ -56,8 +56,8 @@ public:
// Override from QGCTool
void
setToolbox
(
QGCToolbox
*
toolbox
);
Q_INVOKABLE
void
startVideo
()
{
_videoReceiver
->
start
();};
Q_INVOKABLE
void
stopVideo
()
{
_videoReceiver
->
stop
();};
Q_INVOKABLE
void
startVideo
()
{
_videoReceiver
->
start
();}
Q_INVOKABLE
void
stopVideo
()
{
_videoReceiver
->
stop
();
}
signals:
void
hasVideoChanged
();
...
...
@@ -70,6 +70,7 @@ private slots:
void
_udpPortChanged
();
void
_rtspUrlChanged
();
void
_tcpUrlChanged
();
void
_updateUVC
();
private:
void
_updateSettings
();
...
...
src/Settings/VideoSettings.cc
View file @
c34a1a20
...
...
@@ -32,7 +32,6 @@ DECLARE_SETTINGGROUP(Video, "Video")
qmlRegisterUncreatableType
<
VideoSettings
>
(
"QGroundControl.SettingsManager"
,
1
,
0
,
"VideoSettings"
,
"Reference only"
);
// Setup enum values for videoSource settings into meta data
bool
noVideo
=
false
;
QStringList
videoSourceList
;
#ifdef QGC_GST_STREAMING
#ifndef NO_UDP_VIDEO
...
...
@@ -51,7 +50,7 @@ DECLARE_SETTINGGROUP(Video, "Video")
}
#endif
if
(
videoSourceList
.
count
()
==
0
)
{
noVideo
=
true
;
_
noVideo
=
true
;
videoSourceList
.
append
(
videoSourceNoVideo
);
}
else
{
videoSourceList
.
insert
(
0
,
videoDisabled
);
...
...
@@ -63,7 +62,12 @@ DECLARE_SETTINGGROUP(Video, "Video")
_nameToMetaDataMap
[
videoSourceName
]
->
setEnumInfo
(
videoSourceList
,
videoSourceVarList
);
// Set default value for videoSource
if
(
noVideo
)
{
_setDefaults
();
}
void
VideoSettings
::
_setDefaults
()
{
if
(
_noVideo
)
{
_nameToMetaDataMap
[
videoSourceName
]
->
setRawDefaultValue
(
videoSourceNoVideo
);
}
else
{
_nameToMetaDataMap
[
videoSourceName
]
->
setRawDefaultValue
(
videoDisabled
);
...
...
@@ -85,6 +89,14 @@ DECLARE_SETTINGSFACT_NO_FUNC(VideoSettings, videoSource)
{
if
(
!
_videoSourceFact
)
{
_videoSourceFact
=
_createSettingsFact
(
videoSourceName
);
//-- Check for sources no longer available
if
(
!
_nameToMetaDataMap
.
contains
(
_videoSourceFact
->
rawValue
().
toString
()))
{
if
(
_noVideo
)
{
_videoSourceFact
->
setRawValue
(
videoSourceNoVideo
);
}
else
{
_videoSourceFact
->
setRawValue
(
videoDisabled
);
}
}
connect
(
_videoSourceFact
,
&
Fact
::
valueChanged
,
this
,
&
VideoSettings
::
_configChanged
);
}
return
_videoSourceFact
;
...
...
src/Settings/VideoSettings.h
View file @
c34a1a20
...
...
@@ -55,6 +55,11 @@ private slots:
void
_configChanged
(
QVariant
value
);
private:
void
_setDefaults
();
private:
bool
_noVideo
=
false
;
};
#endif
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