Qt
Internal/Contributor docs for the Qt SDK. <b>Note:</b> These are NOT official API docs; those are found <a href='https://doc.qt.io/'>here</a>.
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 <private/qplatformcamera_p.h>
19#include <sys/time.h>
20
22
25class QSocketNotifier;
26
50
53
55{
57
58public:
59 explicit QV4L2Camera(QCamera *parent);
61
62 bool isActive() const override;
63 void setActive(bool active) override;
64
65 void setCamera(const QCameraDevice &camera) override;
66 bool setCameraFormat(const QCameraFormat &format) override;
68
69 bool isFocusModeSupported(QCamera::FocusMode mode) const override;
70 void setFocusMode(QCamera::FocusMode /*mode*/) override;
71
72// void setCustomFocusPoint(const QPointF &/*point*/) override;
73 void setFocusDistance(float) override;
74 void zoomTo(float /*newZoomFactor*/, float /*rate*/ = -1.) override;
75
76 void setFlashMode(QCamera::FlashMode /*mode*/) override;
77 bool isFlashModeSupported(QCamera::FlashMode mode) const override;
78 bool isFlashReady() const override;
79
80 void setTorchMode(QCamera::TorchMode /*mode*/) override;
81 bool isTorchModeSupported(QCamera::TorchMode mode) const override;
82
85 void setExposureCompensation(float) override;
86 int isoSensitivity() const override;
87 void setManualIsoSensitivity(int) override;
88 void setManualExposureTime(float) override;
89 float exposureTime() const override;
90
92 void setWhiteBalanceMode(QCamera::WhiteBalanceMode /*mode*/) override;
93 void setColorTemperature(int /*temperature*/) override;
94
95 QVideoFrameFormat frameFormat() const override;
96
97private Q_SLOTS:
98 void readFrame();
99
100private:
101 void setCameraBusy();
102 void initV4L2Controls();
103 void closeV4L2Fd();
104 int setV4L2ColorTemperature(int temperature);
105 bool setV4L2Parameter(quint32 id, qint32 value);
106 int getV4L2Parameter(quint32 id) const;
107
108 void setV4L2CameraFormat();
109 void initV4L2MemoryTransfer();
110 void startCapturing();
111 void stopCapturing();
112
113private:
114 bool m_active = false;
115 QCameraDevice m_cameraDevice;
116
117 std::unique_ptr<QSocketNotifier> m_notifier;
118 std::unique_ptr<QV4L2MemoryTransfer> m_memoryTransfer;
119 std::shared_ptr<QV4L2FileDescriptor> m_v4l2FileDescriptor;
120
121 V4L2CameraInfo m_v4l2Info;
122
123 timeval m_firstFrameTime = { -1, -1 };
124 quint32 m_bytesPerLine = 0;
125 quint32 m_imageSize = 0;
127 qint64 m_frameDuration = -1;
128 bool m_cameraBusy = false;
129};
130
132
133#endif // QV4L2CAMERA_H
The QCameraDevice class provides general information about camera devices.
The QCameraFormat class describes a video format supported by a camera device. \inmodule QtMultimedia...
The QCamera class provides interface for system camera devices.
Definition qcamera.h:28
WhiteBalanceMode
\value WhiteBalanceAuto Auto white balance mode.
Definition qcamera.h:112
TorchMode
\value TorchOff Torch is Off.
Definition qcamera.h:84
FocusMode
\value FocusModeAuto Continuous auto focus mode.
Definition qcamera.h:67
FlashMode
\value FlashOff Flash is Off.
Definition qcamera.h:77
ExposureMode
\value ExposureAuto Automatic mode.
Definition qcamera.h:91
QObject * parent() const
Returns a pointer to the parent object.
Definition qobject.h:346
\inmodule QtCore
void zoomTo(float, float=-1.) override
void setManualIsoSensitivity(int) override
void setColorTemperature(int) override
bool isActive() const override
void setFocusMode(QCamera::FocusMode) override
QVideoFrameFormat frameFormat() const override
bool setCameraFormat(const QCameraFormat &format) override
void setTorchMode(QCamera::TorchMode) override
void setFocusDistance(float) override
bool isFocusModeSupported(QCamera::FocusMode mode) const override
void setExposureMode(QCamera::ExposureMode) override
void setActive(bool active) override
bool isWhiteBalanceModeSupported(QCamera::WhiteBalanceMode mode) const override
bool isFlashReady() const override
bool resolveCameraFormat(const QCameraFormat &format)
int isoSensitivity() const override
QV4L2Camera(QCamera *parent)
void setExposureCompensation(float) override
void setFlashMode(QCamera::FlashMode) override
bool isFlashModeSupported(QCamera::FlashMode mode) const override
bool isTorchModeSupported(QCamera::TorchMode mode) const override
void setWhiteBalanceMode(QCamera::WhiteBalanceMode) override
bool isExposureModeSupported(QCamera::ExposureMode mode) const override
void setCamera(const QCameraDevice &camera) override
float exposureTime() const override
void setManualExposureTime(float) override
The QVideoFrameFormat class specifies the stream format of a video presentation surface.
ColorSpace
Enumerates the color space of video frames.
PixelFormat
Enumerates video data types.
QCamera * camera
Definition camera.cpp:19
Combined button and popup list for selecting options.
EGLOutputLayerEXT EGLint EGLAttrib value
[5]
GLenum mode
GLint GLsizei GLsizei GLenum format
#define Q_OBJECT
#define Q_SLOTS
unsigned int quint32
Definition qtypes.h:50
int qint32
Definition qtypes.h:49
long long qint64
Definition qtypes.h:60
uint32_t v4l2Format
uint32_t v4l2FormatForPixelFormat(QVideoFrameFormat::PixelFormat format)
QVideoFrameFormat::PixelFormat formatForV4L2Format(uint32_t v4l2Format)
bool autoExposureSupported
bool colorTemperatureSupported
bool manualExposureSupported
bool autoWhiteBalanceSupported
qint32 minExposureAdjustment
qint32 maxExposureAdjustment