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 QGSTREAMERVIDEOSINK_H
5#define QGSTREAMERVIDEOSINK_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 <QtMultimedia/qvideosink.h>
19#include <QtMultimedia/private/qplatformvideosink_p.h>
20
21#include <common/qgstvideorenderersink_p.h>
22#include <common/qgstpipeline_p.h>
23
24QT_BEGIN_NAMESPACE
25
26class QGstreamerVideoSink : public QPlatformVideoSink
27{
28 Q_OBJECT
29
30public:
31 explicit QGstreamerVideoSink(QVideoSink *parent = nullptr);
32 ~QGstreamerVideoSink();
33
34 void setRhi(QRhi *rhi) override;
35 QRhi *rhi() const { return m_rhi; }
36
37 QGstElement gstSink();
38
39 GstContext *gstGlDisplayContext() const { return m_gstGlDisplayContext.get(); }
40 GstContext *gstGlLocalContext() const { return m_gstGlLocalContext.get(); }
41 Qt::HANDLE eglDisplay() const { return m_eglDisplay; }
42 QFunctionPointer eglImageTargetTexture2D() const { return m_eglImageTargetTexture2D; }
43
44 void setActive(bool);
45 void setAsync(bool);
46
47Q_SIGNALS:
48 void aboutToBeDestroyed();
49
50private:
51 void createQtSink();
52 void updateSinkElement(QGstVideoRendererSinkElement newSink);
53
54 void unrefGstContexts();
55 void updateGstContexts();
56
57 QGstBin m_sinkBin;
58 QGstElement m_gstPreprocess;
59 QGstElement m_gstCapsFilter;
60 QGstElement m_gstVideoSink;
61 QGstVideoRendererSinkElement m_gstQtSink;
62
63 QRhi *m_rhi = nullptr;
64 bool m_isActive = true;
65 bool m_sinkIsAsync = true;
66
67 Qt::HANDLE m_eglDisplay = nullptr;
68 QFunctionPointer m_eglImageTargetTexture2D = nullptr;
69
70 QGstContextHandle m_gstGlLocalContext;
71 QGstContextHandle m_gstGlDisplayContext;
72};
73
74QT_END_NAMESPACE
75
76#endif
77

Provided by KDAB

Privacy Policy
Learn Advanced QML with KDAB
Find out more

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