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 <QtQuick/qsgnode.h>
19#include <private/qtmultimediaquickglobal_p.h>
20#include "private/qvideotexturehelper_p.h"
21#include "private/qmultimediautils_p.h"
22
23#include <QtMultimedia/qvideoframe.h>
24#include <QtMultimedia/qvideoframeformat.h>
25#include <QtGui/qopenglfunctions.h>
26
27QT_BEGIN_NAMESPACE
28
29class QSGVideoMaterial;
30class QQuickVideoOutput;
31class QSGInternalTextNode;
32
33class QVideoFrameTexturePool;
34using QVideoFrameTexturePoolPtr = std::shared_ptr<QVideoFrameTexturePool>;
35
36class QSGVideoNode : public QSGGeometryNode
37{
38public:
39 QSGVideoNode(QQuickVideoOutput *parent, const QVideoFrameFormat &videoFormat,
40 QRhi *rhi);
41 ~QSGVideoNode() override;
42
43 QVideoFrameFormat::PixelFormat pixelFormat() const { return m_videoFormat.pixelFormat(); }
44 void setCurrentFrame(const QVideoFrame &frame);
45 void setSurfaceFormat(const QRhiSwapChain::Format surfaceFormat);
46 void setHdrInfo(const QRhiSwapChainHdrInfo &hdrInfo);
47
48 void setTexturedRectGeometry(const QRectF &boundingRect, const QRectF &textureRect,
49 VideoTransformation videoOutputTransformation);
50
51 const QVideoFrameTexturePoolPtr &texturePool() const;
52
53private:
54 void updateSubtitle(const QVideoFrame &frame);
55 void setSubtitleGeometry();
56
57 QQuickVideoOutput *m_parent = nullptr;
58 QRectF m_rect;
59 QRectF m_textureRect;
60 VideoTransformation m_videoOutputTransformation;
61 VideoTransformation m_frameTransformation;
62
63 QVideoFrameFormat m_videoFormat;
64 QSGVideoMaterial *m_material = nullptr;
65
66 QVideoTextureHelper::SubtitleLayout m_subtitleLayout;
67 QSGInternalTextNode *m_subtitleTextNode = nullptr;
68};
69
70QT_END_NAMESPACE
71
72#endif // QSGVIDEONODE_H
73

source code of qtmultimedia/src/multimediaquick/qsgvideonode_p.h