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
qvideoframetexturepool_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
QVIDEOFRAMETEXTUREPOOL_P_H
5
#
define
QVIDEOFRAMETEXTUREPOOL_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
<
QtMultimedia
/
qvideoframe
.
h
>
19
#
include
<
QtMultimedia
/
private
/
qhwvideobuffer_p
.
h
>
20
21
#
include
<
array
>
22
#
include
<
optional
>
23
24
QT_BEGIN_NAMESPACE
25
26
class
QRhi;
27
class
QRhiResourceUpdateBatch;
28
29
/**
30
* @brief The class QVideoFrameTexturePool stores textures in slots to ensure
31
* they are alive during rhi's rendering rounds.
32
* Depending on the rhi backend, 1, 2, or 3 rounds are needed
33
* to complete the texture presentaton.
34
* The strategy of slots filling is based on QRhi::currentFrameSlot results.
35
*/
36
class
Q_MULTIMEDIA_EXPORT
QVideoFrameTexturePool
37
{
38
static
constexpr
size_t MaxSlotsCount = 4;
39
public
:
40
/**
41
* @brief The flag indicates whether the textures need update.
42
* Whenever a new current frame is set, the flag is turning into true.
43
*/
44
bool
texturesDirty()
const
{
return
m_texturesDirty; }
45
46
const
QVideoFrame& currentFrame()
const
{
return
m_currentFrame; }
47
48
/**
49
* @brief The method sets the current frame to be converted into textures.
50
* The flag texturesDirty becomes true after setting a new frame.
51
*/
52
void
setCurrentFrame(QVideoFrame frame);
53
54
/**
55
* @brief The method updates textures basing on the current frame.
56
* It's recommended to invoke it during rhi's rendering,
57
* in other words, between QRhi::beginFrame and QRhi::endFrame.
58
* The method resets texturesDirty to false.
59
*
60
* @return the pointer to the updated texture or null if failed
61
*/
62
QVideoFrameTextures* updateTextures(QRhi &rhi, QRhiResourceUpdateBatch &rub);
63
64
/**
65
* @brief The method should be invoked after finishing QRhi::endFrame.
66
* It propagates the call to the current texture in order to
67
* free resources that are not needed anymore.
68
*/
69
void
onFrameEndInvoked();
70
71
/**
72
* @brief The method clears all texture slots and sets the dirty flag if
73
* the current frame is valid.
74
*/
75
void
clearTextures();
76
77
private
:
78
QVideoFrame m_currentFrame;
79
bool
m_texturesDirty =
false
;
80
std::array<QVideoFrameTexturesUPtr, MaxSlotsCount> m_textureSlots;
81
std::optional<
int
> m_currentSlot;
82
QVideoFrameTexturesUPtr m_oldTextures;
83
};
84
85
QT_END_NAMESPACE
86
87
#
endif
// QVIDEOFRAMETEXTUREPOOL_P_H
QVideoFrameTexturePool
The class QVideoFrameTexturePool stores textures in slots to ensure they are alive during rhi's rende...
Definition
qvideoframetexturepool_p.h:37
QT_BEGIN_NAMESPACE
Combined button and popup list for selecting options.
Definition
qsequentialanimationgroup.cpp:47
qtmultimedia
src
multimedia
video
qvideoframetexturepool_p.h
Generated on
for Qt by
1.18.0