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
qhwvideobuffer_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
QHWVIDEOBUFFER_P_H
5
#
define
QHWVIDEOBUFFER_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
"qabstractvideobuffer.h"
19
#
include
"qvideoframe.h"
20
21
#
include
<
QtGui
/
qmatrix4x4
.
h
>
22
23
#
include
<
optional
>
24
25
QT_BEGIN_NAMESPACE
26
27
class
QRhi;
28
class
QRhiTexture;
29
class
QVideoFrame;
30
31
/**
32
* @brief QVideoFrameTexturesHandles is the base class, providing texture handles for frame planes.
33
* Instances of the class may own textures, share ownership, or refer to inner hw textures
34
* of QVideoFrame. Referencing to inner frame's textures without shared ownership is
35
* not recommended, we strive to get around it; if texture are referencing,
36
* the source frame is kept in the QVideoFrameTextures instance via its
37
* constructor-provided source frame.
38
*/
39
class
Q_MULTIMEDIA_EXPORT
QVideoFrameTexturesHandles
40
{
41
public
:
42
virtual
~QVideoFrameTexturesHandles();
43
44
virtual
quint64 textureHandle(QRhi &,
int
/*plane*/
) {
return
0; }
45
46
// Set when the textures don't have the layout of the frame's pixel format, e.g. a
47
// single-image import, which exposes one texture for a multi-plane frame.
48
virtual
std::optional<QVideoFrameFormat::PixelFormat> texturePixelFormat()
const
{
return
{}; }
49
};
50
using
QVideoFrameTexturesHandlesUPtr = std::unique_ptr<QVideoFrameTexturesHandles>;
51
52
/**
53
* @brief QVideoFrameTextures is the base class representing an abstraction layer
54
* between QVideoFrame's texture(s) and rhi's plane textures.
55
* QVideoFrameTextures must own the inner rhi textures or
56
* share ownership. QVideoFrameTextures instances are propagated to
57
* QVideoFrameTexturesPool, where their lifetime is managed
58
* according to results of QRhi::currentFrameSlot upon rendering.
59
*
60
*/
61
class
Q_MULTIMEDIA_EXPORT
QVideoFrameTextures
62
{
63
public
:
64
explicit
QVideoFrameTextures(QVideoFrame sourceFrame = {});
65
virtual
~QVideoFrameTextures();
66
virtual
QRhiTexture *texture(uint plane)
const
= 0;
67
68
/**
69
* @brief The virtual method should be invoked after QRhi::endFrame to unmap and free
70
* internal resources that are not needed anymore.
71
*/
72
virtual
void
onFrameEndInvoked() { }
73
74
virtual
QVideoFrameTexturesHandlesUPtr takeHandles() {
return
nullptr
; }
75
76
private
:
77
QVideoFrame m_sourceFrame;
78
};
79
using
QVideoFrameTexturesUPtr = std::unique_ptr<QVideoFrameTextures>;
80
81
class
Q_MULTIMEDIA_EXPORT
QHwVideoBuffer
:
public
QAbstractVideoBuffer,
82
public
QVideoFrameTexturesHandles
83
{
84
public
:
85
QHwVideoBuffer();
86
87
~QHwVideoBuffer() override;
88
89
// returns rhi in the current thread that has been associated with the frame
90
// during texture mapping or texture converter initialization.
91
virtual
QRhi *associatedCurrentThreadRhi()
const
{
return
nullptr
; }
92
93
QVideoFrameFormat format()
const
final
94
{
95
// invalid by design: we have to go through QVideoFramePrivate::createFrame
96
return
{};
97
}
98
99
virtual
QMatrix4x4 externalTextureMatrix()
const
{
return
{}; }
100
101
virtual
QVideoFrameTexturesUPtr mapTextures(QRhi &rhi,
102
QVideoFrameTexturesUPtr &
/*oldTextures*/
)
103
{
104
return
mapTextures(rhi);
105
}
106
virtual
QVideoFrameTexturesUPtr mapTextures(QRhi &) {
return
nullptr
; }
107
108
virtual
void
initTextureConverter(QRhi &) { }
109
110
virtual
bool
isDmaBuf()
const
{
return
false
; }
111
};
112
113
QT_END_NAMESPACE
114
115
#
endif
// QHWVIDEOBUFFER_P_H
QHwVideoBuffer
Definition
qhwvideobuffer_p.h:83
QVideoFrameTexturesHandles
QVideoFrameTexturesHandles is the base class, providing texture handles for frame planes....
Definition
qhwvideobuffer_p.h:40
QVideoFrameTextures
QVideoFrameTextures is the base class representing an abstraction layer between QVideoFrame's texture...
Definition
qhwvideobuffer_p.h:62
QtMultimediaPrivate::DmaBufEglContext
Definition
qdmabuftextureimporter_p.h:44
QtMultimediaPrivate::impl
Definition
qaudiosystem_p.h:257
QtMultimediaPrivate::dmaModifierIsNotSupportedByDisplay
static bool dmaModifierIsNotSupportedByDisplay(const DmaBufPlane &plane, EGLDisplay eglDisplay)
Definition
qdmabuftextureimporter.cpp:78
QtMultimediaPrivate::isExternalOesOnly
static bool isExternalOesOnly(const QEglImageFunctions &eglFunctions, EGLDisplay eglDisplay, const DmaBufPlane &plane)
Definition
qdmabuftextureimporter.cpp:91
QtMultimediaPrivate::FailureSeverity
FailureSeverity
Definition
qdmabuftextureimporter_p.h:83
QtMultimediaPrivate::FailureSeverity::unrecoverable
@ unrecoverable
Definition
qdmabuftextureimporter_p.h:85
QtMultimediaPrivate::FailureSeverity::recoverable
@ recoverable
Definition
qdmabuftextureimporter_p.h:84
QtMultimediaPrivate::importDmaBufTextures
q23::expected< QVideoFrameTexturesHandlesUPtr, FailureSeverity > importDmaBufTextures(QRhi &rhi, const DmaBufEglContext &eglContext, QSpan< const DmaBufPlane > planes, QVideoFrameFormat::PixelFormat qtFormat, QSize frameSize, std::shared_ptr< void > parentKeepAlive, DmaBufImportMode importMode)
Definition
qdmabuftextureimporter.cpp:103
std
[33]
Definition
src_corelib_tools_qhash.cpp:421
Q_STATIC_LOGGING_CATEGORY
QT_BEGIN_NAMESPACE Q_STATIC_LOGGING_CATEGORY(lcSynthesizedIterableAccess, "qt.iterable.synthesized", QtWarningMsg)
qtmultimedia
src
multimedia
video
qhwvideobuffer_p.h
Generated on
for Qt by
1.18.0