Qt
Internal/Contributor docs for the Qt SDK. Note: These are NOT official API docs; those are found at https://doc.qt.io/
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;
19class QAbstractVideoBuffer;
20class QRhi;
21class QRhiResourceUpdateBatch;
22class QRhiTexture;
23
24QT_DECLARE_QESDP_SPECIALIZATION_DTOR_WITH_EXPORT(QVideoFramePrivate, Q_MULTIMEDIA_EXPORT)
25
26class Q_MULTIMEDIA_EXPORT QVideoFrame
27{
28 Q_GADGET
29public:
30
31#if QT_DEPRECATED_SINCE(6, 13)
32 enum QT_DEPRECATED_VERSION_X_6_13("QVideoFrame::HandleType is deprecated and will be "
33 "removed in a future Qt version.") HandleType
34 {
35 NoHandle,
36 RhiTextureHandle
37 };
38#endif
39
40 enum MapMode
41 {
42 NotMapped = 0x00,
43 ReadOnly = 0x01,
44 WriteOnly = 0x02,
45 ReadWrite = ReadOnly | WriteOnly
46 };
47 Q_ENUM(MapMode)
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
59 QVideoFrame();
60 QVideoFrame(const QVideoFrameFormat &format);
61 explicit QVideoFrame(const QImage &image);
62 explicit QVideoFrame(std::unique_ptr<QAbstractVideoBuffer> videoBuffer);
63 QVideoFrame(const QVideoFrame &other);
64 ~QVideoFrame();
65
66 QVideoFrame(QVideoFrame &&other) noexcept = default;
67 QT_MOVE_ASSIGNMENT_OPERATOR_IMPL_VIA_PURE_SWAP(QVideoFrame)
68 void swap(QVideoFrame &other) noexcept
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;
81#if QT_DEPRECATED_SINCE(6, 13)
82 QT_WARNING_PUSH
83 QT_WARNING_DISABLE_DEPRECATED
84 QT_DEPRECATED_VERSION_X_6_13("QVideoFrame::handleType() is deprecated and will be "
85 "removed in a future Qt version.")
86 QVideoFrame::HandleType handleType() const;
87 QT_WARNING_POP
88#endif
89
90 QSize size() const;
91 int width() const;
92 int height() const;
93
94 bool isMapped() const;
95 bool isReadable() const;
96 bool isWritable() const;
97
98 QVideoFrame::MapMode mapMode() const;
99
100 bool map(QVideoFrame::MapMode mode);
101 void unmap();
102
103 int bytesPerLine(int plane) const;
104
105 uchar *bits(int plane);
106 const uchar *bits(int plane) const;
107 int mappedBytes(int plane) const;
108 int planeCount() const;
109
110 qint64 startTime() const;
111 void setStartTime(qint64 time);
112
113 qint64 endTime() const;
114 void setEndTime(qint64 time);
115
116#if QT_DEPRECATED_SINCE(6, 7)
117 QT_DEPRECATED_VERSION_X_6_7("Use QVideoFrame::setRotation(QtVideo::Rotation) instead")
118 void setRotationAngle(RotationAngle angle) { setRotation(QtVideo::Rotation(angle)); }
119
120 QT_DEPRECATED_VERSION_X_6_7("Use QVideoFrame::rotation() instead")
121 RotationAngle rotationAngle() const { return RotationAngle(rotation()); }
122#endif
123
124 void setRotation(QtVideo::Rotation angle);
125 QtVideo::Rotation rotation() const;
126
127 void setMirrored(bool);
128 bool mirrored() const;
129
130 void setStreamFrameRate(qreal rate);
131 qreal streamFrameRate() const;
132
133 QImage toImage() const;
134
135 struct PaintOptions {
136 QColor backgroundColor = Qt::transparent;
137 Qt::AspectRatioMode aspectRatioMode = Qt::KeepAspectRatio;
138 enum PaintFlag {
139 DontDrawSubtitles = 0x1
140 };
141 Q_DECLARE_FLAGS(PaintFlags, PaintFlag)
142 PaintFlags paintFlags = {};
143 };
144
145 QString subtitleText() const;
146 void setSubtitleText(const QString &text);
147
148 void paint(QPainter *painter, const QRectF &rect, const PaintOptions &options);
149
150#if QT_DEPRECATED_SINCE(6, 8)
151 QT_DEPRECATED_VERSION_X_6_8("The constructor is internal and deprecated")
152 QVideoFrame(QAbstractVideoBuffer *buffer, const QVideoFrameFormat &format);
153
154 QT_DEPRECATED_VERSION_X_6_8("The method is internal and deprecated")
155 QAbstractVideoBuffer *videoBuffer() const;
156#endif
157private:
158 friend class QVideoFramePrivate;
159 QExplicitlySharedDataPointer<QVideoFramePrivate> d;
160};
161
163
164#ifndef QT_NO_DEBUG_STREAM
165Q_MULTIMEDIA_EXPORT QDebug operator<<(QDebug, const QVideoFrame&);
166# if QT_DEPRECATED_SINCE(6, 13)
167QT_WARNING_PUSH
168QT_WARNING_DISABLE_DEPRECATED
169QT_DEPRECATED_VERSION_X_6_13("QVideoFrame::HandleType is deprecated and will be "
170 "removed in a future Qt version.")
171Q_MULTIMEDIA_EXPORT QDebug operator<<(QDebug, QVideoFrame::HandleType);
172QT_WARNING_POP
173# endif
174#endif
175
177
179
180#endif
QVideoFrameTexturesHandles is the base class, providing texture handles for frame planes....
QVideoFrameTextures is the base class representing an abstraction layer between QVideoFrame's texture...
The QVideoFrame class represents a frame of video data.
Definition qvideoframe.h:27
Combined button and popup list for selecting options.
static bool dmaModifierIsNotSupportedByDisplay(const DmaBufPlane &plane, EGLDisplay eglDisplay)
q23::expected< QVideoFrameTexturesHandlesUPtr, FailureSeverity > importDmaBufTextures(QRhi &rhi, const DmaBufEglContext &eglContext, QSpan< const DmaBufPlane > planes, QVideoFrameFormat::PixelFormat qtFormat, QSize frameSize, std::shared_ptr< void > parentKeepAlive)
Q_CORE_EXPORT QDebug operator<<(QDebug debug, QDir::Filters filters)
Definition qdir.cpp:2620
QT_BEGIN_NAMESPACE Q_STATIC_LOGGING_CATEGORY(lcSynthesizedIterableAccess, "qt.iterable.synthesized", QtWarningMsg)
QT_END_NAMESPACE Q_DECLARE_METATYPE(QT_PREPEND_NAMESPACE(QtOhosQpa::enums::kit::ShareKit::systemShare::SelectionMode))