| 1 | // Copyright (C) 2016 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_H | 
| 5 | #define QCAMERAINFO_H | 
| 6 | |
| 7 | #include <QtMultimedia/qtvideo.h> | 
| 8 | #include <QtMultimedia/qvideoframe.h> | 
| 9 | #include <QtCore/qsharedpointer.h> | 
| 10 | |
| 11 | QT_BEGIN_NAMESPACE | 
| 12 | |
| 13 | class QCameraFormatPrivate; | 
| 14 | class Q_MULTIMEDIA_EXPORT QCameraFormat | 
| 15 | { | 
| 16 | Q_GADGET | 
| 17 | Q_PROPERTY(QSize resolution READ resolution CONSTANT) | 
| 18 | Q_PROPERTY(QVideoFrameFormat::PixelFormat pixelFormat READ pixelFormat CONSTANT) | 
| 19 | Q_PROPERTY(float minFrameRate READ minFrameRate CONSTANT) | 
| 20 | Q_PROPERTY(float maxFrameRate READ maxFrameRate CONSTANT) | 
| 21 | public: | 
| 22 | QCameraFormat() noexcept; | 
| 23 | QCameraFormat(const QCameraFormat &other) noexcept; | 
| 24 | QCameraFormat &operator=(const QCameraFormat &other) noexcept; | 
| 25 | ~QCameraFormat(); | 
| 26 | |
| 27 | QVideoFrameFormat::PixelFormat pixelFormat() const noexcept; | 
| 28 | QSize resolution() const noexcept; | 
| 29 | float minFrameRate() const noexcept; | 
| 30 | float maxFrameRate() const noexcept; | 
| 31 | |
| 32 | bool isNull() const noexcept { return !d; } | 
| 33 | |
| 34 | bool operator==(const QCameraFormat &other) const; | 
| 35 | inline bool operator!=(const QCameraFormat &other) const | 
| 36 | { return !operator==(other); } | 
| 37 | |
| 38 | private: | 
| 39 | friend class QCameraFormatPrivate; | 
| 40 | QCameraFormat(QCameraFormatPrivate *p); | 
| 41 | QExplicitlySharedDataPointer<QCameraFormatPrivate> d; | 
| 42 | }; | 
| 43 | |
| 44 | class QCameraDevicePrivate; | 
| 45 | class Q_MULTIMEDIA_EXPORT QCameraDevice | 
| 46 | { | 
| 47 | Q_GADGET | 
| 48 | Q_PROPERTY(QByteArray id READ id CONSTANT) | 
| 49 | Q_PROPERTY(QString description READ description CONSTANT) | 
| 50 | Q_PROPERTY(bool isDefault READ isDefault CONSTANT) | 
| 51 | Q_PROPERTY(Position position READ position CONSTANT) | 
| 52 | Q_PROPERTY(QList<QCameraFormat> videoFormats READ videoFormats CONSTANT) | 
| 53 | Q_PROPERTY(QtVideo::Rotation correctionAngle READ correctionAngle CONSTANT) | 
| 54 | public: | 
| 55 | QCameraDevice(); | 
| 56 | QCameraDevice(const QCameraDevice& other); | 
| 57 | QCameraDevice& operator=(const QCameraDevice& other); | 
| 58 | ~QCameraDevice(); | 
| 59 | |
| 60 | bool operator==(const QCameraDevice &other) const; | 
| 61 | inline bool operator!=(const QCameraDevice &other) const; | 
| 62 | |
| 63 | bool isNull() const; | 
| 64 | |
| 65 | QByteArray id() const; | 
| 66 | QString description() const; | 
| 67 | |
| 68 | // ### Add here and to QAudioDevice | 
| 69 | // QByteArray groupId() const; | 
| 70 | // QString groupDescription() const; | 
| 71 | |
| 72 | bool isDefault() const; | 
| 73 | |
| 74 | enum Position | 
| 75 | { | 
| 76 | UnspecifiedPosition, | 
| 77 | BackFace, | 
| 78 | FrontFace | 
| 79 | }; | 
| 80 | Q_ENUM(Position) | 
| 81 | |
| 82 | Position position() const; | 
| 83 | |
| 84 | QList<QSize> photoResolutions() const; | 
| 85 | QList<QCameraFormat> videoFormats() const; | 
| 86 | |
| 87 | QtVideo::Rotation correctionAngle() const; | 
| 88 | // ### Add zoom and other camera information | 
| 89 | |
| 90 | private: | 
| 91 | friend class QCameraDevicePrivate; | 
| 92 | QCameraDevice(QCameraDevicePrivate *p); | 
| 93 | QExplicitlySharedDataPointer<QCameraDevicePrivate> d; | 
| 94 | }; | 
| 95 | |
| 96 | bool QCameraDevice::operator!=(const QCameraDevice &other) const { return !operator==(other); } | 
| 97 | |
| 98 | #ifndef QT_NO_DEBUG_STREAM | 
| 99 | Q_MULTIMEDIA_EXPORT QDebug operator<<(QDebug, const QCameraDevice&); | 
| 100 | #endif | 
| 101 | |
| 102 | QT_END_NAMESPACE | 
| 103 | |
| 104 | #endif // QCAMERAINFO_H | 
| 105 | 
