Qt
Internal/Contributor docs for the Qt SDK. Note: These are NOT official API docs; those are found at https://doc.qt.io/
Loading...
Searching...
No Matches
qgstreamervideosink_p.h
Go to the documentation of this file.
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#include <QtMultimedia/private/qthreadlocalrhi_p.h>
21
22#include <common/qgstvideorenderersink_p.h>
23#include <common/qgstpipeline_p.h>
24
26
28{
30
31public:
33
34 void setRhi(QRhi *rhi) override;
35 QRhi *rhi() const;
36
37private:
38 QRhi *m_rhi = nullptr;
39};
40
42{
45
46public:
47 explicit QGstreamerRelayVideoSink(QObject *parent = nullptr);
49
50 QRhi *rhi() const { return m_rhi ? m_rhi : qEnsureThreadLocalRhi(); }
51
53
54 GstContext *gstGlDisplayContext() const { return m_gstGlDisplayContext.get(); }
55 GstContext *gstGlLocalContext() const { return m_gstGlLocalContext.get(); }
56 Qt::HANDLE eglDisplay() const { return m_eglDisplay; }
57 QFunctionPointer eglImageTargetTexture2D() const { return m_eglImageTargetTexture2D; }
58
59 void setActive(bool);
60 void setAsync(bool);
61
64 void setVideoFrame(const QVideoFrame &frame);
65 void setSubtitleText(const QString &subtitleText);
66 void setNativeSize(QSize size);
67
70 void videoFrameChanged(const QVideoFrame &frame);
71 void subtitleTextChanged(const QString &subtitleText);
72 void nativeSizeChanged(QSize size);
73
74private:
75 void createQtSink();
76 void updateSinkElement(QGstVideoRendererSinkElement newSink);
77
78 void unrefGstContexts();
79 void updateGstContexts();
80
81 void renderingRhiChanged(QRhi *rhi);
82
83 QGstBin m_sinkBin;
84 QGstElement m_gstPreprocess;
85 QGstElement m_gstCapsFilter;
86 QGstElement m_gstVideoSink;
88
89 QRhi *m_rhi = nullptr;
90 bool m_isActive = true;
91 bool m_sinkIsAsync = true;
92
93 Qt::HANDLE m_eglDisplay = nullptr;
94 QFunctionPointer m_eglImageTargetTexture2D = nullptr;
95
96 QGstContextHandle m_gstGlLocalContext;
97 QGstContextHandle m_gstGlDisplayContext;
98
99 QVideoFrame m_currentVideoFrame;
100 QString m_currentSubtitleText;
101 QSize m_currentNativeSize;
102
103 QGstreamerPluggableVideoSink *m_pluggableVideoSink = nullptr;
104 QMetaObject::Connection m_rhiConnection;
105};
106
107QT_END_NAMESPACE
108
109#endif
QGstStructureView at(int index) const
Definition qgst.cpp:554
void removeFromParent()
Definition qgst.cpp:1271
bool syncStateWithParent()
Definition qgst.cpp:1088
QGstPad sink() const
Definition qgst.cpp:1040
static QGstElement createFromPipelineDescription(const char *)
Definition qgst.cpp:988
bool link(const QGstPad &sink) const
Definition qgst.cpp:835
QGstCaps queryCaps() const
Definition qgst.cpp:796
QGString streamId() const
Definition qgst.cpp:808
QGstElement gstElement() const
QUrl media() const override
bool processBusMessage(const QGstreamerMessage &message) override
PitchCompensationAvailability pitchCompensationAvailability() const override
void setPosition(qint64 pos) override
qreal playbackRate() const override
void setMedia(const QUrl &, QIODevice *) override
qint64 duration() const override
bool pitchCompensation() const override
void setPlaybackRate(qreal rate) override
QMediaTimeRange availablePlaybackRanges() const override
void setVideoSink(QVideoSink *sink) override
int trackCount(TrackType) override
const QGstPipeline & pipeline() const
float bufferProgress() const override
QMediaMetaData trackMetaData(TrackType, int) override
void setActiveTrack(TrackType, int) override
void setAudioOutput(QPlatformAudioOutput *output) override
const QIODevice * mediaStream() const override
int activeTrack(TrackType) override
QMediaMetaData metaData() const override
static q23::expected< QPlatformMediaPlayer *, QString > create(QMediaPlayer *parent=nullptr)
bool streamPlaybackSupported() const override
bool canPlayQrc() const override
void setRhi(QRhi *rhi) override
QGstreamerRelayVideoSink(QObject *parent=nullptr)
QFunctionPointer eglImageTargetTexture2D() const
void subtitleTextChanged(const QString &subtitleText)
void setVideoFrame(const QVideoFrame &frame)
void videoFrameChanged(const QVideoFrame &frame)
void setSubtitleText(const QString &subtitleText)
void connectPluggableVideoSink(QGstreamerPluggableVideoSink *pluggableSink)
void nativeSizeChanged(QSize size)
GstContext * gstGlDisplayContext() const
GstContext * gstGlLocalContext() const
void setVideoSink(QGstreamerRelayVideoSink *sink)
QGstreamerRelayVideoSink * gstreamerVideoSink() const
Combined button and popup list for selecting options.
std::optional< QGstreamerMediaPlayer::TrackType > toTrackType(const QGstCaps &caps)
void setSeekAccurate(T *config, gboolean accurate)
QT_BEGIN_NAMESPACE Q_STATIC_LOGGING_CATEGORY(lcSynthesizedIterableAccess, "qt.iterable.synthesized", QtWarningMsg)
QGstPlayMessageAdaptor(const QGstreamerMessage &m)