Qt
Internal/Contributor docs for the Qt SDK. Note: These are NOT official API docs; those are found at https://doc.qt.io/
Loading...
Searching...
No Matches
qsgvideonode_p.h
Go to the documentation of this file.
1// Copyright (C) 2021 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 QSGVIDEONODE_P_H
5#define QSGVIDEONODE_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/qvideoframeformat.h>
20#include <QtMultimedia/private/qmultimediautils_p.h>
21#include <QtMultimedia/private/qvideotexturehelper_p.h>
22#include <QtMultimediaQuick/private/qtmultimediaquickglobal_p.h>
23#include <QtQuick/qsgnode.h>
24#include <QtGui/qopenglfunctions.h>
25
26QT_BEGIN_NAMESPACE
27
28class QSGVideoMaterial;
29class QQuickVideoOutput;
30class QSGInternalTextNode;
31
32class QVideoFrameTexturePool;
33using QVideoFrameTexturePoolPtr = std::shared_ptr<QVideoFrameTexturePool>;
34
36{
37public:
38 QSGVideoNode(QQuickVideoOutput *parent, const QVideoFrameFormat &videoFormat,
39 QRhi *rhi);
41
42 QVideoFrameFormat::PixelFormat pixelFormat() const { return m_videoFormat.pixelFormat(); }
43 void setCurrentFrame(const QVideoFrame &frame);
44 void setSurfaceFormat(const QRhiSwapChain::Format surfaceFormat);
45 void setHdrInfo(const QRhiSwapChainHdrInfo &hdrInfo);
46
47 void setTexturedRectGeometry(const QRectF &boundingRect, const QRectF &textureRect,
48 VideoTransformation videoOutputTransformation);
49
51
52private:
53 void updateSubtitle(const QVideoFrame &frame);
54 void setSubtitleGeometry();
55
56 QQuickVideoOutput *m_parent = nullptr;
57 QRectF m_rect;
58 QRectF m_textureRect;
59 VideoTransformation m_videoOutputTransformation;
60 VideoTransformation m_frameTransformation;
61
62 QVideoFrameFormat m_videoFormat;
63 QSGVideoMaterial *m_material = nullptr;
64
65 QVideoTextureHelper::SubtitleLayout m_subtitleLayout;
66 QSGInternalTextNode *m_subtitleTextNode = nullptr;
67};
68
69QT_END_NAMESPACE
70
71#endif // QSGVIDEONODE_H
QVideoFrameFormat m_videoFormat
QRhiSwapChainHdrInfo m_hdrInfo
bool updateUniformData(RenderState &state, QSGMaterial *newMaterial, QSGMaterial *oldMaterial) override
This function is called by the scene graph to get the contents of the shader program's uniform buffer...
QSGVideoMaterialRhiShader(const QVideoFrameFormat &videoFormat, const QRhiSwapChain::Format surfaceFormat, const QRhiSwapChainHdrInfo &hdrInfo, QRhi *rhi)
QRhiSwapChain::Format m_surfaceFormat
void updateSampledImage(RenderState &state, int binding, QSGTexture **texture, QSGMaterial *newMaterial, QSGMaterial *oldMaterial) override
This function is called by the scene graph to prepare use of sampled images in the shader,...
QVideoFrameTexturePoolPtr m_texturePool
QSGMaterialShader * createShader(QSGRendererInterface::RenderMode) const override
This function returns a new instance of a the QSGMaterialShader implementation used to render geometr...
QSGMaterialType * type() const override
This function is called by the scene graph to query an identifier that is unique to the QSGMaterialSh...
void updateTextures(QRhi *rhi, QRhiResourceUpdateBatch *resourceUpdates)
void setHdrInfo(const QRhiSwapChainHdrInfo &hdrInfo)
int compare(const QSGMaterial *other) const override
Compares this material to other and returns 0 if they are equal; -1 if this material should sort befo...
QRhiSwapChainHdrInfo m_hdrInfo
std::array< QSGVideoTexture, 3 > m_textures
void setSurfaceFormat(const QRhiSwapChain::Format surfaceFormat)
QSGVideoMaterial(const QVideoFrameFormat &videoFormat, QRhi *rhi)
QRhiSwapChain::Format m_surfaceFormat
QVideoFrameFormat m_videoFormat
const QVideoFrameTexturePoolPtr & texturePool() const
void setHdrInfo(const QRhiSwapChainHdrInfo &hdrInfo)
void setSurfaceFormat(const QRhiSwapChain::Format surfaceFormat)
QSGVideoNode(QQuickVideoOutput *parent, const QVideoFrameFormat &videoFormat, QRhi *rhi)
QVideoFrameFormat::PixelFormat pixelFormat() const
~QSGVideoNode() override
void setCurrentFrame(const QVideoFrame &frame)
void setTexturedRectGeometry(const QRectF &boundingRect, const QRectF &textureRect, VideoTransformation videoOutputTransformation)
Combined button and popup list for selecting options.
static void qSetTex(QSGGeometry::TexturedPoint2D *v, const QPointF &p)
static QT_BEGIN_NAMESPACE void qSetGeom(QSGGeometry::TexturedPoint2D *v, const QPointF &p)
static void qSwapTex(QSGGeometry::TexturedPoint2D *v0, QSGGeometry::TexturedPoint2D *v1)