| 1 | // Copyright (C) 2016 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 QGSTVIDEOBUFFER_P_H |
| 5 | #define QGSTVIDEOBUFFER_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 <private/qhwvideobuffer_p.h> |
| 19 | #include <QtCore/qvariant.h> |
| 20 | |
| 21 | #include <common/qgst_p.h> |
| 22 | #include <gst/video/video.h> |
| 23 | |
| 24 | QT_BEGIN_NAMESPACE |
| 25 | class QVideoFrameFormat; |
| 26 | class QGstreamerVideoSink; |
| 27 | class QOpenGLContext; |
| 28 | |
| 29 | class QGstVideoBuffer final : public QHwVideoBuffer |
| 30 | { |
| 31 | public: |
| 32 | QGstVideoBuffer(QGstBufferHandle buffer, const GstVideoInfo &info, QGstreamerVideoSink *sink, |
| 33 | const QVideoFrameFormat &frameFormat, QGstCaps::MemoryFormat format); |
| 34 | ~QGstVideoBuffer() override; |
| 35 | |
| 36 | MapData map(QVideoFrame::MapMode mode) override; |
| 37 | void unmap() override; |
| 38 | |
| 39 | QVideoFrameTexturesUPtr mapTextures(QRhi &, QVideoFrameTexturesUPtr& /*oldTextures*/) override; |
| 40 | |
| 41 | private: |
| 42 | const QGstCaps::MemoryFormat memoryFormat = QGstCaps::CpuMemory; |
| 43 | const QVideoFrameFormat m_frameFormat; |
| 44 | QRhi *m_rhi = nullptr; |
| 45 | mutable GstVideoInfo m_videoInfo; |
| 46 | mutable GstVideoFrame m_frame{}; |
| 47 | const QGstBufferHandle m_buffer; |
| 48 | QVideoFrame::MapMode m_mode = QVideoFrame::NotMapped; |
| 49 | Qt::HANDLE eglDisplay = nullptr; |
| 50 | QFunctionPointer eglImageTargetTexture2D = nullptr; |
| 51 | }; |
| 52 | |
| 53 | QT_END_NAMESPACE |
| 54 | |
| 55 | #endif |
| 56 |
