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

source code of qtmultimedia/src/multimedia/camera/qcameradevice.h