Qt
Internal/Contributor docs for the Qt SDK. Note: These are NOT official API docs; those are found at https://doc.qt.io/
Loading...
Searching...
No Matches
qlibcamera_stream_p.h
Go to the documentation of this file.
1// Copyright (C) 2026 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#ifndef QLIBCAMERA_STREAM_P_H
4#define QLIBCAMERA_STREAM_P_H
5
6//
7// W A R N I N G
8// -------------
9//
10// This file is not part of the Qt API. It exists purely as an
11// implementation detail. This header file may change from version to
12// version without notice, or even be removed.
13//
14// We mean it.
15//
16
17#include <QtMultimedia/qvideoframe.h>
18#include <QtMultimedia/qvideoframeformat.h>
19#include <QtCore/private/qexpected_p.h>
20#include <QtCore/qmutex.h>
21#include <QtCore/qobject.h>
22
23#include <libcamera/controls.h>
24
25#include <chrono>
26#include <mutex>
27#include <optional>
28
29namespace libcamera {
30class Camera;
31class FrameBuffer;
32class Request;
33class Stream;
34} // namespace libcamera
35
36QT_BEGIN_NAMESPACE
37
38namespace QLibCamera {
39
40class QLibCameraCameraStream final : public QObject
41{
43public:
46
47 // Runs on libcamera's CameraManager thread -- see the class comment above.
48 void handleRequestCompleted(libcamera::Request *);
49
50 template <typename Fn>
51 void withPendingControls(Fn &&fn)
52 {
53 std::lock_guard lock(m_controlsMutex);
54 fn(m_pendingControls);
55 }
56
57 libcamera::Stream *stream() const { return m_stream; }
58
61
62private:
63 const std::shared_ptr<libcamera::Camera> m_libcameraCamera;
64 libcamera::Stream *const m_stream;
65 const int m_bytesPerLine;
66 const QVideoFrameFormat m_frameFormat;
67 const double m_maxFrameRate;
68
69 std::optional<std::chrono::nanoseconds> m_firstFrameTimestamp;
70
71 QMutex m_controlsMutex;
72 libcamera::ControlList m_pendingControls;
73};
74
75} // namespace QLibCamera
76
77QT_END_NAMESPACE
78
79#endif // QLIBCAMERA_STREAM_P_H
void handleRequestCompleted(libcamera::Request *)
QLibCameraCameraStream(std::shared_ptr< libcamera::Camera >, libcamera::Stream *, int bytesPerLine, QVideoFrameFormat, double maxFrameRate)
libcamera::Stream * stream() const
void setExposureCompensation(float compensation) override
void setManualIsoSensitivity(int iso) override
void setActive(bool active) override
void setCamera(const QCameraDevice &) override
void setManualExposureTime(float seconds) override
bool setCameraFormat(const QCameraFormat &) override
void zoomTo(float newZoomFactor, float rate=-1.) override
void setExposureMode(QCamera::ExposureMode) override
QVideoFrameFormat frameFormat() const override
int cameraPixelFormatScore(QVideoFrameFormat::PixelFormat, QVideoFrameFormat::ColorRange) const override
void setColorTemperature(int temperature) override
void setWhiteBalanceMode(QCamera::WhiteBalanceMode) override
bool isExposureModeSupported(QCamera::ExposureMode mode) const override
void setExposureCompensation(ControlList &pending, float stops)
void setAnalogueGainForIso(ControlList &pending, int iso)
void setAwbEnable(ControlList &pending, bool enable)
void setZoomFactor(ControlList &pending, const ControlInfoMap &controls, float zoomFactor)
void setColorTemperature(ControlList &pending, int kelvin)
void setManualExposureTime(ControlList &pending, float seconds)
void setAeEnable(ControlList &pending, bool enable)