QGroundControl
Ground Control Station for MAVLink Drones
Loading...
Searching...
No Matches
QGCVideoNodeItem.h
Go to the documentation of this file.
1#pragma once
2
3#include <QtCore/QSize>
4#include <QtGui/QMatrix4x4>
5#include <QtMultimedia/QVideoFrameFormat>
6#include <QtQuick/QQuickItem>
7#include <QtQuick/QSGRenderNode>
8
9class QRhiTexture;
10
11class QGCVideoNodeItem : public QQuickItem
12{
13 Q_OBJECT
14
15public:
16 explicit QGCVideoNodeItem(QQuickItem* parent = nullptr);
18
19 void setCurrentTexture(QRhiTexture* texture, const QSize& frameSize, QVideoFrameFormat::PixelFormat pixelFormat,
20 const QMatrix4x4& externalTextureMatrix);
21
22protected:
23 QSGNode* updatePaintNode(QSGNode* oldNode, UpdatePaintNodeData* data) override;
24
25private:
26 QRhiTexture* _pendingTexture = nullptr;
27 QSize _frameSize;
28 QVideoFrameFormat::PixelFormat _pixelFormat = QVideoFrameFormat::Format_Invalid;
29 QMatrix4x4 _externalTextureMatrix;
30 bool _dirty = false;
31};
32
33class QGCVideoRenderNode : public QSGRenderNode
34{
35public:
38
39 void setFrame(QRhiTexture* texture, const QSize& frameSize, QVideoFrameFormat::PixelFormat pixelFormat,
40 const QMatrix4x4& externalTextureMatrix);
41
42 StateFlags changedStates() const override;
43 RenderingFlags flags() const override;
44 QRectF rect() const override;
45
46 void prepare() override;
47 void render(const RenderState* state) override;
48 void releaseResources() override;
49
50private:
51 QRhiTexture* _texture = nullptr;
52 QSize _frameSize;
53 QVideoFrameFormat::PixelFormat _pixelFormat = QVideoFrameFormat::Format_Invalid;
54 QMatrix4x4 _externalTextureMatrix;
55};
QSGNode * updatePaintNode(QSGNode *oldNode, UpdatePaintNodeData *data) override
~QGCVideoNodeItem() override
void setCurrentTexture(QRhiTexture *texture, const QSize &frameSize, QVideoFrameFormat::PixelFormat pixelFormat, const QMatrix4x4 &externalTextureMatrix)
void prepare() override
void setFrame(QRhiTexture *texture, const QSize &frameSize, QVideoFrameFormat::PixelFormat pixelFormat, const QMatrix4x4 &externalTextureMatrix)
~QGCVideoRenderNode() override
QRectF rect() const override
StateFlags changedStates() const override
RenderingFlags flags() const override
void releaseResources() override
void render(const RenderState *state) override