G_LOCK_DEFINE_STATIC (display_lock);
static GWeakRef qt_display;
+static gboolean sink_retrieved = FALSE;
GstGLDisplay *
-gst_qt_get_gl_display ()
+gst_qt_get_gl_display (gboolean sink)
{
GstGLDisplay *display = NULL;
QGuiApplication *app = static_cast<QGuiApplication *> (QCoreApplication::instance ());
/* XXX: this assumes that only one display will ever be created by Qt */
display = static_cast<GstGLDisplay *>(g_weak_ref_get (&qt_display));
if (display) {
- GST_INFO ("returning previously created display");
- G_UNLOCK (display_lock);
- return display;
+ if (sink_retrieved) {
+ GST_INFO ("returning previously created display");
+ G_UNLOCK (display_lock);
+ return display;
+ } else if (sink) {
+ sink_retrieved = sink;
+ }
+ gst_clear_object (&display);
}
GST_INFO ("QGuiApplication::instance()->platformName() %s", app->platformName().toUtf8().data());
G_BEGIN_DECLS
-GstGLDisplay * gst_qt_get_gl_display ();
+GstGLDisplay * gst_qt_get_gl_display (gboolean sink);
gboolean gst_qt_get_gl_wrapcontext (GstGLDisplay * display,
GstGLContext **wrap_glcontext, GstGLContext **context);
return GST_STATE_CHANGE_FAILURE;
}
- display = gst_qt_get_gl_display ();
+ display = gst_qt_get_gl_display (FALSE);
if (display != filter->display)
/* always propagate. The application may need to choose between window
g_mutex_init (&this->priv->lock);
- this->priv->display = gst_qt_get_gl_display();
+ this->priv->display = gst_qt_get_gl_display(TRUE);
connect(this, SIGNAL(windowChanged(QQuickWindow*)), this,
SLOT(handleWindowChanged(QQuickWindow*)));
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(FALSE);
connect (source, SIGNAL(beforeRendering()), this, SLOT(beforeRendering()), Qt::DirectConnection);
connect (source, SIGNAL(afterRendering()), this, SLOT(afterRendering()), Qt::DirectConnection);