Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-good/-/merge_requests/1032>
#include <gst/gl/gl.h>
#include <QVariant>
+#include <QRunnable>
G_BEGIN_DECLS
+struct RenderJob : public QRunnable {
+ using Callable = std::function<void()>;
+
+ explicit RenderJob(Callable c) : _c(c) { }
+
+ void run() { _c(); }
+
+private:
+ Callable _c;
+};
+
GstGLDisplay * gst_qt_get_gl_display (gboolean sink);
gboolean gst_qt_get_gl_wrapcontext (GstGLDisplay * display,
GstGLContext **wrap_glcontext, GstGLContext **context);
#include "gstqsgtexture.h"
#include "gstqtglutility.h"
-#include <QtCore/QRunnable>
#include <QtCore/QMutexLocker>
#include <QtCore/QPointer>
#include <QtGui/QGuiApplication>
GQueue potentially_unbound_buffers;
};
-class InitializeSceneGraph : public QRunnable
-{
-public:
- InitializeSceneGraph(QtGLVideoItem *item);
- void run();
-
-private:
- QPointer<QtGLVideoItem> item_;
-};
-
-InitializeSceneGraph::InitializeSceneGraph(QtGLVideoItem *item) :
- item_(item)
-{
-}
-
-void InitializeSceneGraph::run()
-{
- if(item_)
- item_->onSceneGraphInitialized();
-}
-
QtGLVideoItem::QtGLVideoItem()
{
static gsize _debug;
{
if (win) {
if (win->isSceneGraphInitialized())
- win->scheduleRenderJob(new InitializeSceneGraph(this), QQuickWindow::BeforeSynchronizingStage);
+ win->scheduleRenderJob(new RenderJob(std::bind(&QtGLVideoItem::onSceneGraphInitialized, this)), QQuickWindow::BeforeSynchronizingStage);
else
connect(win, SIGNAL(sceneGraphInitialized()), this, SLOT(onSceneGraphInitialized()), Qt::DirectConnection);
QMutex lock;
};
-class InitializeSceneGraph;
-
class QtGLVideoItem : public QQuickItem, protected QOpenGLFunctions
{
Q_OBJECT
private:
- friend class InitializeSceneGraph;
void setViewportSize(const QSize &size);
void shareContext();
#include "gstqtglutility.h"
#include <QtCore/QDateTime>
-#include <QtCore/QRunnable>
#include <QtGui/QGuiApplication>
#include <QtQuick/QQuickWindow>
#include <QOpenGLFramebufferObject>
quint64 stop;
};
-class InitQtGLContext : public QRunnable
-{
-public:
- InitQtGLContext(QtGLWindow *window);
- void run();
-
-private:
- QtGLWindow *window_;
-};
-
-InitQtGLContext::InitQtGLContext(QtGLWindow *window) :
- window_(window)
-{
-}
-
-void InitQtGLContext::run()
-{
- window_->onSceneGraphInitialized();
-}
-
QtGLWindow::QtGLWindow ( QWindow * parent, QQuickWindow *src ) :
QQuickWindow( parent ), source (src)
{
connect (source, SIGNAL(afterRendering()), this, SLOT(afterRendering()), Qt::DirectConnection);
connect (app, SIGNAL(aboutToQuit()), this, SLOT(aboutToQuit()), Qt::DirectConnection);
if (source->isSceneGraphInitialized())
- source->scheduleRenderJob(new InitQtGLContext(this), QQuickWindow::BeforeSynchronizingStage);
+ source->scheduleRenderJob(new RenderJob(std::bind(&QtGLWindow::onSceneGraphInitialized, this)), QQuickWindow::BeforeSynchronizingStage);
else
connect (source, SIGNAL(sceneGraphInitialized()), this, SLOT(onSceneGraphInitialized()), Qt::DirectConnection);
typedef struct _QtGLWindowPrivate QtGLWindowPrivate;
-class InitQtGLContext;
-
class QtGLWindow : public QQuickWindow, protected QOpenGLFunctions
{
Q_OBJECT
void aboutToQuit();
private:
- friend class InitQtGLContext;
QQuickWindow * source;
QScopedPointer<QOpenGLFramebufferObject> fbo;
};