| 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 QCAMERAINFO_P_H | 
| 5 | #define QCAMERAINFO_P_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/qcameradevice.h> | 
| 19 | #include <QtCore/qsharedpointer.h> | 
| 20 | #include <QtCore/private/qglobal_p.h> | 
| 21 | |
| 22 | QT_BEGIN_NAMESPACE | 
| 23 | |
| 24 | class QCameraFormatPrivate : public QSharedData | 
| 25 | { | 
| 26 | public: | 
| 27 | QVideoFrameFormat::PixelFormat pixelFormat = QVideoFrameFormat::Format_Invalid; | 
| 28 | QSize resolution; | 
| 29 | float minFrameRate = 0; | 
| 30 | float maxFrameRate = 0; | 
| 31 | QVideoFrameFormat::ColorRange colorRange = QVideoFrameFormat::ColorRange_Unknown; | 
| 32 | |
| 33 | static QVideoFrameFormat::ColorRange getColorRange(const QCameraFormat &format) | 
| 34 | { | 
| 35 | auto d = handle(format); | 
| 36 | return d ? d->colorRange : QVideoFrameFormat::ColorRange_Unknown; | 
| 37 | } | 
| 38 | |
| 39 | static const QCameraFormatPrivate *handle(const QCameraFormat &format) | 
| 40 | { | 
| 41 | return format.d.get(); | 
| 42 | } | 
| 43 | |
| 44 | QCameraFormat create() { return QCameraFormat(this); } | 
| 45 | }; | 
| 46 | |
| 47 | class QCameraDevicePrivate : public QSharedData | 
| 48 | { | 
| 49 | public: | 
| 50 | QByteArray id; | 
| 51 | QString description; | 
| 52 | bool isDefault = false; | 
| 53 | QCameraDevice::Position position = QCameraDevice::UnspecifiedPosition; | 
| 54 | int orientation = 0; | 
| 55 | QList<QSize> photoResolutions; | 
| 56 | QList<QCameraFormat> videoFormats; | 
| 57 | |
| 58 | static const QCameraDevicePrivate *handle(const QCameraDevice &device) | 
| 59 | { | 
| 60 | return device.d.data(); | 
| 61 | } | 
| 62 | |
| 63 | bool operator==(const QCameraDevicePrivate &other) const | 
| 64 | { | 
| 65 | return id == other.id && description == other.description && isDefault == other.isDefault | 
| 66 | && position == other.position && orientation == other.orientation | 
| 67 | && photoResolutions == other.photoResolutions && videoFormats == other.videoFormats; | 
| 68 | } | 
| 69 | |
| 70 | QCameraDevice create() { return QCameraDevice(this); } | 
| 71 | }; | 
| 72 | |
| 73 | QT_END_NAMESPACE | 
| 74 | |
| 75 | #endif // QCAMERAINFO_P_H | 
| 76 | 
