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
qwasmgltexturevideobuffer_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
4
#
ifndef
QWASMGLTEXTUREVIDEOBUFFER_H
5
#
define
QWASMGLTEXTUREVIDEOBUFFER_H
6
7
#
include
<
QtMultimedia
/
qvideoframe
.
h
>
8
#
include
<
QtMultimedia
/
private
/
qhwvideobuffer_p
.
h
>
9
#
include
<
QtGui
/
rhi
/
qrhi
.
h
>
10
#
include
<
QtCore
/
qsize
.
h
>
11
#
include
<
QtCore
/
qthread
.
h
>
12
#
include
<
QtCore
/
private
/
quniquehandle_p
.
h
>
13
14
#
include
<
emscripten
/
val
.
h
>
15
#
include
<
emscripten
/
html5
.
h
>
16
17
#
include
<
GLES2
/
gl2
.
h
>
18
19
//
20
// W A R N I N G
21
// -------------
22
//
23
// This file is not part of the Qt API. It exists purely as an
24
// implementation detail. This header file may change from version to
25
// version without notice, or even be removed.
26
//
27
// We mean it.
28
//
29
30
QT_BEGIN_NAMESPACE
31
32
struct
QGlTextureHandleTraits
33
{
34
using
Type = GLuint;
35
static
Type invalidValue() {
return
0; }
36
static
bool
close(Type handle)
37
{
38
glDeleteTextures(1, &handle);
39
return
true
;
40
}
41
};
42
using
QGlTextureHandle = QUniqueHandle<QGlTextureHandleTraits>;
43
44
class
QWasmGLTextureVideoBuffer
:
public
QHwVideoBuffer
45
{
46
public
:
47
explicit
QWasmGLTextureVideoBuffer
(QGlTextureHandle textureHandle,
const
QSize &size,
48
EMSCRIPTEN_WEBGL_CONTEXT_HANDLE glContext, QRhi *rhi);
49
50
QWasmGLTextureVideoBuffer
::
MapData
map
(
QVideoFrame
::
MapMode
)
override
;
51
void
unmap
()
override
;
52
53
quint64
textureHandle
(QRhi &,
int
plane)
override
;
54
55
// Must return the RHI that owns the WebGL context the texture lives in.
56
// Without this, qImageFromVideoFrame() calls qEnsureThreadLocalRhi()
57
// which creates a second WebGL context, corrupting the GL state for the
58
// QQuick render loop that resumes after toImage() returns.
59
QRhi
*
associatedCurrentThreadRhi
()
const
override
60
{
61
return
(QThread::currentThread() == m_rhiThread) ? m_rhi :
nullptr
;
62
}
63
64
private
:
65
QGlTextureHandle m_glTextureHandle;
66
QSize m_size;
67
// WebGL context the texture was created in
68
EMSCRIPTEN_WEBGL_CONTEXT_HANDLE m_glContext;
69
QRhi *m_rhi;
70
QThread *m_rhiThread;
71
};
72
73
QT_END_NAMESPACE
74
75
#
endif
// QWASMGLTEXTUREVIDEOBUFFER_H
QWasmGLTextureVideoBuffer
Definition
qwasmgltexturevideobuffer_p.h:45
QWasmGLTextureVideoBuffer::textureHandle
quint64 textureHandle(QRhi &, int plane) override
Definition
qwasmgltexturevideobuffer.cpp:32
QWasmGLTextureVideoBuffer::unmap
void unmap() override
Releases the memory mapped by the map() function.
Definition
qwasmgltexturevideobuffer.cpp:28
QWasmGLTextureVideoBuffer::QWasmGLTextureVideoBuffer
QWasmGLTextureVideoBuffer(QGlTextureHandle textureHandle, const QSize &size, EMSCRIPTEN_WEBGL_CONTEXT_HANDLE glContext, QRhi *rhi)
Definition
qwasmgltexturevideobuffer.cpp:11
QWasmGLTextureVideoBuffer::map
QWasmGLTextureVideoBuffer::MapData map(QVideoFrame::MapMode) override
Maps the planes of a video buffer to memory.
Definition
qwasmgltexturevideobuffer.cpp:23
QWasmGLTextureVideoBuffer::associatedCurrentThreadRhi
QRhi * associatedCurrentThreadRhi() const override
Definition
qwasmgltexturevideobuffer_p.h:59
QT_BEGIN_NAMESPACE
Combined button and popup list for selecting options.
Definition
qsequentialanimationgroup.cpp:47
qtmultimedia
src
plugins
multimedia
wasm
common
qwasmgltexturevideobuffer_p.h
Generated on
for Qt by
1.18.0