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
27
QT_BEGIN_NAMESPACE
28
29
class
QSocketNotifier;
30
31
namespace
QtV4L2
{
32
33
class
QV4L2FileDescriptor
;
34
class
QV4L2MemoryTransfer
;
35
36
struct
V4L2CameraInfo
37
{
38
bool
formatInitialized
=
false
;
39
40
bool
autoWhiteBalanceSupported
=
false
;
41
bool
colorTemperatureSupported
=
false
;
42
bool
autoExposureSupported
=
false
;
43
bool
manualExposureSupported
=
false
;
44
bool
flashSupported
=
false
;
45
bool
torchSupported
=
false
;
46
qint32
minColorTemp
= 5600;
// Daylight...
47
qint32
maxColorTemp
= 5600;
48
qint32
minExposure
= 0;
49
qint32
maxExposure
= 0;
50
qint32
minExposureAdjustment
= 0;
51
qint32
maxExposureAdjustment
= 0;
52
qint32
minFocus
= 0;
53
qint32
maxFocus
= 0;
54
qint32
rangedFocus
=
false
;
55
56
int
minZoom
= 0;
57
int
maxZoom
= 0;
58
};
59
60
class
Q_MULTIMEDIA_EXPORT
QV4L2Camera
:
public
QPlatformCamera
61
{
62
Q_OBJECT
63
64
public
:
65
explicit
QV4L2Camera
(
QCamera
*
parent
);
66
~
QV4L2Camera
()
override
;
67
68
bool
isActive
()
const
override
;
69
void
setActive
(
bool
active
)
override
;
70
71
void
setCamera
(
const
QCameraDevice
&
camera
)
override
;
72
bool
setCameraFormat
(
const
QCameraFormat
&
format
)
override
;
73
bool
resolveCameraFormat
(
const
QCameraFormat
&
format
);
74
75
bool
isFocusModeSupported
(
QCamera
::
FocusMode
mode
)
const
override
;
76
void
setFocusMode
(
QCamera
::
FocusMode
/*mode*/
)
override
;
77
78
// void setCustomFocusPoint(const QPointF &/*point*/) override;
79
void
setFocusDistance
(
float
)
override
;
80
void
zoomTo
(
float
/*newZoomFactor*/
,
float
/*rate*/
= -1.)
override
;
81
82
void
setFlashMode
(
QCamera
::
FlashMode
/*mode*/
)
override
;
83
bool
isFlashModeSupported
(
QCamera
::
FlashMode
mode
)
const
override
;
84
bool
isFlashReady
()
const
override
;
85
86
void
setTorchMode
(
QCamera
::
TorchMode
/*mode*/
)
override
;
87
bool
isTorchModeSupported
(
QCamera
::
TorchMode
mode
)
const
override
;
88
89
void
setExposureMode
(
QCamera
::
ExposureMode
)
override
;
90
bool
isExposureModeSupported
(
QCamera
::
ExposureMode
mode
)
const
override
;
91
void
setExposureCompensation
(
float
)
override
;
92
int
isoSensitivity
()
const
override
;
93
void
setManualIsoSensitivity
(
int
)
override
;
94
void
setManualExposureTime
(
float
)
override
;
95
float
exposureTime
()
const
override
;
96
97
bool
isWhiteBalanceModeSupported
(
QCamera
::
WhiteBalanceMode
mode
)
const
override
;
98
void
setWhiteBalanceMode
(
QCamera
::
WhiteBalanceMode
/*mode*/
)
override
;
99
void
setColorTemperature
(
int
/*temperature*/
)
override
;
100
101
QVideoFrameFormat
frameFormat
()
const
override
;
102
103
private
Q_SLOTS
:
104
void
readFrame
();
105
106
private
:
107
void
setCameraBusy
();
108
void
initV4L2Controls
();
109
void
closeV4L2Fd
();
110
int
setV4L2ColorTemperature
(
int
temperature
);
111
bool
setV4L2Parameter
(
quint32
id
,
qint32
value
);
112
int
getV4L2Parameter
(
quint32
id
)
const
;
113
114
q23
::
expected
<
void
,
QString
>
setV4L2CameraFormat
();
115
void
initV4L2MemoryTransfer
();
116
void
startCapturing
();
117
void
stopCapturing
();
118
119
private
:
120
bool
m_active
=
false
;
121
QCameraDevice
m_cameraDevice
;
122
123
std
::
unique_ptr
<
QSocketNotifier
>
m_notifier
;
124
std
::
unique_ptr
<
QV4L2MemoryTransfer
>
m_memoryTransfer
;
125
std
::
shared_ptr
<
QV4L2FileDescriptor
>
m_v4l2FileDescriptor
;
126
127
V4L2CameraInfo
m_v4l2Info
;
128
129
std
::
optional
<
std
::
chrono
::
microseconds
>
m_firstFrameTime
;
130
v4l2_pix_format
m_pixFormat
{};
131
std
::
chrono
::
microseconds
m_frameDuration
{};
132
bool
m_cameraBusy
=
false
;
133
};
134
135
}
// namespace QtV4L2
136
137
QT_END_NAMESPACE
138
139
#
endif
// QV4L2CAMERA_H
QtV4L2::QV4L2Camera
Definition
qv4l2camera_p.h:61
QtV4L2::QV4L2FileDescriptor
Definition
qv4l2filedescriptor_p.h:33
QtV4L2::QV4L2MemoryTransfer
Definition
qv4l2memorytransfer_p.h:37
QT_BEGIN_NAMESPACE
Combined button and popup list for selecting options.
Definition
qsequentialanimationgroup.cpp:47
QtV4L2
Definition
qv4l2camera.cpp:22
QtV4L2::toMicroseconds
static std::chrono::microseconds toMicroseconds(const timeval &tv)
Definition
qv4l2camera.cpp:28
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:37
QtV4L2::V4L2CameraInfo::maxExposureAdjustment
qint32 maxExposureAdjustment
Definition
qv4l2camera_p.h:51
QtV4L2::V4L2CameraInfo::minZoom
int minZoom
Definition
qv4l2camera_p.h:56
QtV4L2::V4L2CameraInfo::minExposure
qint32 minExposure
Definition
qv4l2camera_p.h:48
QtV4L2::V4L2CameraInfo::autoExposureSupported
bool autoExposureSupported
Definition
qv4l2camera_p.h:42
QtV4L2::V4L2CameraInfo::colorTemperatureSupported
bool colorTemperatureSupported
Definition
qv4l2camera_p.h:41
QtV4L2::V4L2CameraInfo::torchSupported
bool torchSupported
Definition
qv4l2camera_p.h:45
QtV4L2::V4L2CameraInfo::minFocus
qint32 minFocus
Definition
qv4l2camera_p.h:52
QtV4L2::V4L2CameraInfo::minExposureAdjustment
qint32 minExposureAdjustment
Definition
qv4l2camera_p.h:50
QtV4L2::V4L2CameraInfo::rangedFocus
qint32 rangedFocus
Definition
qv4l2camera_p.h:54
QtV4L2::V4L2CameraInfo::formatInitialized
bool formatInitialized
Definition
qv4l2camera_p.h:38
QtV4L2::V4L2CameraInfo::flashSupported
bool flashSupported
Definition
qv4l2camera_p.h:44
QtV4L2::V4L2CameraInfo::maxFocus
qint32 maxFocus
Definition
qv4l2camera_p.h:53
QtV4L2::V4L2CameraInfo::maxZoom
int maxZoom
Definition
qv4l2camera_p.h:57
QtV4L2::V4L2CameraInfo::autoWhiteBalanceSupported
bool autoWhiteBalanceSupported
Definition
qv4l2camera_p.h:40
QtV4L2::V4L2CameraInfo::maxColorTemp
qint32 maxColorTemp
Definition
qv4l2camera_p.h:47
QtV4L2::V4L2CameraInfo::manualExposureSupported
bool manualExposureSupported
Definition
qv4l2camera_p.h:43
QtV4L2::V4L2CameraInfo::maxExposure
qint32 maxExposure
Definition
qv4l2camera_p.h:49
QtV4L2::V4L2CameraInfo::minColorTemp
qint32 minColorTemp
Definition
qv4l2camera_p.h:46
qtmultimedia
src
multimedia
v4l2
qv4l2camera_p.h
Generated on
for Qt by
1.18.0