Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/GStreamer/gst-plugins-good.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/ext
diff options
context:
space:
mode:
authorMatthew Waters <matthew@centricular.com>2021-05-03 10:39:05 +0300
committerGStreamer Marge Bot <gitlab-merge-bot@gstreamer-foundation.org>2021-05-11 09:40:38 +0300
commitc7181bedac0cca6e5e59953e78727610c9bdf241 (patch)
tree01bdba9e5e25bd21168f27e392183b3fc0c66278 /ext
parent0ff50d672319ff8121ca9c210acfe0843e2d1776 (diff)
qt: return a different GstGLDisplay object when the first sink requests
This allows the 'replace-gstreamer-opengl-context' context machinery to correctly replace the OpenGL context used by the pipeline when the first qmlglsink is added to the pipeline. Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-good/-/merge_requests/982>
Diffstat (limited to 'ext')
-rw-r--r--ext/qt/gstqtglutility.cc14
-rw-r--r--ext/qt/gstqtglutility.h2
-rw-r--r--ext/qt/gstqtoverlay.cc2
-rw-r--r--ext/qt/qtitem.cc2
-rw-r--r--ext/qt/qtwindow.cc2
5 files changed, 14 insertions, 8 deletions
diff --git a/ext/qt/gstqtglutility.cc b/ext/qt/gstqtglutility.cc
index d2c092202..6d413bce2 100644
--- a/ext/qt/gstqtglutility.cc
+++ b/ext/qt/gstqtglutility.cc
@@ -60,9 +60,10 @@ GST_DEBUG_CATEGORY_STATIC (GST_CAT_DEFAULT);
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 ());
@@ -80,9 +81,14 @@ gst_qt_get_gl_display ()
/* 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());
diff --git a/ext/qt/gstqtglutility.h b/ext/qt/gstqtglutility.h
index 9a509545d..6b878ca7a 100644
--- a/ext/qt/gstqtglutility.h
+++ b/ext/qt/gstqtglutility.h
@@ -28,7 +28,7 @@
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);
diff --git a/ext/qt/gstqtoverlay.cc b/ext/qt/gstqtoverlay.cc
index 6a0e4e707..3b6dea329 100644
--- a/ext/qt/gstqtoverlay.cc
+++ b/ext/qt/gstqtoverlay.cc
@@ -468,7 +468,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 (FALSE);
if (display != filter->display)
/* always propagate. The application may need to choose between window
diff --git a/ext/qt/qtitem.cc b/ext/qt/qtitem.cc
index 5b23714c9..726296da3 100644
--- a/ext/qt/qtitem.cc
+++ b/ext/qt/qtitem.cc
@@ -129,7 +129,7 @@ QtGLVideoItem::QtGLVideoItem()
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*)));
diff --git a/ext/qt/qtwindow.cc b/ext/qt/qtwindow.cc
index 7c44ac54e..aec6ba765 100644
--- a/ext/qt/qtwindow.cc
+++ b/ext/qt/qtwindow.cc
@@ -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(FALSE);
connect (source, SIGNAL(beforeRendering()), this, SLOT(beforeRendering()), Qt::DirectConnection);
connect (source, SIGNAL(afterRendering()), this, SLOT(afterRendering()), Qt::DirectConnection);