Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
U
uvcengine
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
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
Thiago Santini
uvcengine
Commits
e5cd3b33
Commit
e5cd3b33
authored
Apr 03, 2018
by
Thiago Santini
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Handles cameras with same id, vendor, serial
parent
37feab74
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
24 additions
and
20 deletions
+24
-20
uvccamerasession.cpp
uvcengine/uvccamerasession.cpp
+3
-17
uvccamerasession.h
uvcengine/uvccamerasession.h
+17
-1
uvcvideodevicecontrol.cpp
uvcengine/uvcvideodevicecontrol.cpp
+4
-2
No files found.
uvcengine/uvccamerasession.cpp
View file @
e5cd3b33
...
...
@@ -120,6 +120,7 @@ bool UVCCameraSession::setDevice(const QString &device)
return
false
;
}
ProductFactory
pf
;
bool
ret
=
false
;
int
idx
=
0
;
while
(
1
)
{
...
...
@@ -133,7 +134,7 @@ bool UVCCameraSession::setDevice(const QString &device)
qWarning
()
<<
"uvc_get_device_descriptor"
<<
uvc_strerror
(
res
);
return
false
;
}
QString
product
(
desc
->
product
);
QString
product
=
pf
.
make
(
desc
);
uvc_free_device_descriptor
(
desc
);
if
(
product
.
compare
(
device
)
==
0
)
{
...
...
@@ -316,27 +317,12 @@ bool UVCCameraSession::startPreview()
double
UVCCameraSession
::
getBandwidthFactor
()
{
/*
* This really is the bpp. For reference see:
* https://msdn.microsoft.com/en-us/library/windows/desktop/dd206750%28v=vs.85%29.aspx?f=255&MSPPError=-2147217396
*
* In general:
* 4:4:4 Formats, 32 Bits per Pixel
* 4:2:2 Formats, 16 Bits per Pixel
* 4:2:0 Formats, 16 Bits per Pixel
* 4:2:0 Formats, 12 Bits per Pixel
*/
switch
(
settings
.
pixelFormat
())
{
// compressed; user can change it through the default settings
case
QVideoFrame
:
:
Format_Jpeg
:
return
bandwidthFactor
;
// 4:2:2
case
QVideoFrame
:
:
Format_YUYV
:
case
QVideoFrame
:
:
Format_UYVY
:
return
2
;
// assume worst case if we don't know it
default:
return
4.0
;
return
-
1
;
// use hw estimation
}
}
...
...
uvcengine/uvccamerasession.h
View file @
e5cd3b33
...
...
@@ -49,6 +49,22 @@ struct DefaultParameters {
int
hue_auto
;
};
class
ProductFactory
{
public:
QString
make
(
const
uvc_device_descriptor_t
*
const
desc
)
{
QString
product
(
desc
->
product
);
if
(
entries
.
contains
(
product
))
{
entries
[
product
]
+=
1
;
product
=
QString
(
"%1 #%2"
).
arg
(
product
).
arg
(
entries
[
product
]);
}
else
entries
[
product
]
=
0
;
return
product
;
}
private:
QMap
<
QString
,
int
>
entries
;
};
class
UVCCameraSession
:
public
QObject
{
Q_OBJECT
...
...
@@ -166,7 +182,7 @@ private:
static
QMutex
sessionMutex
;
// device availability
static
QMap
<
QString
,
bool
>
UVCCameraSession
::
devices
;
static
QMap
<
QString
,
bool
>
devices
;
static
QMutex
UVCCameraSession
::
devicesMutex
;
bool
acquire
(
const
QString
&
device
);
void
release
(
const
QString
&
device
);
...
...
uvcengine/uvcvideodevicecontrol.cpp
View file @
e5cd3b33
...
...
@@ -101,6 +101,7 @@ void UVCVideoDeviceControl::updateDevices()
return
;
}
ProductFactory
pf
;
int
idx
=
0
;
while
(
1
)
{
uvc_device_t
*
dev
=
devList
[
idx
];
...
...
@@ -119,8 +120,9 @@ void UVCVideoDeviceControl::updateDevices()
UVCVideoDeviceInfo
devInfo
;
devInfo
.
first
=
QString
(
desc
->
product
).
toUtf8
();
devInfo
.
second
=
QString
(
desc
->
product
).
toUtf8
();
QString
product
=
pf
.
make
(
desc
);
devInfo
.
first
=
QString
(
product
).
toUtf8
();
devInfo
.
second
=
QString
(
product
).
toUtf8
();
deviceList
->
append
(
devInfo
);
...
...
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