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 <private/qtmultimediaglobal_p.h>
19#include <private/qplatformvideosink_p.h>
20
21#include <qgstpipeline_p.h>
22#include <qgstreamervideooverlay_p.h>
23#include <QtGui/qcolor.h>
24#include <qvideosink.h>
25
26#if QT_CONFIG(gstreamer_gl)
27#include <gst/gl/gl.h>
28#endif
29
30QT_BEGIN_NAMESPACE
31class QGstreamerVideoRenderer;
32class QVideoWindow;
33
34class Q_MULTIMEDIA_EXPORT QGstreamerVideoSink
35 : public QPlatformVideoSink
36{
37 Q_OBJECT
38public:
39 explicit QGstreamerVideoSink(QVideoSink *parent = 0);
40 ~QGstreamerVideoSink();
41
42 void setRhi(QRhi *rhi) override;
43 QRhi *rhi() const { return m_rhi; }
44
45 QGstElement gstSink();
46 QGstElement subtitleSink() const { return gstSubtitleSink; }
47
48 void setPipeline(QGstPipeline pipeline);
49 bool inStoppedState() const;
50
51 GstContext *gstGlDisplayContext() const { return m_gstGlDisplayContext; }
52 GstContext *gstGlLocalContext() const { return m_gstGlLocalContext; }
53 Qt::HANDLE eglDisplay() const { return m_eglDisplay; }
54 QFunctionPointer eglImageTargetTexture2D() const { return m_eglImageTargetTexture2D; }
55
56private:
57 void createQtSink();
58 void updateSinkElement();
59
60 void unrefGstContexts();
61 void updateGstContexts();
62
63 QGstPipeline gstPipeline;
64 QGstBin sinkBin;
65 QGstElement gstQueue;
66 QGstElement gstPreprocess;
67 QGstElement gstVideoSink;
68 QGstElement gstQtSink;
69 QGstElement gstSubtitleSink;
70
71 QRhi *m_rhi = nullptr;
72
73 Qt::HANDLE m_eglDisplay = nullptr;
74 QFunctionPointer m_eglImageTargetTexture2D = nullptr;
75 GstContext *m_gstGlLocalContext = nullptr;
76 GstContext *m_gstGlDisplayContext = nullptr;
77};
78
79QT_END_NAMESPACE
80
81#endif
82

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