Qt
Internal/Contributor docs for the Qt SDK. <b>Note:</b> These are NOT official API docs; those are found <a href='https://doc.qt.io/'>here</a>.
Loading...
Searching...
No Matches
qgstvideorenderersink_p.h
Go to the documentation of this file.
1// Copyright (C) 2016 Jolla 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 QGSTVIDEORENDERERSINK_P_H
5#define QGSTVIDEORENDERERSINK_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 <QtMultimedia/qvideoframeformat.h>
19#include <QtMultimedia/qvideoframe.h>
20#include <QtMultimedia/private/qtmultimediaglobal_p.h>
21#include <QtCore/qmutex.h>
22
23#include <gst/video/gstvideosink.h>
24#include <gst/video/video.h>
25
26#include <QtCore/qlist.h>
27#include <QtCore/qmutex.h>
28#include <QtCore/qqueue.h>
29#include <QtCore/qpointer.h>
30#include <QtCore/qwaitcondition.h>
31#include <qvideoframeformat.h>
32#include <qvideoframe.h>
34#include <common/qgst_p.h>
35
37
39{
40public:
43
44 const QGstCaps &caps();
45
46 bool start(const QGstCaps &);
47 void stop();
48 void unlock();
49 bool proposeAllocation(GstQuery *);
50 GstFlowReturn render(GstBuffer *);
51 bool query(GstQuery *);
52 void gstEvent(GstEvent *);
53
54private:
55 void notify();
56 static QGstCaps createSurfaceCaps(QGstreamerVideoSink *);
57
58 void gstEventHandleTag(GstEvent *);
59 void gstEventHandleEOS(GstEvent *);
60
61 QMutex m_sinkMutex;
62 QGstreamerVideoSink *m_sink = nullptr; // written only from qt thread. so only readers on
63 // worker threads need to acquire the lock
64
65 // --- only accessed from gstreamer thread
66 const QGstCaps m_surfaceCaps;
67 QVideoFrameFormat m_format;
68 GstVideoInfo m_videoInfo{};
70 bool m_frameMirrored = false;
71 QtVideo::Rotation m_frameRotationAngle = QtVideo::Rotation::None;
72
73 // --- only accessed from qt thread
74 QVideoFrame m_currentVideoFrame;
75};
76
78{
79public:
80 GstVideoSink parent{};
81
83 static void setSink(QGstreamerVideoSink *surface);
84
85private:
86 static GType get_type();
87 static void class_init(gpointer g_class, gpointer class_data);
88 static void base_init(gpointer g_class);
89 static void instance_init(GTypeInstance *instance, gpointer g_class);
90
91 static void finalize(GObject *object);
92
93 static GstStateChangeReturn change_state(GstElement *element, GstStateChange transition);
94
95 static GstCaps *get_caps(GstBaseSink *sink, GstCaps *filter);
96 static gboolean set_caps(GstBaseSink *sink, GstCaps *caps);
97
98 static gboolean propose_allocation(GstBaseSink *sink, GstQuery *query);
99
100 static gboolean stop(GstBaseSink *sink);
101
102 static gboolean unlock(GstBaseSink *sink);
103
104 static GstFlowReturn show_frame(GstVideoSink *sink, GstBuffer *buffer);
105 static gboolean query(GstBaseSink *element, GstQuery *query);
106 static gboolean event(GstBaseSink *element, GstEvent * event);
107
108private:
109 QGstVideoRenderer *renderer = nullptr;
110};
111
112
114{
115public:
116 GstVideoSinkClass parent_class;
117};
118
120
121#endif
MemoryFormat
Definition qgst_p.h:353
@ CpuMemory
Definition qgst_p.h:353
static QGstVideoRendererSink * createSink(QGstreamerVideoSink *surface)
static void setSink(QGstreamerVideoSink *surface)
GstFlowReturn render(GstBuffer *)
QGstVideoRenderer(QGstreamerVideoSink *)
bool proposeAllocation(GstQuery *)
\inmodule QtCore
Definition qmutex.h:281
\inmodule QtCore
Definition qobject.h:103
The QVideoFrameFormat class specifies the stream format of a video presentation surface.
The QVideoFrame class represents a frame of video data.
Definition qvideoframe.h:27
Combined button and popup list for selecting options.
GLenum GLuint buffer
GLint GLint GLint GLint GLint GLint GLint GLbitfield GLenum filter
GLuint start
struct _cl_event * event
GLenum query
GLsizei GLenum GLboolean sink
mutex unlock()