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
qmemoryvideobuffer.cpp
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
5
7
22 m_bytesPerLine(bytesPerLine),
23 m_data(std::move(data))
24{
25}
26
31
36{
37 return m_mapMode;
38}
39
44{
46 if (m_mapMode == QVideoFrame::NotMapped && m_data.size() && mode != QVideoFrame::NotMapped) {
47 m_mapMode = mode;
48
49 mapData.nPlanes = 1;
50 mapData.bytesPerLine[0] = m_bytesPerLine;
51 // avoid detaching and extra copying in case the underlyingByteArray is
52 // being held by textures or anything else.
54 mapData.data[0] = reinterpret_cast<uchar *>(const_cast<char*>(m_data.constData()));
55 else
56 mapData.data[0] = reinterpret_cast<uchar *>(m_data.data());
57 mapData.size[0] = m_data.size();
58 }
59
60 return mapData;
61}
62
70
75{
76 return plane == 0 ? m_data : QByteArray{};
77}
78
NSData * m_data
The QAbstractVideoBuffer class is an abstraction for video data. \inmodule QtMultimedia.
\inmodule QtCore
Definition qbytearray.h:57
char * data()
\macro QT_NO_CAST_FROM_BYTEARRAY
Definition qbytearray.h:611
qsizetype size() const noexcept
Returns the number of bytes in this byte array.
Definition qbytearray.h:494
const char * constData() const noexcept
Returns a pointer to the const data stored in the byte array.
Definition qbytearray.h:124
MapData map(QVideoFrame::MapMode mode) override
\reimp
void unmap() override
\reimp
~QMemoryVideoBuffer()
Destroys a system memory allocated video buffer.
QMemoryVideoBuffer(QByteArray data, int bytesPerLine)
Constructs a video buffer with an image stride of bytesPerLine from a byte array.
QVideoFrame::MapMode mapMode() const override
\reimp
QByteArray underlyingByteArray(int plane) const override
\reimp
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
Combined button and popup list for selecting options.
GLenum mode
GLint GLsizei GLsizei GLenum GLenum GLsizei void * data
static QAbstractVideoBuffer::MapData mapData(const camera_frame_nv12_t &frame, unsigned char *baseAddress)
unsigned char uchar
Definition qtypes.h:32