Qt
Internal/Contributor docs for the Qt SDK. Note: These are NOT official API docs; those are found at https://doc.qt.io/
Toggle main menu visibility
Loading...
Searching...
No Matches
qv4l2camera_p.h
Go to the documentation of this file.
1
// Copyright (C) 2021 The Qt Company Ltd.
2
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
3
4
#
ifndef
QV4L2CAMERA_H
5
#
define
QV4L2CAMERA_H
6
7
//
8
// W A R N I N G
9
// -------------
10
//
11
// This file is not part of the Qt API. It exists purely as an
12
// implementation detail. This header file may change from version to
13
// version without notice, or even be removed.
14
//
15
// We mean it.
16
//
17
18
#
include
<
QtMultimedia
/
private
/
qplatformcamera_p
.
h
>
19
20
#
include
<
QtCore
/
private
/
qexpected_p
.
h
>
21
22
#
include
<
linux
/
videodev2
.
h
>
23
24
#
include
<
chrono
>
25
#
include
<
optional
>
26
#
include
<
system_error
>
27
28
QT_BEGIN_NAMESPACE
29
30
class
QSocketNotifier;
31
32
namespace
QtV4L2
{
33
34
class
QV4L2FileDescriptor
;
35
class
QV4L2MemoryTransfer
;
36
37
struct
V4L2CameraInfo
38
{
39
bool
autoWhiteBalanceSupported
=
false
;
40
bool
colorTemperatureSupported
=
false
;
41
bool
autoExposureSupported
=
false
;
42
bool
manualExposureSupported
=
false
;
43
bool
flashSupported
=
false
;
44
bool
torchSupported
=
false
;
45
qint32
minColorTemp
= 5600;
// Daylight...
46
qint32
maxColorTemp
= 5600;
47
qint32
minExposure
= 0;
48
qint32
maxExposure
= 0;
49
qint32
minExposureAdjustment
= 0;
50
qint32
maxExposureAdjustment
= 0;
51
qint32
minFocus
= 0;
52
qint32
maxFocus
= 0;
53
qint32
rangedFocus
=
false
;
54
55
int
minZoom
= 0;
56
int
maxZoom
= 0;
57
};
58
59
class
Q_MULTIMEDIA_EXPORT
QV4L2Camera
:
public
QPlatformCamera
60
{
61
Q_OBJECT
62
63
public
:
64
explicit
QV4L2Camera
(
QCamera
*
parent
);
65
~
QV4L2Camera
()
override
;
66
67
bool
isActive
()
const
override
;
68
void
setActive
(
bool
active
)
override
;
69
70
void
setCamera
(
const
QCameraDevice
&
camera
)
override
;
71
bool
setCameraFormat
(
const
QCameraFormat
&
format
)
override
;
72
bool
resolveCameraFormat
(
const
QCameraFormat
&
format
);
73
74
bool
isFocusModeSupported
(
QCamera
::
FocusMode
mode
)
const
override
;
75
void
setFocusMode
(
QCamera
::
FocusMode
/*mode*/
)
override
;
76
77
// void setCustomFocusPoint(const QPointF &/*point*/) override;
78
void
setFocusDistance
(
float
)
override
;
79
void
zoomTo
(
float
/*newZoomFactor*/
,
float
/*rate*/
= -1.)
override
;
80
81
void
setFlashMode
(
QCamera
::
FlashMode
/*mode*/
)
override
;
82
bool
isFlashModeSupported
(
QCamera
::
FlashMode
mode
)
const
override
;
83
bool
isFlashReady
()
const
override
;
84
85
void
setTorchMode
(
QCamera
::
TorchMode
/*mode*/
)
override
;
86
bool
isTorchModeSupported
(
QCamera
::
TorchMode
mode
)
const
override
;
87
88
void
setExposureMode
(
QCamera
::
ExposureMode
)
override
;
89
bool
isExposureModeSupported
(
QCamera
::
ExposureMode
mode
)
const
override
;
90
void
setExposureCompensation
(
float
)
override
;
91
int
isoSensitivity
()
const
override
;
92
void
setManualIsoSensitivity
(
int
)
override
;
93
void
setManualExposureTime
(
float
)
override
;
94
float
exposureTime
()
const
override
;
95
96
bool
isWhiteBalanceModeSupported
(
QCamera
::
WhiteBalanceMode
mode
)
const
override
;
97
void
setWhiteBalanceMode
(
QCamera
::
WhiteBalanceMode
/*mode*/
)
override
;
98
void
setColorTemperature
(
int
/*temperature*/
)
override
;
99
100
QVideoFrameFormat
frameFormat
()
const
override
;
101
102
private
Q_SLOTS
:
103
void
readFrame
();
104
105
private
:
106
q23
::
expected
<
void
,
std
::
error_code
>
initV4L2Controls
();
107
void
closeV4L2Fd
();
108
int
setV4L2ColorTemperature
(
int
temperature
);
109
q23
::
expected
<
void
,
std
::
error_code
>
setV4L2Parameter
(
quint32
id
,
qint32
value
);
110
std
::
optional
<
qint32
>
getV4L2Parameter
(
quint32
id
)
const
;
111
112
q23
::
expected
<
void
,
std
::
error_code
>
setV4L2CameraFormat
();
113
q23
::
expected
<
void
,
std
::
error_code
>
initV4L2MemoryTransfer
(
const
v4l2_pix_format
&
format
);
114
q23
::
expected
<
void
,
std
::
error_code
>
startCapturing
();
115
void
resetCaptureState
();
116
void
stopCapturing
();
117
void
reportError
(
std
::
error_code
error
);
118
119
std
::
optional
<
v4l2_queryctrl
>
query
(
uint32_t
id
)
const
;
120
121
private
:
122
struct
NegotiatedFormat
123
{
124
v4l2_pix_format
pixFormat
{};
125
std
::
chrono
::
microseconds
frameDuration
{};
126
};
127
128
bool
m_active
=
false
;
129
QCameraDevice
m_cameraDevice
;
130
131
std
::
unique_ptr
<
QSocketNotifier
>
m_notifier
;
132
std
::
unique_ptr
<
QV4L2MemoryTransfer
>
m_memoryTransfer
;
133
std
::
shared_ptr
<
QV4L2FileDescriptor
>
m_v4l2FileDescriptor
;
134
135
V4L2CameraInfo
m_v4l2Info
;
136
std
::
optional
<
NegotiatedFormat
>
m_negotiatedFormat
;
137
138
std
::
optional
<
std
::
chrono
::
microseconds
>
m_firstFrameTime
;
139
std
::
optional
<
std
::
chrono
::
microseconds
>
m_lastFrameStart
;
140
std
::
optional
<
std
::
chrono
::
microseconds
>
m_lastFrameEnd
;
141
};
142
143
}
// namespace QtV4L2
144
145
QT_END_NAMESPACE
146
147
#
endif
// QV4L2CAMERA_H
QtV4L2::QV4L2Camera
Definition
qv4l2camera_p.h:60
QtV4L2::QV4L2FileDescriptor
Definition
qv4l2filedescriptor_p.h:33
QtV4L2::QV4L2MemoryTransfer
Definition
qv4l2memorytransfer_p.h:38
QT_BEGIN_NAMESPACE
Combined button and popup list for selecting options.
Definition
qsequentialanimationgroup.cpp:47
QtV4L2
Definition
qv4l2camera.cpp:23
QtV4L2::v4l2ErrorMessage
static QString v4l2ErrorMessage(std::error_code error)
Definition
qv4l2camera.cpp:34
QtV4L2::toMicroseconds
static std::chrono::microseconds toMicroseconds(const timeval &tv)
Definition
qv4l2camera.cpp:29
QtV4L2::Q_STATIC_LOGGING_CATEGORY
Q_STATIC_LOGGING_CATEGORY(qLcV4L2Camera, "qt.multimedia.v4l2.camera")
std
[33]
Definition
src_corelib_tools_qhash.cpp:421
QtV4L2::V4L2CameraInfo
Definition
qv4l2camera_p.h:38
QtV4L2::V4L2CameraInfo::maxExposureAdjustment
qint32 maxExposureAdjustment
Definition
qv4l2camera_p.h:50
QtV4L2::V4L2CameraInfo::minZoom
int minZoom
Definition
qv4l2camera_p.h:55
QtV4L2::V4L2CameraInfo::minExposure
qint32 minExposure
Definition
qv4l2camera_p.h:47
QtV4L2::V4L2CameraInfo::autoExposureSupported
bool autoExposureSupported
Definition
qv4l2camera_p.h:41
QtV4L2::V4L2CameraInfo::colorTemperatureSupported
bool colorTemperatureSupported
Definition
qv4l2camera_p.h:40
QtV4L2::V4L2CameraInfo::torchSupported
bool torchSupported
Definition
qv4l2camera_p.h:44
QtV4L2::V4L2CameraInfo::minFocus
qint32 minFocus
Definition
qv4l2camera_p.h:51
QtV4L2::V4L2CameraInfo::minExposureAdjustment
qint32 minExposureAdjustment
Definition
qv4l2camera_p.h:49
QtV4L2::V4L2CameraInfo::rangedFocus
qint32 rangedFocus
Definition
qv4l2camera_p.h:53
QtV4L2::V4L2CameraInfo::flashSupported
bool flashSupported
Definition
qv4l2camera_p.h:43
QtV4L2::V4L2CameraInfo::maxFocus
qint32 maxFocus
Definition
qv4l2camera_p.h:52
QtV4L2::V4L2CameraInfo::maxZoom
int maxZoom
Definition
qv4l2camera_p.h:56
QtV4L2::V4L2CameraInfo::autoWhiteBalanceSupported
bool autoWhiteBalanceSupported
Definition
qv4l2camera_p.h:39
QtV4L2::V4L2CameraInfo::maxColorTemp
qint32 maxColorTemp
Definition
qv4l2camera_p.h:46
QtV4L2::V4L2CameraInfo::manualExposureSupported
bool manualExposureSupported
Definition
qv4l2camera_p.h:42
QtV4L2::V4L2CameraInfo::maxExposure
qint32 maxExposure
Definition
qv4l2camera_p.h:48
QtV4L2::V4L2CameraInfo::minColorTemp
qint32 minColorTemp
Definition
qv4l2camera_p.h:45
qtmultimedia
src
multimedia
v4l2
qv4l2camera_p.h
Generated on
for Qt by
1.18.0