Qt
Internal/Contributor docs for the Qt SDK. Note: These are NOT official API docs; those are found at https://doc.qt.io/
Toggle main menu visibility
Loading...
Searching...
No Matches
qdmabufsource_p.h
Go to the documentation of this file.
1
// Copyright (C) 2026 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
#
ifndef
QDMABUFSOURCE_P_H
4
#
define
QDMABUFSOURCE_P_H
5
6
//
7
// W A R N I N G
8
// -------------
9
//
10
// This file is not part of the Qt API. It exists purely as an
11
// implementation detail. This header file may change from version to
12
// version without notice, or even be removed.
13
//
14
// We mean it.
15
//
16
17
#
include
<
QtMultimedia
/
qabstractvideobuffer
.
h
>
18
#
include
<
QtMultimedia
/
qvideoframeformat
.
h
>
19
#
include
<
QtMultimedia
/
private
/
qtmultimediaglobal_p
.
h
>
20
21
#
include
<
QtCore
/
qsize
.
h
>
22
#
include
<
QtCore
/
qvarlengtharray
.
h
>
23
24
#
include
<
cstdint
>
25
#
include
<
memory
>
26
#
include
<
optional
>
27
28
#
if
QT_CONFIG
(
linux_dmabuf
)
29
30
QT_BEGIN_NAMESPACE
31
32
namespace
QtMultimediaPrivate {
33
34
class
QDmaBuf;
35
36
// Byte placement of one plane inside a single DMA-BUF.
37
struct
DmaBufPlaneLayout
38
{
39
uint32_t offset = 0;
40
uint32_t pitch = 0;
41
qsizetype size = 0;
42
};
43
44
using
DmaBufLayout = QVarLengthArray<DmaBufPlaneLayout, 4>;
45
46
// Places every plane of a frame in one DMA-BUF, in plane order, all sharing bytesPerLine.
47
// Returns nullopt when the layout cannot be described or does not fit into sizeImage.
48
//
49
// LATER: fully-planar formats (YUV420P, YV12, YUV422P) and multi-fd layouts (NV12M via the
50
// V4L2 multi-planar API) are not supported. They need one fd and one pitch per plane
51
// (v4l2_plane arrays), and chroma pitch scaling per plane.
52
Q_MULTIMEDIA_EXPORT std::optional<DmaBufLayout>
53
dmaBufLayoutForFormat(QVideoFrameFormat::PixelFormat format, QSize frameSize,
int
bytesPerLine,
54
quint32 sizeImage);
55
56
// Maps a DMA-BUF read-only and exposes each plane of its layout. Plane 0 must start at offset 0,
57
// so the mapping base is the first plane's data pointer.
58
class
Q_MULTIMEDIA_EXPORT DmaBufSource
59
{
60
public
:
61
DmaBufSource();
62
DmaBufSource(std::shared_ptr<
const
QDmaBuf> buffer, DmaBufLayout layout);
63
64
std::optional<QAbstractVideoBuffer::MapData> mapReadOnly()
const
;
65
void
unmap(QAbstractVideoBuffer::MapData &mapData)
const
;
66
67
protected
:
68
std::shared_ptr<
const
QDmaBuf> m_buffer;
69
DmaBufLayout m_layout;
70
};
71
72
}
// namespace QtMultimediaPrivate
73
74
QT_END_NAMESPACE
75
76
#
endif
// QT_CONFIG(linux_dmabuf)
77
78
#
endif
// QDMABUFSOURCE_P_H
qtmultimedia
src
multimedia
video
qdmabufsource_p.h
Generated on
for Qt by
1.18.0