diff options
author | Mathias Hasselmann <mathias.hasselmann@kdab.com> | 2013-09-13 09:41:50 +0200 |
---|---|---|
committer | Mathias Hasselmann <mathias.hasselmann@kdab.com> | 2013-09-13 17:16:31 +0200 |
commit | 3e994fc52234a25d41427ce3af1eb6b97aa31369 (patch) | |
tree | ca8b6e77f54781869704e4fd0cffa0b7d604ca04 | |
parent | 1d03978a348e436580c3eac3d8df01b5aa3be8a7 (diff) |
With Qt5 QGLContext is marked as "done". More importantly QtQuick2 is based
upon the new QOpenGLContext.
FIXME: For upstreaming this patch still needs quite some cleanups, like
conditional complication guards. It also might make sense to introduce
an additional "openglcontext" property, instead of changing the type of
"glcontext". Additionally one also has to decide how to deal with all
those (for our purposes unrelated) classes that depend on a QGLWidget
internally.
-rw-r--r-- | elements/gstqtvideosink/gstqtglvideosink.cpp | 2 | ||||
-rw-r--r-- | elements/gstqtvideosink/openglsurfacepainter.cpp | 17 | ||||
-rw-r--r-- | elements/gstqtvideosink/qtvideosinkdelegate.cpp | 13 | ||||
-rw-r--r-- | elements/gstqtvideosink/qtvideosinkdelegate.h | 8 | ||||
-rw-r--r-- | src/QGst/Ui/graphicsvideosurface.cpp | 3 | ||||
-rw-r--r-- | src/QGst/Ui/videowidget.cpp | 3 |
6 files changed, 25 insertions, 21 deletions
diff --git a/elements/gstqtvideosink/gstqtglvideosink.cpp b/elements/gstqtvideosink/gstqtglvideosink.cpp index f7786ae..e74d312 100644 --- a/elements/gstqtvideosink/gstqtglvideosink.cpp +++ b/elements/gstqtvideosink/gstqtglvideosink.cpp @@ -125,7 +125,7 @@ void GstQtGLVideoSink::set_property(GObject *object, guint prop_id, switch (prop_id) { case PROP_GLCONTEXT: - sinkBase->delegate->setGLContext(static_cast<QGLContext*>(g_value_get_pointer(value))); + sinkBase->delegate->setGLContext(static_cast<QOpenGLContext*>(g_value_get_pointer(value))); break; default: G_OBJECT_WARN_INVALID_PROPERTY_ID(object, prop_id, pspec); diff --git a/elements/gstqtvideosink/openglsurfacepainter.cpp b/elements/gstqtvideosink/openglsurfacepainter.cpp index b3598ec..63a0d21 100644 --- a/elements/gstqtvideosink/openglsurfacepainter.cpp +++ b/elements/gstqtvideosink/openglsurfacepainter.cpp @@ -16,6 +16,7 @@ */ #include "openglsurfacepainter.h" #include <QtCore/qmath.h> +#include <QOpenGLContext> #ifndef GL_TEXTURE0 # define GL_TEXTURE0 0x84C0 @@ -51,8 +52,8 @@ OpenGLSurfacePainter::OpenGLSurfacePainter() , m_videoColorMatrix(GST_VIDEO_COLOR_MATRIX_UNKNOWN) { #ifndef QT_OPENGL_ES - glActiveTexture = (_glActiveTexture) QGLContext::currentContext()->getProcAddress( - QLatin1String("glActiveTexture")); + glActiveTexture = (_glActiveTexture) QOpenGLContext::currentContext()->getProcAddress( + "glActiveTexture"); #endif } @@ -382,18 +383,18 @@ ArbFpSurfacePainter::ArbFpSurfacePainter() : OpenGLSurfacePainter() , m_programId(0) { - const QGLContext *context = QGLContext::currentContext(); + const QOpenGLContext *context = QOpenGLContext::currentContext(); glProgramStringARB = (_glProgramStringARB) context->getProcAddress( - QLatin1String("glProgramStringARB")); + "glProgramStringARB"); glBindProgramARB = (_glBindProgramARB) context->getProcAddress( - QLatin1String("glBindProgramARB")); + "glBindProgramARB"); glDeleteProgramsARB = (_glDeleteProgramsARB) context->getProcAddress( - QLatin1String("glDeleteProgramsARB")); + "glDeleteProgramsARB"); glGenProgramsARB = (_glGenProgramsARB) context->getProcAddress( - QLatin1String("glGenProgramsARB")); + "glGenProgramsARB"); glProgramLocalParameter4fARB = (_glProgramLocalParameter4fARB) context->getProcAddress( - QLatin1String("glProgramLocalParameter4fARB")); + "glProgramLocalParameter4fARB"); } void ArbFpSurfacePainter::init(const BufferFormat &format) diff --git a/elements/gstqtvideosink/qtvideosinkdelegate.cpp b/elements/gstqtvideosink/qtvideosinkdelegate.cpp index 24d581e..be765ea 100644 --- a/elements/gstqtvideosink/qtvideosinkdelegate.cpp +++ b/elements/gstqtvideosink/qtvideosinkdelegate.cpp @@ -24,6 +24,7 @@ #include <QCoreApplication> #include <QStack> #include <QPainter> +#include <QOpenGLContext> #define QSIZE_FORMAT "(%d x %d)" #define QSIZE_FORMAT_ARGS(size) \ @@ -173,7 +174,7 @@ void QtVideoSinkDelegate::paint(QPainter *painter, const QRectF & targetArea) #ifndef GST_QT_VIDEO_SINK_NO_OPENGL if (m_glContext) { - Q_ASSERT_X(m_glContext == QGLContext::currentContext(), + Q_ASSERT_X(m_glContext == QOpenGLContext::currentContext(), "qtvideosink - paint", "Please use a QPainter that is initialized to paint on the " "GL surface that has the same context as the one given on the glcontext property" @@ -258,12 +259,12 @@ void QtVideoSinkDelegate::paint(QPainter *painter, const QRectF & targetArea) #ifndef GST_QT_VIDEO_SINK_NO_OPENGL -QGLContext *QtVideoSinkDelegate::glContext() const +QOpenGLContext *QtVideoSinkDelegate::glContext() const { return m_glContext; } -void QtVideoSinkDelegate::setGLContext(QGLContext *context) +void QtVideoSinkDelegate::setGLContext(QOpenGLContext *context) { if (m_glContext == context) return; @@ -272,7 +273,7 @@ void QtVideoSinkDelegate::setGLContext(QGLContext *context) m_supportedPainters = Generic; if (m_glContext) { - m_glContext->makeCurrent(); +// m_glContext->makeCurrent(); const QByteArray extensions(reinterpret_cast<const char *>(glGetString(GL_EXTENSIONS))); GST_LOG_OBJECT(m_sink, "Available GL extensions: %s", extensions.constData()); @@ -283,8 +284,8 @@ void QtVideoSinkDelegate::setGLContext(QGLContext *context) #endif #ifndef QT_OPENGL_ES_2 - if (QGLShaderProgram::hasOpenGLShaderPrograms(m_glContext) - && extensions.contains("ARB_shader_objects")) + if (/*QGLShaderProgram::hasOpenGLShaderPrograms(m_glContext) + &&*/ extensions.contains("ARB_shader_objects")) #endif m_supportedPainters |= Glsl; } diff --git a/elements/gstqtvideosink/qtvideosinkdelegate.h b/elements/gstqtvideosink/qtvideosinkdelegate.h index 5ae342f..f5f6ee7 100644 --- a/elements/gstqtvideosink/qtvideosinkdelegate.h +++ b/elements/gstqtvideosink/qtvideosinkdelegate.h @@ -27,7 +27,7 @@ #include <QSet> #include <QReadWriteLock> -class QGLContext; +class QOpenGLContext; class QtVideoSinkDelegate : public QObject @@ -110,8 +110,8 @@ public: #ifndef GST_QT_VIDEO_SINK_NO_OPENGL // glcontext property - QGLContext *glContext() const; - void setGLContext(QGLContext *context); + QOpenGLContext *glContext() const; + void setGLContext(QOpenGLContext *context); #endif // paint action @@ -132,7 +132,7 @@ private: PainterTypes m_supportedPainters; #ifndef GST_QT_VIDEO_SINK_NO_OPENGL - QGLContext *m_glContext; + QOpenGLContext *m_glContext; #endif // colorbalance interface properties diff --git a/src/QGst/Ui/graphicsvideosurface.cpp b/src/QGst/Ui/graphicsvideosurface.cpp index 74b2d97..4f1c0c4 100644 --- a/src/QGst/Ui/graphicsvideosurface.cpp +++ b/src/QGst/Ui/graphicsvideosurface.cpp @@ -21,6 +21,7 @@ #ifndef QTGSTREAMER_UI_NO_OPENGL # include <QtOpenGL/QGLWidget> +#include <QOpenGLContext> #endif namespace QGst { @@ -52,7 +53,7 @@ ElementPtr GraphicsVideoSurface::videoSink() const if (!d->videoSink.isNull()) { glw->makeCurrent(); - d->videoSink->setProperty("glcontext", (void*) QGLContext::currentContext()); + d->videoSink->setProperty("glcontext", (void*) QOpenGLContext::currentContext()); glw->doneCurrent(); if (d->videoSink->setState(QGst::StateReady) != QGst::StateChangeSuccess) { diff --git a/src/QGst/Ui/videowidget.cpp b/src/QGst/Ui/videowidget.cpp index 75435b5..bb783fd 100644 --- a/src/QGst/Ui/videowidget.cpp +++ b/src/QGst/Ui/videowidget.cpp @@ -40,6 +40,7 @@ #ifndef QTGSTREAMER_UI_NO_OPENGL # include <QtOpenGL/QGLWidget> +# include <QOpenGLContext> #endif namespace QGst { @@ -186,7 +187,7 @@ public: m_renderer = new QtVideoSinkRenderer(sink, m_glWidget); m_glWidget->makeCurrent(); - sink->setProperty("glcontext", (void*) QGLContext::currentContext()); + sink->setProperty("glcontext", (void*) QOpenGLContext::currentContext()); m_glWidget->doneCurrent(); } |