4#ifndef QGSTVIDEORENDERERSINK_P_H
5#define QGSTVIDEORENDERERSINK_P_H
18#include <QtMultimedia/qvideoframeformat.h>
19#include <QtMultimedia/qvideoframe.h>
20#include <QtMultimedia/private/qtmultimediaglobal_p.h>
21#include <QtCore/qcoreevent.h>
22#include <QtCore/qlist.h>
23#include <QtCore/qmutex.h>
24#include <QtCore/qpointer.h>
25#include <QtCore/qqueue.h>
26#include <QtCore/qwaitcondition.h>
28#include <gst/video/gstvideosink.h>
29#include <gst/video/video.h>
31#include <common/qgstvideobuffer_p.h>
32#include <common/qgst_p.h>
44 QMutexLocker locker(&mutex);
45 queue.append(std::move(value));
51 QMutexLocker locker(&mutex);
55 return queue.takeFirst();
60 QMutexLocker locker(&mutex);
73 struct RenderBufferState
75 QGstBufferHandle buffer;
76 QVideoFrameFormat format;
77 GstVideoInfo videoInfo;
80 bool operator==(
const RenderBufferState &rhs)
const
82 return std::tie(buffer, format, memoryFormat)
83 == std::tie(rhs.buffer, rhs.format, rhs.memoryFormat);
101 bool query(GstQuery *);
107 void updateCurrentVideoFrame(QVideoFrame);
113 void handleNewBuffer(RenderBufferState);
115 void gstEventHandleTag(GstEvent *);
116 void gstEventHandleEOS(GstEvent *);
117 void gstEventHandleFlushStart(GstEvent *);
118 void gstEventHandleFlushStop(GstEvent *);
126 QVideoFrameFormat m_format;
127 GstVideoInfo m_videoInfo{};
131 QVideoFrame m_currentPipelineFrame;
132 QVideoFrame m_currentVideoFrame;
133 bool m_isActive{
false };
136 bool m_flushing{
false };
151 static GType get_type();
152 static void class_init(gpointer g_class, gpointer class_data);
153 static void base_init(gpointer g_class);
154 static void instance_init(GTypeInstance *instance, gpointer g_class);
156 static void finalize(GObject *object);
158 static GstStateChangeReturn change_state(GstElement *element, GstStateChange transition);
160 static GstCaps *get_caps(GstBaseSink *sink, GstCaps *filter);
161 static gboolean set_caps(GstBaseSink *sink, GstCaps *caps);
163 static gboolean propose_allocation(GstBaseSink *sink, GstQuery *query);
165 static gboolean stop(GstBaseSink *sink);
167 static gboolean unlock(GstBaseSink *sink);
169 static GstFlowReturn show_frame(GstVideoSink *sink, GstBuffer *buffer);
170 static gboolean query(GstBaseSink *element, GstQuery *query);
171 static gboolean event(GstBaseSink *element, GstEvent *event);
QGstStructureView at(int index) const
bool syncStateWithParent()
static QGstElement createFromPipelineDescription(const char *)
bool link(const QGstPad &sink) const
QGstCaps queryCaps() const
qsizetype enqueue(T value)
std::optional< T > dequeue()
GstVideoSinkClass parent_class
QGstVideoRendererSinkElement(QGstVideoRendererSinkElement &&) noexcept=default
QGstVideoRendererSinkElement(const QGstVideoRendererSinkElement &)=default
QGstVideoRendererSinkElement & operator=(QGstVideoRendererSinkElement &&) noexcept=default
QGstVideoRendererSinkElement & operator=(const QGstVideoRendererSinkElement &)=default
QGstVideoRendererSinkElement(QGstVideoRendererSink *, RefMode)
QGstVideoRendererSink * qGstVideoRendererSink() const
static QGstVideoRendererSinkElement createSink(QGstreamerVideoSink *surface)
GstFlowReturn render(GstBuffer *)
~QGstVideoRenderer() override
QGstVideoRenderer(QGstreamerVideoSink *)
void customEvent(QEvent *) override
This event handler can be reimplemented in a subclass to receive custom events.
bool start(const QGstCaps &)
void gstEvent(GstEvent *)
bool proposeAllocation(GstQuery *)
QGstElement gstElement() const
QGstreamerVideoSink * gstreamerVideoSink() const
QGstElement gstElement() const
void setNativeSize(QSize)
~QGstreamerVideoOutput() override
void updateSubtitle(QString) override
void setVideoSink(QVideoSink *sink)
void setRotation(QtVideo::Rotation)
QGstElement gstSubtitleElement() const
~QGstreamerVideoSink() override
GstContext * gstGlLocalContext() const
GstContext * gstGlDisplayContext() const
void setRhi(QRhi *rhi) override
QFunctionPointer eglImageTargetTexture2D() const
Qt::HANDLE eglDisplay() const
std::optional< QGstreamerMediaPlayer::TrackType > toTrackType(const QGstCaps &caps)
Q_STATIC_LOGGING_CATEGORY(lcAccessibilityCore, "qt.accessibility.core")