1 | /**************************************************************************** |
2 | ** |
3 | ** Copyright (C) 2016 The Qt Company Ltd. |
4 | ** Contact: https://www.qt.io/licensing/ |
5 | ** |
6 | ** This file is part of the Qt Toolkit. |
7 | ** |
8 | ** $QT_BEGIN_LICENSE:LGPL$ |
9 | ** Commercial License Usage |
10 | ** Licensees holding valid commercial Qt licenses may use this file in |
11 | ** accordance with the commercial license agreement provided with the |
12 | ** Software or, alternatively, in accordance with the terms contained in |
13 | ** a written agreement between you and The Qt Company. For licensing terms |
14 | ** and conditions see https://www.qt.io/terms-conditions. For further |
15 | ** information use the contact form at https://www.qt.io/contact-us. |
16 | ** |
17 | ** GNU Lesser General Public License Usage |
18 | ** Alternatively, this file may be used under the terms of the GNU Lesser |
19 | ** General Public License version 3 as published by the Free Software |
20 | ** Foundation and appearing in the file LICENSE.LGPL3 included in the |
21 | ** packaging of this file. Please review the following information to |
22 | ** ensure the GNU Lesser General Public License version 3 requirements |
23 | ** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. |
24 | ** |
25 | ** GNU General Public License Usage |
26 | ** Alternatively, this file may be used under the terms of the GNU |
27 | ** General Public License version 2.0 or (at your option) the GNU General |
28 | ** Public license version 3 or any later version approved by the KDE Free |
29 | ** Qt Foundation. The licenses are as published by the Free Software |
30 | ** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 |
31 | ** included in the packaging of this file. Please review the following |
32 | ** information to ensure the GNU General Public License requirements will |
33 | ** be met: https://www.gnu.org/licenses/gpl-2.0.html and |
34 | ** https://www.gnu.org/licenses/gpl-3.0.html. |
35 | ** |
36 | ** $QT_END_LICENSE$ |
37 | ** |
38 | ****************************************************************************/ |
39 | |
40 | #ifndef QVIDEOSURFACEFORMAT_H |
41 | #define QVIDEOSURFACEFORMAT_H |
42 | |
43 | #include <QtCore/qlist.h> |
44 | #include <QtCore/qpair.h> |
45 | #include <QtCore/qshareddata.h> |
46 | #include <QtCore/qsize.h> |
47 | #include <QtGui/qimage.h> |
48 | #include <QtMultimedia/qvideoframe.h> |
49 | |
50 | QT_BEGIN_NAMESPACE |
51 | |
52 | |
53 | class QDebug; |
54 | |
55 | class QVideoSurfaceFormatPrivate; |
56 | |
57 | class Q_MULTIMEDIA_EXPORT QVideoSurfaceFormat |
58 | { |
59 | public: |
60 | enum Direction |
61 | { |
62 | TopToBottom, |
63 | BottomToTop |
64 | }; |
65 | |
66 | enum YCbCrColorSpace |
67 | { |
68 | YCbCr_Undefined, |
69 | YCbCr_BT601, |
70 | YCbCr_BT709, |
71 | YCbCr_xvYCC601, |
72 | YCbCr_xvYCC709, |
73 | YCbCr_JPEG, |
74 | #ifndef Q_QDOC |
75 | YCbCr_CustomMatrix |
76 | #endif |
77 | }; |
78 | |
79 | QVideoSurfaceFormat(); |
80 | QVideoSurfaceFormat( |
81 | const QSize &size, |
82 | QVideoFrame::PixelFormat pixelFormat, |
83 | QAbstractVideoBuffer::HandleType handleType = QAbstractVideoBuffer::NoHandle); |
84 | QVideoSurfaceFormat(const QVideoSurfaceFormat &format); |
85 | ~QVideoSurfaceFormat(); |
86 | |
87 | QVideoSurfaceFormat &operator =(const QVideoSurfaceFormat &format); |
88 | |
89 | bool operator ==(const QVideoSurfaceFormat &format) const; |
90 | bool operator !=(const QVideoSurfaceFormat &format) const; |
91 | |
92 | bool isValid() const; |
93 | |
94 | QVideoFrame::PixelFormat pixelFormat() const; |
95 | QAbstractVideoBuffer::HandleType handleType() const; |
96 | |
97 | QSize frameSize() const; |
98 | void setFrameSize(const QSize &size); |
99 | void setFrameSize(int width, int height); |
100 | |
101 | int frameWidth() const; |
102 | int frameHeight() const; |
103 | |
104 | QRect viewport() const; |
105 | void setViewport(const QRect &viewport); |
106 | |
107 | Direction scanLineDirection() const; |
108 | void setScanLineDirection(Direction direction); |
109 | |
110 | qreal frameRate() const; |
111 | void setFrameRate(qreal rate); |
112 | |
113 | QSize pixelAspectRatio() const; |
114 | void setPixelAspectRatio(const QSize &ratio); |
115 | void setPixelAspectRatio(int width, int height); |
116 | |
117 | YCbCrColorSpace yCbCrColorSpace() const; |
118 | void setYCbCrColorSpace(YCbCrColorSpace colorSpace); |
119 | |
120 | bool isMirrored() const; |
121 | void setMirrored(bool mirrored); |
122 | |
123 | QSize sizeHint() const; |
124 | |
125 | QList<QByteArray> propertyNames() const; |
126 | QVariant property(const char *name) const; |
127 | void setProperty(const char *name, const QVariant &value); |
128 | |
129 | private: |
130 | QSharedDataPointer<QVideoSurfaceFormatPrivate> d; |
131 | }; |
132 | |
133 | #ifndef QT_NO_DEBUG_STREAM |
134 | Q_MULTIMEDIA_EXPORT QDebug operator<<(QDebug, const QVideoSurfaceFormat &); |
135 | Q_MULTIMEDIA_EXPORT QDebug operator<<(QDebug, QVideoSurfaceFormat::Direction); |
136 | Q_MULTIMEDIA_EXPORT QDebug operator<<(QDebug, QVideoSurfaceFormat::YCbCrColorSpace); |
137 | #endif |
138 | |
139 | QT_END_NAMESPACE |
140 | |
141 | Q_DECLARE_METATYPE(QVideoSurfaceFormat) |
142 | Q_DECLARE_METATYPE(QVideoSurfaceFormat::Direction) |
143 | Q_DECLARE_METATYPE(QVideoSurfaceFormat::YCbCrColorSpace) |
144 | |
145 | #endif |
146 | |
147 | |