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{
28public:
29
31 {
33 RhiTextureHandle
34 };
35
37 {
38 NotMapped = 0x00,
39 ReadOnly = 0x01,
40 WriteOnly = 0x02,
41 ReadWrite = ReadOnly | WriteOnly
42 };
43
44#if QT_DEPRECATED_SINCE(6, 7)
45 enum RotationAngle
46 {
47 Rotation0 Q_DECL_ENUMERATOR_DEPRECATED_X("Use QtVideo::Rotation::None instead") = 0,
48 Rotation90 Q_DECL_ENUMERATOR_DEPRECATED_X("Use QtVideo::Rotation::Clockwise90 instead") = 90,
49 Rotation180 Q_DECL_ENUMERATOR_DEPRECATED_X("Use QtVideo::Rotation::Clockwise180 instead") = 180,
50 Rotation270 Q_DECL_ENUMERATOR_DEPRECATED_X("Use QtVideo::Rotation::Clockwise270 instead") = 270
51 };
52#endif
53
56 explicit QVideoFrame(const QImage &image);
59
60 QVideoFrame(QVideoFrame &&other) noexcept = default;
61 QT_MOVE_ASSIGNMENT_OPERATOR_IMPL_VIA_PURE_SWAP(QVideoFrame)
63 { d.swap(other.d); }
64
65
66 QVideoFrame &operator =(const QVideoFrame &other);
67 bool operator==(const QVideoFrame &other) const;
68 bool operator!=(const QVideoFrame &other) const;
69
70 bool isValid() const;
71
72 QVideoFrameFormat::PixelFormat pixelFormat() const;
73
74 QVideoFrameFormat surfaceFormat() const;
76
77 QSize size() const;
78 int width() const;
79 int height() const;
80
81 bool isMapped() const;
82 bool isReadable() const;
83 bool isWritable() const;
84
85 QVideoFrame::MapMode mapMode() const;
86
88 void unmap();
89
90 int bytesPerLine(int plane) const;
91
92 uchar *bits(int plane);
93 const uchar *bits(int plane) const;
94 int mappedBytes(int plane) const;
95 int planeCount() const;
96
97 qint64 startTime() const;
98 void setStartTime(qint64 time);
99
100 qint64 endTime() const;
101 void setEndTime(qint64 time);
102
103#if QT_DEPRECATED_SINCE(6, 7)
104 QT_DEPRECATED_VERSION_X_6_7("Use QVideoFrame::setRotation(QtVideo::Rotation) instead")
105 void setRotationAngle(RotationAngle angle) { setRotation(QtVideo::Rotation(angle)); }
106
107 QT_DEPRECATED_VERSION_X_6_7("Use QVideoFrame::rotation() instead")
108 RotationAngle rotationAngle() const { return RotationAngle(rotation()); }
109#endif
110
111 void setRotation(QtVideo::Rotation angle);
112 QtVideo::Rotation rotation() const;
113
114 void setMirrored(bool);
115 bool mirrored() const;
116
117 void setStreamFrameRate(qreal rate);
118 qreal streamFrameRate() const;
119
120 QImage toImage() const;
121
123 QColor backgroundColor = Qt::transparent;
126 DontDrawSubtitles = 0x1
127 };
128 Q_DECLARE_FLAGS(PaintFlags, PaintFlag)
129 PaintFlags paintFlags = {};
130 };
131
132 QString subtitleText() const;
133 void setSubtitleText(const QString &text);
134
135 void paint(QPainter *painter, const QRectF &rect, const PaintOptions &options);
136
138
139 QAbstractVideoBuffer *videoBuffer() const;
140private:
141 friend class QVideoFramePrivate;
142 QExplicitlySharedDataPointer<QVideoFramePrivate> d;
143};
144
145Q_DECLARE_SHARED(QVideoFrame)
146
147#ifndef QT_NO_DEBUG_STREAM
148Q_MULTIMEDIA_EXPORT QDebug operator<<(QDebug, const QVideoFrame&);
149Q_MULTIMEDIA_EXPORT QDebug operator<<(QDebug, QVideoFrame::HandleType);
150#endif
151
153
155
156#endif
157
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:1731
\inmodule QtGui
Definition qrhi.h:895
\inmodule QtGuiPrivate \inheaderfile rhi/qrhi.h
Definition qrhi.h:1804
\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
MapMode
Enumerates how a video buffer's data is mapped to system memory.
Definition qvideoframe.h:37
QVideoFrame(const QVideoFrame &other)
Constructs a shallow copy of other.
HandleType
Identifies the type of a video buffers handle.
Definition qvideoframe.h:31
~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.
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
#define Q_DECLARE_FLAGS(Flags, Enum)
Definition qflags.h:174
#define Q_DECLARE_METATYPE(TYPE)
Definition qmetatype.h:1525
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_7(text)
return device isReadable() ? device -> read(static_cast< char * >(buf), size) :-1
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]