6#include <QtGui/qguiapplication.h>
7#include <QtMultimedia/private/qtmultimediaglobal_p.h>
15#include <gst/video/videooverlay.h>
27 { u
"xcb",
"xvimagesink" },
28 { u
"xcb",
"ximagesink" },
31 { u
"wayland",
"waylandsink" },
36 GstStateChangeReturn
ret = element.
setState(GST_STATE_READY);
37 if (
ret == GST_STATE_CHANGE_SUCCESS) {
72 if (!gst_element_factory_has_interface(
f,
"GstVideoOverlay"))
84 gst_plugin_feature_list_free(
list);
86 qWarning() <<
"Could not find a valid windowed video sink";
94 , m_gstreamerVideoSink(parent)
107 if (!m_videoSink.
isNull()) {
123 m_videoSink = std::move(
sink);
128 auto *klass = G_OBJECT_GET_CLASS(m_videoSink.
object());
129 m_hasForceAspectRatio = g_object_class_find_property(klass,
"force-aspect-ratio");
130 m_hasFullscreen = g_object_class_find_property(klass,
"fullscreen");
135 return m_nativeVideoSize;
142 if (!m_videoSink.
isNull() && GST_IS_VIDEO_OVERLAY(m_videoSink.
object())) {
158void QGstreamerVideoOverlay::applyRenderRect()
173 QSize scaledVideo = m_nativeVideoSize.
scaled(
w,
h, m_aspectRatioMode);
174 x += (
w - scaledVideo.width())/2;
175 y += (
h - scaledVideo.height())/2;
177 h = scaledVideo.height();
180 if (!m_videoSink.
isNull() && GST_IS_VIDEO_OVERLAY(m_videoSink.
object()))
181 gst_video_overlay_set_render_rectangle(GST_VIDEO_OVERLAY(m_videoSink.
object()),
x,
y,
w,
h);
187 if (
size != m_nativeVideoSize) {
188 m_nativeVideoSize =
size;
196 m_aspectRatioMode =
mode;
197 if (m_hasForceAspectRatio)
203 m_fullScreen = fullscreen;
205 m_videoSink.
set(
"fullscreen", fullscreen);
210 if (!gst_is_video_overlay_prepare_window_handle_message(
message.message()))
212 gst_video_overlay_set_window_handle(GST_VIDEO_OVERLAY(m_videoSink.
object()), m_windowId);
218#include "moc_qgstreamervideooverlay_p.cpp"
const char * constData() const noexcept
Returns a pointer to the const data stored in the byte array.
bool isEmpty() const noexcept
Returns true if the byte array has size 0; otherwise returns false.
QGstStructure at(int index) const
GstStateChangeReturn setState(GstState state)
QGstPad staticPad(const char *name) const
static QGstElement createFromFactory(const char *factory, const char *name=nullptr)
void set(const char *property, const char *str)
GstObject * object() const
void removeProbeFromPad(GstPad *pad)
void addProbeToPad(GstPad *pad, bool downstream=true)
QSize nativeVideoSize() const
QGstreamerVideoOverlay(QGstreamerVideoSink *parent=nullptr, const QByteArray &elementName=QByteArray())
void setWindowHandle(WId id)
QGstElement videoSink() const
void setVideoSink(QGstElement)
virtual ~QGstreamerVideoOverlay()
void setAspectRatioMode(Qt::AspectRatioMode mode)
void setRenderRectangle(const QRect &rect)
bool processSyncMessage(const QGstreamerMessage &message) override
void probeCaps(GstCaps *caps) override
void setFullScreen(bool fullscreen)
QString platformName
The name of the underlying platform plugin.
\inmodule QtCore\reentrant
constexpr bool isEmpty() const noexcept
Returns true if the rectangle is empty, otherwise returns false.
constexpr int height() const noexcept
Returns the height of the rectangle.
constexpr int x() const noexcept
Returns the x-coordinate of the rectangle's left edge.
constexpr int width() const noexcept
Returns the width of the rectangle.
constexpr int y() const noexcept
Returns the y-coordinate of the rectangle's top edge.
constexpr int width() const noexcept
Returns the width.
QSize scaled(int w, int h, Qt::AspectRatioMode mode) const noexcept
\macro QT_RESTRICTED_CAST_FROM_ASCII
Combined button and popup list for selecting options.
static QGstElement findBestVideoSink()
static bool qt_gst_element_is_functioning(QGstElement element)
static constexpr ElementMap elementMap[]
GList * qt_gst_video_sinks()
GLint GLint GLint GLint GLint x
[0]
GLfloat GLfloat GLfloat w
[0]
GLenum GLuint GLintptr GLsizeiptr size
[1]
GLuint GLsizei const GLchar * message
GLfloat GLfloat GLfloat GLfloat h
GLsizei GLenum GLboolean sink
const char * gstreamerElement