6#include <QtGui/qguiapplication.h>
12#include <gst/video/videooverlay.h>
14#include <QtMultimedia/private/qtmultimediaglobal_p.h>
27 {
"xcb",
"xvimagesink" },
28 {
"xcb",
"ximagesink" },
31 {
"wayland",
"waylandsink" }
36 GstStateChangeReturn
ret = element.
setState(GST_STATE_READY);
37 if (
ret == GST_STATE_CHANGE_SUCCESS) {
71 GstElementFactory *
f = GST_ELEMENT_FACTORY(
item->
data);
73 if (!gst_element_factory_has_interface(
f,
"GstVideoOverlay"))
76 choice =
QGstElement(gst_element_factory_create(
f,
nullptr));
85 gst_plugin_feature_list_free(
list);
87 qWarning() <<
"Could not find a valid windowed video sink";
95 , m_gstreamerVideoSink(
parent)
108 if (!m_videoSink.
isNull()) {
129 auto *klass = G_OBJECT_GET_CLASS(m_videoSink.
object());
130 m_hasForceAspectRatio = g_object_class_find_property(klass,
"force-aspect-ratio");
131 m_hasFullscreen = g_object_class_find_property(klass,
"fullscreen");
136 return m_nativeVideoSize;
143 if (!m_videoSink.
isNull() && GST_IS_VIDEO_OVERLAY(m_videoSink.
object())) {
159void QGstreamerVideoOverlay::applyRenderRect()
174 QSize scaledVideo = m_nativeVideoSize.
scaled(
w,
h, m_aspectRatioMode);
175 x += (
w - scaledVideo.
width())/2;
181 if (!m_videoSink.
isNull() && GST_IS_VIDEO_OVERLAY(m_videoSink.
object()))
182 gst_video_overlay_set_render_rectangle(GST_VIDEO_OVERLAY(m_videoSink.
object()),
x,
y,
w,
h);
188 if (
size != m_nativeVideoSize) {
189 m_nativeVideoSize =
size;
197 m_aspectRatioMode =
mode;
198 if (m_hasForceAspectRatio)
204 m_fullScreen = fullscreen;
206 m_videoSink.
set(
"fullscreen", fullscreen);
211 if (!gst_is_video_overlay_prepare_window_handle_message(
message.rawMessage()))
213 gst_video_overlay_set_window_handle(GST_VIDEO_OVERLAY(m_videoSink.
object()), m_windowId);
219#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.
QVariant data(int key) const
Returns this item's custom data for the key key as a QVariant.
QGstStructure at(int index) const
GstStateChangeReturn setState(GstState state)
QGstPad staticPad(const char *name) const
void set(const char *property, const char *str)
GstObject * object() const
Q_MULTIMEDIA_EXPORT QSize resolution() const
void removeProbeFromPad(GstPad *pad)
void addProbeToPad(GstPad *pad, bool downstream=true)
QSize nativeVideoSize() const
void setWindowHandle(WId id)
QGstElement videoSink() const
void setVideoSink(QGstElement)
virtual ~QGstreamerVideoOverlay()
void setAspectRatioMode(Qt::AspectRatioMode mode)
QGstreamerVideoOverlay(QGstreamerVideoSink *parent=0, const QByteArray &elementName=QByteArray())
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 height() const noexcept
Returns the height.
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
QLatin1StringView QLatin1String
const char * gstreamerElement
IUIAutomationTreeWalker __RPC__deref_out_opt IUIAutomationElement ** parent