Commit 73439f16 authored by Sebastian Dröge's avatar Sebastian Dröge 🍵

qt: Get display for the given window instead of NULL

parent 656af791
Pipeline #241313 passed with stages
in 46 minutes
......@@ -62,7 +62,7 @@ G_LOCK_DEFINE_STATIC (display_lock);
static GWeakRef qt_display;
GstGLDisplay *
gst_qt_get_gl_display ()
gst_qt_get_gl_display (QWindow *window)
{
GstGLDisplay *display = NULL;
QGuiApplication *app = static_cast<QGuiApplication *> (QCoreApplication::instance ());
......@@ -99,7 +99,7 @@ gst_qt_get_gl_display ()
QPlatformNativeInterface *native =
QGuiApplication::platformNativeInterface();
wayland_display = (struct wl_display *)
native->nativeResourceForWindow("display", NULL);
native->nativeResourceForWindow("display", window);
display = (GstGLDisplay *)
gst_gl_display_wayland_new_with_display (wayland_display);
}
......@@ -137,7 +137,7 @@ gst_qt_get_gl_display ()
QPlatformNativeInterface *native =
QGuiApplication::platformNativeInterface();
EGLDisplay egl_display = (EGLDisplay)
native->nativeResourceForWindow("egldisplay", NULL);
native->nativeResourceForWindow("egldisplay", window);
if (egl_display != EGL_NO_DISPLAY)
display = (GstGLDisplay *) gst_gl_display_egl_new_with_egl_display (egl_display);
#else
......
......@@ -23,12 +23,13 @@
#include <gst/gst.h>
#include <gst/gl/gl.h>
#include <QWindow>
#include <QVariant>
G_BEGIN_DECLS
GstGLDisplay * gst_qt_get_gl_display ();
GstGLDisplay * gst_qt_get_gl_display (QWindow *window);
gboolean gst_qt_get_gl_wrapcontext (GstGLDisplay * display,
GstGLContext **wrap_glcontext, GstGLContext **context);
......
......@@ -453,7 +453,7 @@ gst_qt_overlay_change_state (GstElement * element,
return GST_STATE_CHANGE_FAILURE;
}
display = gst_qt_get_gl_display ();
display = gst_qt_get_gl_display (NULL);
if (display != filter->display)
/* always propagate. The application may need to choose between window
......
......@@ -129,8 +129,6 @@ QtGLVideoItem::QtGLVideoItem()
g_mutex_init (&this->priv->lock);
this->priv->display = gst_qt_get_gl_display();
connect(this, SIGNAL(windowChanged(QQuickWindow*)), this,
SLOT(handleWindowChanged(QQuickWindow*)));
......@@ -430,6 +428,7 @@ void
QtGLVideoItem::handleWindowChanged(QQuickWindow *win)
{
if (win) {
this->priv->display = gst_qt_get_gl_display(win);
if (win->isSceneGraphInitialized())
win->scheduleRenderJob(new InitializeSceneGraph(this), QQuickWindow::BeforeSynchronizingStage);
else
......@@ -437,6 +436,8 @@ QtGLVideoItem::handleWindowChanged(QQuickWindow *win)
connect(win, SIGNAL(sceneGraphInvalidated()), this, SLOT(onSceneGraphInvalidated()), Qt::DirectConnection);
} else {
if (this->priv->display)
gst_object_unref(this->priv->display);
this->priv->qt_context = NULL;
}
}
......
......@@ -117,7 +117,7 @@ QtGLWindow::QtGLWindow ( QWindow * parent, QQuickWindow *src ) :
g_mutex_init (&this->priv->lock);
g_cond_init (&this->priv->update_cond);
this->priv->display = gst_qt_get_gl_display();
this->priv->display = gst_qt_get_gl_display(parent);
connect (source, SIGNAL(beforeRendering()), this, SLOT(beforeRendering()), Qt::DirectConnection);
connect (source, SIGNAL(afterRendering()), this, SLOT(afterRendering()), Qt::DirectConnection);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment