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 | |
27 | QT_BEGIN_NAMESPACE |
28 | |
29 | class QSGVideoMaterial; |
30 | class QQuickVideoOutput; |
31 | class QSGInternalTextNode; |
32 | |
33 | class QSGVideoNode : public QSGGeometryNode |
34 | { |
35 | public: |
36 | QSGVideoNode(QQuickVideoOutput *parent, const QVideoFrameFormat &videoFormat); |
37 | ~QSGVideoNode(); |
38 | |
39 | QVideoFrameFormat::PixelFormat pixelFormat() const { return m_videoFormat.pixelFormat(); } |
40 | void setCurrentFrame(const QVideoFrame &frame); |
41 | void setSurfaceFormat(const QRhiSwapChain::Format surfaceFormat); |
42 | void setHdrInfo(const QRhiSwapChainHdrInfo &hdrInfo); |
43 | |
44 | void setTexturedRectGeometry(const QRectF &boundingRect, const QRectF &textureRect, int orientation); |
45 | |
46 | private: |
47 | void updateSubtitle(const QVideoFrame &frame); |
48 | void setSubtitleGeometry(); |
49 | |
50 | QQuickVideoOutput *m_parent = nullptr; |
51 | QRectF m_rect; |
52 | QRectF m_textureRect; |
53 | int m_orientation = -1; |
54 | VideoTransformation m_frameTransformation; |
55 | |
56 | QVideoFrameFormat m_videoFormat; |
57 | QSGVideoMaterial *m_material = nullptr; |
58 | |
59 | QVideoTextureHelper::SubtitleLayout m_subtitleLayout; |
60 | QSGInternalTextNode *m_subtitleTextNode = nullptr; |
61 | }; |
62 | |
63 | QT_END_NAMESPACE |
64 | |
65 | #endif // QSGVIDEONODE_H |
66 |