Qt
Internal/Contributor docs for the Qt SDK. <b>Note:</b> These are NOT official API docs; those are found <a href='https://doc.qt.io/'>here</a>.
Loading...
Searching...
No Matches
qvideoframe.h
Go to the documentation of this file.
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 QVIDEOFRAME_H
5#define QVIDEOFRAME_H
6
7#include <QtMultimedia/qtmultimediaglobal.h>
8#include <QtMultimedia/qtvideo.h>
9#include <QtMultimedia/qvideoframeformat.h>
10
11#include <QtCore/qmetatype.h>
12#include <QtCore/qshareddata.h>
13#include <QtGui/qimage.h>
14
16
17class QSize;
20class QRhi;
22class QRhiTexture;
23
25
26class Q_MULTIMEDIA_EXPORT QVideoFrame
27{
29public:
30
32 {
34 RhiTextureHandle
35 };
36
38 {
39 NotMapped Q_DECL_ENUMERATOR_DEPRECATED_X("Use QtVideo::MapMode::NotMapped instead")
40 = static_cast<int>(QtVideo::MapMode::NotMapped),
41 ReadOnly Q_DECL_ENUMERATOR_DEPRECATED_X("Use QtVideo::MapMode::ReadOnly instead")
42 = static_cast<int>(QtVideo::MapMode::ReadOnly),
43 WriteOnly Q_DECL_ENUMERATOR_DEPRECATED_X("Use QtVideo::MapMode::WriteOnly instead")
44 = static_cast<int>(QtVideo::MapMode::WriteOnly),
45 ReadWrite Q_DECL_ENUMERATOR_DEPRECATED_X("Use QtVideo::MapMode::ReadWrite instead")
46 = static_cast<int>(QtVideo::MapMode::ReadWrite)
47 };
48
49#if QT_DEPRECATED_SINCE(6, 7)
50 enum RotationAngle
51 {
52 Rotation0 Q_DECL_ENUMERATOR_DEPRECATED_X("Use QtVideo::Rotation::None instead") = 0,
53 Rotation90 Q_DECL_ENUMERATOR_DEPRECATED_X("Use QtVideo::Rotation::Clockwise90 instead") = 90,
54 Rotation180 Q_DECL_ENUMERATOR_DEPRECATED_X("Use QtVideo::Rotation::Clockwise180 instead") = 180,
55 Rotation270 Q_DECL_ENUMERATOR_DEPRECATED_X("Use QtVideo::Rotation::Clockwise270 instead") = 270
56 };
57#endif
58
61 explicit QVideoFrame(const QImage &image);
62 explicit QVideoFrame(std::unique_ptr<QAbstractVideoBuffer> videoBuffer);
65
66 QVideoFrame(QVideoFrame &&other) noexcept = default;
67 QT_MOVE_ASSIGNMENT_OPERATOR_IMPL_VIA_PURE_SWAP(QVideoFrame)
69 { d.swap(other.d); }
70
71
72 QVideoFrame &operator =(const QVideoFrame &other);
73 bool operator==(const QVideoFrame &other) const;
74 bool operator!=(const QVideoFrame &other) const;
75
76 bool isValid() const;
77
78 QVideoFrameFormat::PixelFormat pixelFormat() const;
79
80 QVideoFrameFormat surfaceFormat() const;
82
83 QSize size() const;
84 int width() const;
85 int height() const;
86
87 bool isMapped() const;
88 bool isReadable() const;
89 bool isWritable() const;
90
91 QVideoFrame::MapMode mapMode() const;
92
94#if QT_DEPRECATED_SINCE(6, 8)
95 QT_DEPRECATED_VERSION_X_6_7("Use QVideoFrame::map(QtVideo::MapMode) instead")
97#endif
98 void unmap();
99
100 int bytesPerLine(int plane) const;
101
102 uchar *bits(int plane);
103 const uchar *bits(int plane) const;
104 int mappedBytes(int plane) const;
105 int planeCount() const;
106
107 qint64 startTime() const;
108 void setStartTime(qint64 time);
109
110 qint64 endTime() const;
111 void setEndTime(qint64 time);
112
113#if QT_DEPRECATED_SINCE(6, 7)
114 QT_DEPRECATED_VERSION_X_6_7("Use QVideoFrame::setRotation(QtVideo::Rotation) instead")
115 void setRotationAngle(RotationAngle angle) { setRotation(QtVideo::Rotation(angle)); }
116
117 QT_DEPRECATED_VERSION_X_6_7("Use QVideoFrame::rotation() instead")
118 RotationAngle rotationAngle() const { return RotationAngle(rotation()); }
119#endif
120
121 void setRotation(QtVideo::Rotation angle);
122 QtVideo::Rotation rotation() const;
123
124 void setMirrored(bool);
125 bool mirrored() const;
126
127 void setStreamFrameRate(qreal rate);
128 qreal streamFrameRate() const;
129
130 QImage toImage() const;
131
133 QColor backgroundColor = Qt::transparent;
136 DontDrawSubtitles = 0x1
137 };
138 Q_DECLARE_FLAGS(PaintFlags, PaintFlag)
139 PaintFlags paintFlags = {};
140 };
141
142 QString subtitleText() const;
143 void setSubtitleText(const QString &text);
144
145 void paint(QPainter *painter, const QRectF &rect, const PaintOptions &options);
146
147#if QT_DEPRECATED_SINCE(6, 8)
148 QT_DEPRECATED_VERSION_X_6_8("The constructor is internal and deprecated")
150
151 QT_DEPRECATED_VERSION_X_6_8("The method is internal and deprecated")
152 QAbstractVideoBuffer *videoBuffer() const;
153#endif
154private:
155 friend class QVideoFramePrivate;
156 QExplicitlySharedDataPointer<QVideoFramePrivate> d;
157};
158
159Q_DECLARE_SHARED(QVideoFrame)
160
161#ifndef QT_NO_DEBUG_STREAM
162Q_MULTIMEDIA_EXPORT QDebug operator<<(QDebug, const QVideoFrame&);
163Q_MULTIMEDIA_EXPORT QDebug operator<<(QDebug, QVideoFrame::HandleType);
164#endif
165
167
169
170#endif
171
The QAbstractVideoBuffer class is an abstraction for video data. \inmodule QtMultimedia.
The QColor class provides colors based on RGB, HSV or CMYK values.
Definition qcolor.h:31
\inmodule QtCore
\inmodule QtGui
Definition qimage.h:37
The QPainter class performs low-level painting on widgets and other paint devices.
Definition qpainter.h:46
\inmodule QtCore\reentrant
Definition qrect.h:484
\inmodule QtGui
Definition qrhi.h:1732
\inmodule QtGui
Definition qrhi.h:895
\inmodule QtGuiPrivate \inheaderfile rhi/qrhi.h
Definition qrhi.h:1805
\inmodule QtCore
Definition qsize.h:25
\macro QT_RESTRICTED_CAST_FROM_ASCII
Definition qstring.h:129
The QVideoFrameFormat class specifies the stream format of a video presentation surface.
PixelFormat
Enumerates video data types.
The QVideoFrame class represents a frame of video data.
Definition qvideoframe.h:27
QVideoFrame(const QVideoFrame &other)
Constructs a shallow copy of other.
HandleType
Identifies the type of a video buffers handle.
Definition qvideoframe.h:32
~QVideoFrame()
Destroys a video frame.
QVideoFrame(QVideoFrame &&other) noexcept=default
Constructs a QVideoFrame by moving from other.
QMap< QString, QString > map
[6]
QPainter paint
QString text
rect
[4]
Combined button and popup list for selecting options.
MapMode
Enumerates how a video buffer's data is mapped to system memory.
Definition qtvideo.h:25
AspectRatioMode
@ KeepAspectRatio
@ transparent
Definition qnamespace.h:47
Definition image.cpp:4
qint64 startTime
#define Q_DECL_ENUMERATOR_DEPRECATED_X(x)
constexpr bool operator!=(const timespec &t1, const timespec &t2)
DBusConnection const char DBusError DBusBusType DBusError return DBusConnection DBusHandleMessageFunction void DBusFreeFunction return DBusConnection return DBusConnection return const char DBusError return DBusConnection DBusMessage dbus_uint32_t return DBusConnection dbus_bool_t DBusConnection DBusAddWatchFunction DBusRemoveWatchFunction DBusWatchToggledFunction void DBusFreeFunction return DBusConnection DBusDispatchStatusFunction void DBusFreeFunction DBusTimeout return DBusTimeout return DBusWatch return DBusWatch unsigned int return DBusError const DBusError return const DBusMessage return DBusMessage return DBusMessage return DBusMessage return DBusMessage return DBusMessage return DBusMessageIter int const void return DBusMessageIter DBusMessageIter return DBusMessageIter void DBusMessageIter void int return DBusMessage DBusMessageIter return DBusMessageIter return DBusMessageIter DBusMessageIter const char const char const char const char return DBusMessage return DBusMessage const char return DBusMessage dbus_bool_t return DBusMessage dbus_uint32_t return DBusMessage void
DBusConnection const char DBusError DBusBusType DBusError return DBusConnection DBusHandleMessageFunction void DBusFreeFunction return DBusConnection return DBusConnection return const char DBusError return DBusConnection DBusMessage dbus_uint32_t return DBusConnection dbus_bool_t DBusConnection DBusAddWatchFunction DBusRemoveWatchFunction DBusWatchToggledFunction void DBusFreeFunction return DBusConnection DBusDispatchStatusFunction void DBusFreeFunction DBusTimeout return DBusTimeout return DBusWatch return DBusWatch unsigned int return DBusError const DBusError return const DBusMessage return DBusMessage return DBusMessage return DBusMessage return DBusMessage return DBusMessage return DBusMessageIter int const void return DBusMessageIter DBusMessageIter return DBusMessageIter void DBusMessageIter void int return DBusMessage DBusMessageIter return DBusMessageIter return DBusMessageIter DBusMessageIter const char const char const char const char * method
#define Q_DECLARE_FLAGS(Flags, Enum)
Definition qflags.h:174
#define Q_DECLARE_METATYPE(TYPE)
Definition qmetatype.h:1526
GLenum mode
GLint GLsizei GLsizei height
GLenum GLuint GLintptr GLsizeiptr size
[1]
GLenum GLuint buffer
GLint GLsizei width
GLfloat angle
GLuint64 GLenum handleType
GLint GLsizei GLsizei GLenum format
GLuint GLenum * rate
GLenum GLint GLenum GLsizei GLsizei GLsizei GLint GLsizei const void * bits
bool operator==(const QRandomGenerator &rng1, const QRandomGenerator &rng2)
Definition qrandom.cpp:1220
#define QT_DECLARE_QESDP_SPECIALIZATION_DTOR_WITH_EXPORT(Class, ExportMacro)
#define QT_DEPRECATED_VERSION_X_6_8(text)
#define QT_DEPRECATED_VERSION_X_6_7(text)
#define Q_GADGET
unsigned char uchar
Definition qtypes.h:32
long long qint64
Definition qtypes.h:60
double qreal
Definition qtypes.h:187
Q_MULTIMEDIA_EXPORT QDebug operator<<(QDebug, const QVideoFrame &)
QSharedPointer< T > other(t)
[5]
this swap(other)
QPainter painter(this)
[7]