Qt 6.x
The Qt SDK
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/qvideoframeformat.h>
9
10#include <QtCore/qmetatype.h>
11#include <QtCore/qshareddata.h>
12#include <QtGui/qimage.h>
13
15
16class QSize;
19class QRhi;
21class QRhiTexture;
22
24
25class Q_MULTIMEDIA_EXPORT QVideoFrame
26{
27public:
28
30 {
32 RhiTextureHandle
33 };
34
36 {
37 NotMapped = 0x00,
38 ReadOnly = 0x01,
39 WriteOnly = 0x02,
40 ReadWrite = ReadOnly | WriteOnly
41 };
42
44 {
45 Rotation0 = 0,
46 Rotation90 = 90,
47 Rotation180 = 180,
48 Rotation270 = 270
49 };
50
55
56 QVideoFrame(QVideoFrame &&other) noexcept = default;
57 QT_MOVE_ASSIGNMENT_OPERATOR_IMPL_VIA_PURE_SWAP(QVideoFrame)
58 void swap(QVideoFrame &other) noexcept
59 { d.swap(other.d); }
60
61
62 QVideoFrame &operator =(const QVideoFrame &other);
63 bool operator==(const QVideoFrame &other) const;
64 bool operator!=(const QVideoFrame &other) const;
65
66 bool isValid() const;
67
68 QVideoFrameFormat::PixelFormat pixelFormat() const;
69
70 QVideoFrameFormat surfaceFormat() const;
72
73 QSize size() const;
74 int width() const;
75 int height() const;
76
77 bool isMapped() const;
78 bool isReadable() const;
79 bool isWritable() const;
80
81 QVideoFrame::MapMode mapMode() const;
82
84 void unmap();
85
86 int bytesPerLine(int plane) const;
87
88 uchar *bits(int plane);
89 const uchar *bits(int plane) const;
90 int mappedBytes(int plane) const;
91 int planeCount() const;
92
93 qint64 startTime() const;
94 void setStartTime(qint64 time);
95
96 qint64 endTime() const;
97 void setEndTime(qint64 time);
98
99 void setRotationAngle(RotationAngle);
100 RotationAngle rotationAngle() const;
101
102 void setMirrored(bool);
103 bool mirrored() const;
104
105 QImage toImage() const;
106
108 QColor backgroundColor = Qt::transparent;
111 DontDrawSubtitles = 0x1
112 };
113 Q_DECLARE_FLAGS(PaintFlags, PaintFlag)
114 PaintFlags paintFlags = {};
115 };
116
117 QString subtitleText() const;
118 void setSubtitleText(const QString &text);
119
120 void paint(QPainter *painter, const QRectF &rect, const PaintOptions &options);
121
123
124 QAbstractVideoBuffer *videoBuffer() const;
125private:
127};
128
129Q_DECLARE_SHARED(QVideoFrame)
130
131#ifndef QT_NO_DEBUG_STREAM
132Q_MULTIMEDIA_EXPORT QDebug operator<<(QDebug, const QVideoFrame&);
133Q_MULTIMEDIA_EXPORT QDebug operator<<(QDebug, QVideoFrame::HandleType);
134#endif
135
137
139
140#endif
141
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:483
\inmodule QtGui
Definition qrhi.h:1694
\inmodule QtGui
Definition qrhi.h:883
\inmodule QtGui
Definition qrhi.h:1767
\inmodule QtCore
Definition qsize.h:25
\macro QT_RESTRICTED_CAST_FROM_ASCII
Definition qstring.h:127
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:26
MapMode
Enumerates how a video buffer's data is mapped to system memory.
Definition qvideoframe.h:36
QVideoFrame(const QVideoFrame &other)
Constructs a shallow copy of other.
RotationAngle
The angle of the clockwise rotation that should be applied to a video frame before displaying.
Definition qvideoframe.h:44
HandleType
Identifies the type of a video buffers handle.
Definition qvideoframe.h:30
~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:46
qint64 startTime
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:1504
GLenum mode
GLint GLsizei GLsizei height
GLenum GLuint GLintptr GLsizeiptr size
[1]
GLenum GLuint buffer
GLint GLsizei width
GLuint64 GLenum handleType
GLint GLsizei GLsizei GLenum format
GLenum GLint GLenum GLsizei GLsizei GLsizei GLint GLsizei const void * bits
bool operator==(const QRandomGenerator &rng1, const QRandomGenerator &rng2)
Definition qrandom.cpp:1219
#define QT_DECLARE_QESDP_SPECIALIZATION_DTOR_WITH_EXPORT(Class, ExportMacro)
unsigned char uchar
Definition qtypes.h:27
long long qint64
Definition qtypes.h:55
Q_MULTIMEDIA_EXPORT QDebug operator<<(QDebug, const QVideoFrame &)
QSharedPointer< T > other(t)
[5]
QPainter painter(this)
[7]