Re-enabled CIImage based gfx video item on Mac
authorDmytro Poplavskiy <dmytro.poplavskiy@nokia.com>
Thu, 23 Aug 2012 05:59:18 +0000 (15:59 +1000)
committerQt by Nokia <qt-info@nokia.com>
Mon, 27 Aug 2012 05:59:42 +0000 (07:59 +0200)
Also prefer CoreImageHandle to GLTextureHandle
in QuickTime player backend, to avoid unnecessary
copy via FBO.

Change-Id: Id5aa039c438378b7bbf816b7845b05574683c471
Reviewed-by: Gunnar Sletta <gunnar.sletta@nokia.com>
src/multimediawidgets/multimediawidgets.pro
src/multimediawidgets/qpaintervideosurface.cpp
src/multimediawidgets/qpaintervideosurface_mac.mm
src/plugins/qt7/qt7movieviewrenderer.mm
tests/auto/unit/qpaintervideosurface/tst_qpaintervideosurface.cpp

index 8c5f69a..a913cbb 100644 (file)
@@ -31,8 +31,7 @@ SOURCES += \
     qvideowidget.cpp
 
 mac {
-    # QtWidgets is not yet supported on Mac (!).
-    false:!simulator {
+    !simulator {
         PRIVATE_HEADERS += qpaintervideosurface_mac_p.h
         OBJECTIVE_SOURCES += qpaintervideosurface_mac.mm
     }
index 8b37acb..c14d1c8 100644 (file)
@@ -209,7 +209,7 @@ void QVideoSurfaceGenericPainter::updateColors(int, int, int, int)
 
 #if !defined(QT_NO_OPENGL) && !defined(QT_OPENGL_ES_1_CL) && !defined(QT_OPENGL_ES_1)
 
-#ifndef Q_WS_MAC
+#ifndef Q_OS_MAC
 # ifndef APIENTRYP
 #   ifdef APIENTRY
 #     define APIENTRYP APIENTRY *
@@ -1673,7 +1673,7 @@ void QPainterVideoSurface::createPainter()
 {
     Q_ASSERT(!m_painter);
 
-#ifdef Q_WS_MAC
+#ifdef Q_OS_MAC
     if (m_glContext)
         m_glContext->makeCurrent();
 
index a741d9e..ee4d181 100644 (file)
@@ -134,6 +134,8 @@ QAbstractVideoSurface::Error QVideoSurfaceCoreGraphicsPainter::paint(
             const QRectF &target, QPainter *painter, const QRectF &source)
 {
     if (m_frame.handleType() == QAbstractVideoBuffer::CoreImageHandle) {
+//Non OpenGL CI rendering is disabled for now since qt_mac_cg_context is moved to platform plugin
+#ifdef ENABLE_CORE_GRAPHICS_VIDEO_RENDERING
         if (painter->paintEngine()->type() == QPaintEngine::CoreGraphics ) {
 
             CIImage *img = (CIImage*)(m_frame.handle().value<void*>());
@@ -168,7 +170,9 @@ QAbstractVideoSurface::Error QVideoSurfaceCoreGraphicsPainter::paint(
                     return QAbstractVideoSurface::NoError;
                 }
             }
-        } else if (painter->paintEngine()->type() == QPaintEngine::OpenGL2 ||
+        } else
+#endif
+        if (painter->paintEngine()->type() == QPaintEngine::OpenGL2 ||
                    painter->paintEngine()->type() == QPaintEngine::OpenGL) {
             CIImage *img = (CIImage*)(m_frame.handle().value<void*>());
 
index 3a6ff8a..31bea75 100644 (file)
@@ -330,11 +330,11 @@ void QT7MovieViewRenderer::setupVideoOutput()
         QAbstractVideoBuffer::HandleType handleType = QAbstractVideoBuffer::NoHandle;
         QVideoFrame::PixelFormat pixelFormat = QVideoFrame::Format_RGB32;
 
-        if (glTextureSupported) {
+        if (coreImageFrameSupported) {
+            handleType = QAbstractVideoBuffer::CoreImageHandle;
+        } else if (glTextureSupported) {
             handleType = QAbstractVideoBuffer::GLTextureHandle;
             pixelFormat = QVideoFrame::Format_BGR32;
-        } else if (coreImageFrameSupported) {
-            handleType = QAbstractVideoBuffer::CoreImageHandle;
         }
 
         QVideoSurfaceFormat format(m_nativeSize, pixelFormat, handleType);
index 096d040..8647133 100644 (file)
@@ -792,7 +792,7 @@ void tst_QPainterVideoSurface::shaderSupportedFormat_data()
                 << false
 #endif
                 << false;
-#ifndef Q_WS_MAC
+#ifndef Q_OS_MAC
         QTest::newRow((type.second + "YUV420P 640x480").constData())
                 << type.first
                 << QAbstractVideoBuffer::NoHandle
@@ -829,7 +829,7 @@ void tst_QPainterVideoSurface::shaderSupportedFormat_data()
                 << QSize(-640, 480)
                 << true
                 << false;
-#ifndef Q_WS_MAC
+#ifndef Q_OS_MAC
         QTest::newRow((type.second + "Texture: rgb565 32x32").constData())
                 << type.first
                 << QAbstractVideoBuffer::GLTextureHandle
@@ -852,7 +852,7 @@ void tst_QPainterVideoSurface::shaderSupportedFormat_data()
                 << QSize(256, 256)
                 << true
                 << true;
-#ifndef Q_WS_MAC
+#ifndef Q_OS_MAC
         QTest::newRow((type.second + "Texture: rgb24 1024x768").constData())
                 << type.first
                 << QAbstractVideoBuffer::GLTextureHandle
@@ -972,7 +972,7 @@ void tst_QPainterVideoSurface::shaderPresent_data()
                 << static_cast<const uchar *>(rgb565ImageData)
                 << int(sizeof(rgb565ImageData))
                 << 4;
-#ifndef Q_WS_MAC
+#ifndef Q_OS_MAC
         QTest::newRow((type.second + "rgb32 -> yuv420p").constData())
                 << type.first
                 << QVideoFrame::Format_RGB32