summaryrefslogtreecommitdiffstats
path: root/src/multimediawidgets
diff options
context:
space:
mode:
authorAndy Nichols <andy.nichols@digia.com>2012-11-19 16:26:38 +0100
committerThe Qt Project <gerrit-noreply@qt-project.org>2012-11-21 16:56:55 +0100
commit4c2346bbddc83e8a1f8baf9fc335280ed2dace5e (patch)
treee42910522240c94c946fa4b6236b909f08df899f /src/multimediawidgets
parent21c39152055131d87614f051ca08566bd51f268f (diff)
AVFoundation: Enable QImage based frame fallback
QGraphicsVideoItem was not working because the QPainterVideoSurface was unable to paint BGR32 format OpenGL textures. Now if the QGraphicsView window has a QGLWidget viewport, we use the GLTextureHandle to render the video, otherwise we fallback to the software QImage rendered case. Task-number: QTBUG-28017 Change-Id: I9304e0a2536f15075ae34cdd509ef24fbc18604e Reviewed-by: Yoann Lopes <yoann.lopes@digia.com>
Diffstat (limited to 'src/multimediawidgets')
-rw-r--r--src/multimediawidgets/qpaintervideosurface.cpp4
-rw-r--r--src/multimediawidgets/qpaintervideosurface_mac.mm3
2 files changed, 6 insertions, 1 deletions
diff --git a/src/multimediawidgets/qpaintervideosurface.cpp b/src/multimediawidgets/qpaintervideosurface.cpp
index 6f861820f..324ac3389 100644
--- a/src/multimediawidgets/qpaintervideosurface.cpp
+++ b/src/multimediawidgets/qpaintervideosurface.cpp
@@ -50,6 +50,7 @@
#if !defined(QT_NO_OPENGL) && !defined(QT_OPENGL_ES_1_CL) && !defined(QT_OPENGL_ES_1)
#include <qglshaderprogram.h>
+#include <QtGui/QOpenGLContext>
#ifndef GL_CLAMP_TO_EDGE
#define GL_CLAMP_TO_EDGE 0x812F
#endif
@@ -1567,6 +1568,9 @@ void QPainterVideoSurface::setGLContext(QGLContext *context)
m_shaderTypes = NoShaders;
if (m_glContext) {
+ //Set a dynamic property to access the OpenGL context
+ this->setProperty("GLContext", QVariant::fromValue<QObject*>(m_glContext->contextHandle()));
+
m_glContext->makeCurrent();
const QByteArray extensions(reinterpret_cast<const char *>(glGetString(GL_EXTENSIONS)));
diff --git a/src/multimediawidgets/qpaintervideosurface_mac.mm b/src/multimediawidgets/qpaintervideosurface_mac.mm
index f056d5fde..d63a7b409 100644
--- a/src/multimediawidgets/qpaintervideosurface_mac.mm
+++ b/src/multimediawidgets/qpaintervideosurface_mac.mm
@@ -71,6 +71,7 @@ QVideoSurfaceCoreGraphicsPainter::QVideoSurfaceCoreGraphicsPainter(bool glSuppor
<< QVideoFrame::Format_RGB32
<< QVideoFrame::Format_ARGB32
<< QVideoFrame::Format_ARGB32_Premultiplied
+ << QVideoFrame::Format_BGR32
<< QVideoFrame::Format_RGB24
<< QVideoFrame::Format_RGB565
<< QVideoFrame::Format_RGB555
@@ -112,7 +113,7 @@ QAbstractVideoSurface::Error QVideoSurfaceCoreGraphicsPainter::start(const QVide
m_scanLineDirection = format.scanLineDirection();
return m_supportedHandles.contains(format.handleType())
- && m_imageFormat != QImage::Format_Invalid
+ && ((m_imageFormat != QImage::Format_Invalid) || (format.handleType() == QAbstractVideoBuffer::GLTextureHandle))
&& !m_imageSize.isEmpty()
? QAbstractVideoSurface::NoError
: QAbstractVideoSurface::UnsupportedFormatError;