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_p.h
Go to the documentation of this file.
1// Copyright (C) 2024 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_P_H
5#define QVIDEOFRAME_P_H
6
7//
8// W A R N I N G
9// -------------
10//
11// This file is not part of the Qt API. It exists purely as an
12// implementation detail. This header file may change from version to
13// version without notice, or even be removed.
14//
15// We mean it.
16//
17
18#include "qvideoframe.h"
19#include "qhwvideobuffer_p.h"
20
21#include <qmutex.h>
22
24
26{
27public:
28 QVideoFramePrivate() = default;
29
35
36 template <typename Buffer>
37 static QVideoFrame createFrame(std::unique_ptr<Buffer> buffer, QVideoFrameFormat format)
38 {
40 result.d.reset(new QVideoFramePrivate(std::move(format), std::move(buffer)));
41 return result;
42 }
43
44 template <typename Buffer = QAbstractVideoBuffer>
45 QVideoFramePrivate(QVideoFrameFormat format, std::unique_ptr<Buffer> buffer = nullptr)
46 : format{ std::move(format) }, videoBuffer{ std::move(buffer) }
47 {
48 if constexpr (std::is_base_of_v<QHwVideoBuffer, Buffer>)
49 hwVideoBuffer = static_cast<QHwVideoBuffer *>(videoBuffer.get());
50 else if constexpr (std::is_same_v<QAbstractVideoBuffer, Buffer>)
51 hwVideoBuffer = dynamic_cast<QHwVideoBuffer *>(videoBuffer.get());
52 // else hwVideoBuffer == nullptr
53 }
54
55 static QVideoFramePrivate *handle(QVideoFrame &frame) { return frame.d.get(); };
56
58 {
59 return frame.d ? frame.d->hwVideoBuffer : nullptr;
60 };
61
63 {
64 return frame.d ? frame.d->videoBuffer.get() : nullptr;
65 };
66
73
79 std::unique_ptr<QAbstractVideoBuffer> videoBuffer;
81 int mappedCount = 0;
86
87private:
88 Q_DISABLE_COPY(QVideoFramePrivate)
89};
90
92
93#endif // QVIDEOFRAMEPRIVATE_P_H
The QAbstractVideoBuffer class is an abstraction for video data. \inmodule QtMultimedia.
void reset(T *ptr=nullptr) noexcept
\inmodule QtGui
Definition qimage.h:37
\inmodule QtCore
Definition qmutex.h:281
\inmodule QtCore
Definition qshareddata.h:19
\macro QT_RESTRICTED_CAST_FROM_ASCII
Definition qstring.h:129
The QVideoFrameFormat class specifies the stream format of a video presentation surface.
QVideoFrameFormat format
static QVideoFramePrivate * handle(QVideoFrame &frame)
static QAbstractVideoBuffer * buffer(const QVideoFrame &frame)
QAbstractVideoBuffer::MapData mapData
QVideoFramePrivate()=default
QHwVideoBuffer * hwVideoBuffer
QVideoFrame adoptThisByVideoFrame()
static QVideoFrame createFrame(std::unique_ptr< Buffer > buffer, QVideoFrameFormat format)
std::unique_ptr< QAbstractVideoBuffer > videoBuffer
QVideoFramePrivate(QVideoFrameFormat format, std::unique_ptr< Buffer > buffer=nullptr)
QtVideo::MapMode mapMode
static QHwVideoBuffer * hwBuffer(const QVideoFrame &frame)
The QVideoFrame class represents a frame of video data.
Definition qvideoframe.h:27
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
GLenum GLuint buffer
GLint GLsizei GLsizei GLenum format
GLuint64EXT * result
[6]
long long qint64
Definition qtypes.h:60
QFrame frame
[0]
The QAbstractVideoBuffer::MapData structure describes the mapped plane layout.
\inmodule QtCore \threadsafe
Definition qshareddata.h:31