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_instance_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_INSTANCE_P_H
4#define QLIBCAMERA_INSTANCE_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 <QtCore/qobject.h>
18#include <QtCore/qstring.h>
19
20#include <memory>
21
22namespace libcamera {
23class Camera;
24class CameraManager;
25} // namespace libcamera
26
27QT_BEGIN_NAMESPACE
28
29namespace QLibCamera {
30
32{
34public:
36
37 static std::shared_ptr<QLibCameraInstance> instance();
38
39 libcamera::CameraManager *manager() const { return m_manager.get(); }
40
41 std::shared_ptr<libcamera::Camera> get(const QString &id) const;
42
44 void cameraAdded(const QString &id);
45 void cameraRemoved(const QString &id);
46
47private:
48 QLibCameraInstance();
49
50 const std::unique_ptr<libcamera::CameraManager> m_manager;
51 // Whether m_manager->start() succeeded -- set from its return value in the constructor, as
52 // m_manager itself is always non-null. instance() and the destructor rely on this rather than
53 // a null check on m_manager.
54 bool m_started = false;
55};
56
57} // namespace QLibCamera
58
59QT_END_NAMESPACE
60
61#endif // QLIBCAMERA_INSTANCE_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 cameraRemoved(const QString &id)
std::shared_ptr< libcamera::Camera > get(const QString &id) const
static std::shared_ptr< QLibCameraInstance > instance()
libcamera::CameraManager * manager() const
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)
QCamera::Features detectSupportedFeatures(const ControlInfoMap &controls)
std::pair< float, float > frameRateRangeFromControls(const ControlInfoMap &controls)
std::optional< QVideoFrameFormat::PixelFormat > pixelFormatFromLibcamera(const PixelFormat &format)
std::pair< QVideoFrameFormat::ColorSpace, QVideoFrameFormat::ColorRange > colorSpaceFromLibcamera(const std::optional< ColorSpace > &colorSpace)
std::vector< QSize > sizesForPixelFormat(const StreamFormats &formats, const PixelFormat &pixelFormat)