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/qtmultimediaglobal_p.h>
19#include <private/qabstractvideobuffer_p.h>
20#include <QtCore/qvariant.h>
21
22#include <qgst_p.h>
23#include <gst/video/video.h>
24
25QT_BEGIN_NAMESPACE
26class QVideoFrameFormat;
27class QGstreamerVideoSink;
28class QOpenGLContext;
29
30class Q_MULTIMEDIA_EXPORT QGstVideoBuffer : public QAbstractVideoBuffer
31{
32public:
33
34 QGstVideoBuffer(GstBuffer *buffer, const GstVideoInfo &info, QGstreamerVideoSink *sink,
35 const QVideoFrameFormat &frameFormat, QGstCaps::MemoryFormat format);
36 QGstVideoBuffer(GstBuffer *buffer, const QVideoFrameFormat &format, const GstVideoInfo &info)
37 : QGstVideoBuffer(buffer, info, nullptr, format, QGstCaps::CpuMemory)
38 {}
39 ~QGstVideoBuffer();
40
41 GstBuffer *buffer() const { return m_buffer; }
42 QVideoFrame::MapMode mapMode() const override;
43
44 MapData map(QVideoFrame::MapMode mode) override;
45 void unmap() override;
46
47 virtual std::unique_ptr<QVideoFrameTextures> mapTextures(QRhi *) override;
48private:
49 QGstCaps::MemoryFormat memoryFormat = QGstCaps::CpuMemory;
50 QVideoFrameFormat m_frameFormat;
51 QRhi *m_rhi = nullptr;
52 mutable GstVideoInfo m_videoInfo;
53 mutable GstVideoFrame m_frame;
54 GstBuffer *m_buffer = nullptr;
55 QVideoFrame::MapMode m_mode = QVideoFrame::NotMapped;
56 Qt::HANDLE eglDisplay = nullptr;
57 QFunctionPointer eglImageTargetTexture2D = nullptr;
58};
59
60QT_END_NAMESPACE
61
62#endif
63

source code of qtmultimedia/src/plugins/multimedia/gstreamer/common/qgstvideobuffer_p.h