From 09a7fda9711290ae00f74f5d762148c5b2f5f534 Mon Sep 17 00:00:00 2001 From: Dmytro Poplavskiy Date: Thu, 23 Aug 2012 15:59:18 +1000 Subject: Re-enabled CIImage based gfx video item on Mac Also prefer CoreImageHandle to GLTextureHandle in QuickTime player backend, to avoid unnecessary copy via FBO. Change-Id: Id5aa039c438378b7bbf816b7845b05574683c471 Reviewed-by: Gunnar Sletta --- src/multimediawidgets/multimediawidgets.pro | 3 +-- src/multimediawidgets/qpaintervideosurface.cpp | 4 ++-- src/multimediawidgets/qpaintervideosurface_mac.mm | 6 +++++- src/plugins/qt7/qt7movieviewrenderer.mm | 6 +++--- tests/auto/unit/qpaintervideosurface/tst_qpaintervideosurface.cpp | 8 ++++---- 5 files changed, 15 insertions(+), 12 deletions(-) diff --git a/src/multimediawidgets/multimediawidgets.pro b/src/multimediawidgets/multimediawidgets.pro index 8c5f69aac..a913cbbd9 100644 --- a/src/multimediawidgets/multimediawidgets.pro +++ b/src/multimediawidgets/multimediawidgets.pro @@ -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 } diff --git a/src/multimediawidgets/qpaintervideosurface.cpp b/src/multimediawidgets/qpaintervideosurface.cpp index 8b37acbdf..c14d1c833 100644 --- a/src/multimediawidgets/qpaintervideosurface.cpp +++ b/src/multimediawidgets/qpaintervideosurface.cpp @@ -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(); diff --git a/src/multimediawidgets/qpaintervideosurface_mac.mm b/src/multimediawidgets/qpaintervideosurface_mac.mm index a741d9eea..ee4d181fc 100644 --- a/src/multimediawidgets/qpaintervideosurface_mac.mm +++ b/src/multimediawidgets/qpaintervideosurface_mac.mm @@ -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()); @@ -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()); diff --git a/src/plugins/qt7/qt7movieviewrenderer.mm b/src/plugins/qt7/qt7movieviewrenderer.mm index 3a6ff8a92..31bea7536 100644 --- a/src/plugins/qt7/qt7movieviewrenderer.mm +++ b/src/plugins/qt7/qt7movieviewrenderer.mm @@ -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); diff --git a/tests/auto/unit/qpaintervideosurface/tst_qpaintervideosurface.cpp b/tests/auto/unit/qpaintervideosurface/tst_qpaintervideosurface.cpp index 096d0401d..8647133f2 100644 --- a/tests/auto/unit/qpaintervideosurface/tst_qpaintervideosurface.cpp +++ b/tests/auto/unit/qpaintervideosurface/tst_qpaintervideosurface.cpp @@ -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(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 -- cgit v1.2.3