Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
U
uvcengine
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Thiago Santini
uvcengine
Commits
96f94e6b
Commit
96f94e6b
authored
Mar 09, 2018
by
Thiago Santini
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Adds exposure option
parent
98ac2765
Changes
7
Show whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
175 additions
and
3 deletions
+175
-3
uvcengine/uvccameraexposurecontrol.cpp
uvcengine/uvccameraexposurecontrol.cpp
+41
-0
uvcengine/uvccameraexposurecontrol.h
uvcengine/uvccameraexposurecontrol.h
+31
-0
uvcengine/uvccameraservice.cpp
uvcengine/uvccameraservice.cpp
+10
-1
uvcengine/uvccameraservice.h
uvcengine/uvccameraservice.h
+2
-0
uvcengine/uvccamerasession.cpp
uvcengine/uvccamerasession.cpp
+78
-0
uvcengine/uvccamerasession.h
uvcengine/uvccamerasession.h
+8
-0
uvcengine/uvcengine.pro
uvcengine/uvcengine.pro
+5
-2
No files found.
uvcengine/uvccameraexposurecontrol.cpp
0 → 100644
View file @
96f94e6b
#include "uvccameraexposurecontrol.h"
#include "uvccamerasession.h"
QT_BEGIN_NAMESPACE
UVCCameraExposureControl
::
UVCCameraExposureControl
(
UVCCameraSession
*
session
)
:
QCameraExposureControl
(
session
)
,
m_session
(
session
)
{
}
UVCCameraExposureControl
::~
UVCCameraExposureControl
()
{
}
QVariant
UVCCameraExposureControl
::
actualValue
(
ExposureParameter
parameter
)
const
{
return
m_session
->
actualExposureValue
(
parameter
);
}
bool
UVCCameraExposureControl
::
isParameterSupported
(
ExposureParameter
parameter
)
const
{
return
m_session
->
isExposureParameterSupported
(
parameter
);
}
QVariant
UVCCameraExposureControl
::
requestedValue
(
ExposureParameter
parameter
)
const
{
return
m_session
->
requestedExposureValue
(
parameter
);
}
bool
UVCCameraExposureControl
::
setValue
(
ExposureParameter
parameter
,
const
QVariant
&
value
)
{
return
m_session
->
setExposureValue
(
parameter
,
value
);
}
QVariantList
UVCCameraExposureControl
::
supportedParameterRange
(
ExposureParameter
parameter
,
bool
*
continuous
)
const
{
return
m_session
->
supportedExposureParameterRange
(
parameter
,
continuous
);
}
QT_END_NAMESPACE
uvcengine/uvccameraexposurecontrol.h
0 → 100644
View file @
96f94e6b
#ifndef UVCCAMERAEXPOSURECONTROL_H
#define UVCCAMERAEXPOSURECONTROL_H
#include <qcamera.h>
#include <qcameraexposurecontrol.h>
QT_BEGIN_NAMESPACE
class
UVCCameraSession
;
class
UVCCameraExposureControl
:
public
QCameraExposureControl
{
Q_OBJECT
public:
UVCCameraExposureControl
(
UVCCameraSession
*
session
);
virtual
~
UVCCameraExposureControl
();
QVariant
actualValue
(
ExposureParameter
parameter
)
const
;
bool
isParameterSupported
(
ExposureParameter
parameter
)
const
;
QVariant
requestedValue
(
ExposureParameter
parameter
)
const
;
bool
setValue
(
ExposureParameter
parameter
,
const
QVariant
&
value
);
QVariantList
supportedParameterRange
(
ExposureParameter
parameter
,
bool
*
continuous
)
const
;
private:
UVCCameraSession
*
m_session
;
};
QT_END_NAMESPACE
#endif // UVCCAMERAEXPOSURECONTROL_H
uvcengine/uvccameraservice.cpp
View file @
96f94e6b
...
...
@@ -8,6 +8,7 @@
#include "uvcvideorenderercontrol.h"
#include "uvccameraviewfindersettingscontrol.h"
#include "uvccameraimageprocessingcontrol.h"
#include "uvccameraexposurecontrol.h"
QT_BEGIN_NAMESPACE
...
...
@@ -20,6 +21,7 @@ UVCCameraService::UVCCameraService(QObject *parent):
m_videoDevice
=
new
UVCVideoDeviceControl
(
m_session
);
m_viewfinderSettings
=
new
UVCCameraViewfinderSettingsControl
(
m_session
);
m_imageProcessingControl
=
new
UVCCameraImageProcessingControl
(
m_session
);
m_cameraExposureControl
=
new
UVCCameraExposureControl
(
m_session
);
}
UVCCameraService
::~
UVCCameraService
()
...
...
@@ -28,6 +30,10 @@ UVCCameraService::~UVCCameraService()
delete
m_viewfinderSettings
;
delete
m_videoDevice
;
delete
m_videoRenderer
;
delete
m_imageProcessingControl
;
delete
m_cameraExposureControl
;
// session must be last since it's used by the rest
delete
m_session
;
}
...
...
@@ -52,6 +58,9 @@ QMediaControl* UVCCameraService::requestControl(const char *name)
if
(
qstrcmp
(
name
,
QCameraImageProcessingControl_iid
)
==
0
)
return
m_imageProcessingControl
;
if
(
qstrcmp
(
name
,
QCameraExposureControl_iid
)
==
0
)
return
m_cameraExposureControl
;
return
NULL
;
}
...
...
uvcengine/uvccameraservice.h
View file @
96f94e6b
...
...
@@ -12,6 +12,7 @@ class UVCVideoDeviceControl;
class
UVCVideoRendererControl
;
class
UVCCameraViewfinderSettingsControl
;
class
UVCCameraImageProcessingControl
;
class
UVCCameraExposureControl
;
class
UVCCameraService
:
public
QMediaService
{
...
...
@@ -30,6 +31,7 @@ private:
UVCVideoRendererControl
*
m_videoRenderer
;
UVCCameraViewfinderSettingsControl
*
m_viewfinderSettings
;
UVCCameraImageProcessingControl
*
m_imageProcessingControl
;
UVCCameraExposureControl
*
m_cameraExposureControl
;
};
QT_END_NAMESPACE
...
...
uvcengine/uvccamerasession.cpp
View file @
96f94e6b
...
...
@@ -191,6 +191,7 @@ bool UVCCameraSession::load()
uint32_t
exposure_abs
;
/*
// If we didn't have settings, create with default values; otherwise read and set
if ( !hasSettings ) {
qDebug() << uvcSettingsFile.absoluteFilePath() << "not found. Generating...";
...
...
@@ -272,6 +273,7 @@ bool UVCCameraSession::load()
uvc_set_contrast(devh, contrast);
}
*/
settings
->
deleteLater
();
...
...
@@ -475,12 +477,15 @@ void UVCCameraSession::release(const QString &device)
bool
UVCCameraSession
::
isImageProcessingParameterSupported
(
QCameraImageProcessingControl
::
ProcessingParameter
parameter
)
const
{
// TODO
Q_UNUSED
(
parameter
);
return
false
;
}
bool
UVCCameraSession
::
isImageProcessingParameterValueSupported
(
QCameraImageProcessingControl
::
ProcessingParameter
parameter
,
const
QVariant
&
value
)
const
{
// TODO
Q_UNUSED
(
parameter
);
Q_UNUSED
(
value
);
return
false
;
}
...
...
@@ -528,3 +533,76 @@ void UVCCameraSession::setImageProcessingParameter( QCameraImageProcessingContro
}
return
;
}
QVariant
UVCCameraSession
::
actualExposureValue
(
QCameraExposureControl
::
ExposureParameter
parameter
)
const
{
switch
(
parameter
)
{
case
QCameraExposureControl
::
ExposureMode
:
uint8_t
mode
;
uvc_get_ae_mode
(
devh
,
&
mode
,
UVC_GET_CUR
);
switch
(
mode
)
{
case
1
:
return
QCameraExposure
::
ExposureManual
;
case
2
:
return
QCameraExposure
::
ExposureAuto
;
default:
return
QVariant
();
}
break
;
case
QCameraExposureControl
::
Aperture
:
return
uvc_get
(
devh
,
uvc_get_exposure_abs
);
default:
qWarning
()
<<
parameter
<<
"not supported"
;
}
}
bool
UVCCameraSession
::
isExposureParameterSupported
(
QCameraExposureControl
::
ExposureParameter
parameter
)
const
{
return
false
;
}
QVariant
UVCCameraSession
::
requestedExposureValue
(
QCameraExposureControl
::
ExposureParameter
parameter
)
const
{
return
QVariant
();
}
bool
UVCCameraSession
::
setExposureValue
(
QCameraExposureControl
::
ExposureParameter
parameter
,
const
QVariant
&
value
)
{
switch
(
parameter
)
{
case
QCameraExposureControl
::
ExposureMode
:
{
QCameraExposure
::
ExposureMode
mode
=
value
.
value
<
QCameraExposure
::
ExposureMode
>
();
switch
(
mode
)
{
case
QCameraExposure
::
ExposureManual
:
uvc_set_ae_mode
(
devh
,
1
);
uvc_set_ae_priority
(
devh
,
0
);
break
;
case
QCameraExposure
::
ExposureAuto
:
uvc_set_ae_mode
(
devh
,
2
);
uvc_set_ae_priority
(
devh
,
0
);
break
;
default:
qWarning
()
<<
mode
<<
"not supported"
;
}
if
(
actualExposureValue
(
parameter
)
!=
mode
)
qWarning
()
<<
"Failed to set mode"
<<
mode
;
break
;
}
case
QCameraExposureControl
::
Aperture
:
{
uvc_set
(
devh
,
uvc_set_exposure_abs
,
value
,
uvc_get_exposure_abs
);
break
;
}
default:
qWarning
()
<<
parameter
<<
"not supported"
;
}
return
false
;
}
QVariantList
UVCCameraSession
::
supportedExposureParameterRange
(
QCameraExposureControl
::
ExposureParameter
parameter
,
bool
*
continuous
)
const
{
return
QVariantList
();
}
uvcengine/uvccamerasession.h
View file @
96f94e6b
...
...
@@ -82,6 +82,7 @@ public:
set
(
devh
,
static_cast
<
T
>
(
value
));
}
// Image Processing
bool
isImageProcessingParameterSupported
(
QCameraImageProcessingControl
::
ProcessingParameter
parameter
)
const
;
bool
isImageProcessingParameterValueSupported
(
QCameraImageProcessingControl
::
ProcessingParameter
parameter
,
const
QVariant
&
value
)
const
;
...
...
@@ -89,6 +90,13 @@ public:
void
setImageProcessingParameter
(
QCameraImageProcessingControl
::
ProcessingParameter
parameter
,
const
QVariant
&
value
);
// Exposure
QVariant
actualExposureValue
(
QCameraExposureControl
::
ExposureParameter
parameter
)
const
;
bool
isExposureParameterSupported
(
QCameraExposureControl
::
ExposureParameter
parameter
)
const
;
QVariant
requestedExposureValue
(
QCameraExposureControl
::
ExposureParameter
parameter
)
const
;
bool
setExposureValue
(
QCameraExposureControl
::
ExposureParameter
parameter
,
const
QVariant
&
value
);
QVariantList
supportedExposureParameterRange
(
QCameraExposureControl
::
ExposureParameter
parameter
,
bool
*
continuous
)
const
;
private
Q_SLOTS
:
void
presentFrame
(
QVideoFrame
frame
,
const
qreal
t
);
...
...
uvcengine/uvcengine.pro
View file @
96f94e6b
...
...
@@ -11,6 +11,7 @@ QT += core gui multimedia
TARGET
=
uvcengine
TEMPLATE
=
lib
CONFIG
+=
plugin
CONFIG
+=
force_debug_info
DESTDIR
=
$$
[
QT_INSTALL_PLUGINS
]
/
mediaservice
...
...
@@ -21,7 +22,8 @@ SOURCES += uvcserviceplugin.cpp \
uvccamerasession
.
cpp
\
uvcvideorenderercontrol
.
cpp
\
uvccameraviewfindersettingscontrol
.
cpp
\
uvccameraimageprocessingcontrol
.
cpp
uvccameraimageprocessingcontrol
.
cpp
\
uvccameraexposurecontrol
.
cpp
HEADERS
+=
uvcserviceplugin
.
h
\
uvccameraservice
.
h
\
...
...
@@ -30,7 +32,8 @@ HEADERS += uvcserviceplugin.h \
uvccamerasession
.
h
\
uvcvideorenderercontrol
.
h
\
uvccameraviewfindersettingscontrol
.
h
\
uvccameraimageprocessingcontrol
.
h
uvccameraimageprocessingcontrol
.
h
\
uvccameraexposurecontrol
.
h
DISTFILES
+=
uvcengine
.
json
unix
{
...
...
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