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.cpp
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
#
include
"qvideoframetexturepool_p.h"
5
6
#
include
<
QtMultimedia
/
private
/
qvideotexturehelper_p
.
h
>
7
#
include
<
QtGui
/
rhi
/
qrhi
.
h
>
8
9
QT_BEGIN_NAMESPACE
10
11
void
QVideoFrameTexturePool::setCurrentFrame(QVideoFrame frame)
12
{
13
m_texturesDirty =
true
;
14
m_currentFrame = std::move(frame);
15
}
16
17
QVideoFrameTextures *QVideoFrameTexturePool::updateTextures(QRhi &rhi, QRhiResourceUpdateBatch &rub)
18
{
19
const
int
currentSlot = rhi.currentFrameSlot();
20
Q_ASSERT(size_t(currentSlot) < MaxSlotsCount);
21
22
m_texturesDirty =
false
;
23
QVideoFrameTexturesUPtr &textures = m_textureSlots[currentSlot];
24
Q_ASSERT(!m_oldTextures);
25
m_oldTextures = std::move(textures);
26
textures = QVideoTextureHelper::createTextures(m_currentFrame, rhi, rub, m_oldTextures);
27
28
m_currentSlot = textures ? currentSlot : std::optional<
int
>{};
29
30
return
textures.get();
31
}
32
33
void
QVideoFrameTexturePool::onFrameEndInvoked()
34
{
35
m_oldTextures.reset();
36
if
(m_currentSlot && m_textureSlots[*m_currentSlot])
37
m_textureSlots[*m_currentSlot]->onFrameEndInvoked();
38
}
39
40
void
QVideoFrameTexturePool::clearTextures()
41
{
42
std::fill(std::begin(m_textureSlots), std::end(m_textureSlots),
nullptr
);
43
m_currentSlot.reset();
44
m_texturesDirty = m_currentFrame.isValid();
45
}
46
47
QT_END_NAMESPACE
QT_BEGIN_NAMESPACE
Combined button and popup list for selecting options.
Definition
qsequentialanimationgroup.cpp:47
qtmultimedia
src
multimedia
video
qvideoframetexturepool.cpp
Generated on
for Qt by
1.18.0