Fixed QML video playback on Mac
Use the same CIImage based video frames as with QGraphicsVideoItem, but since CIImages can't be rendered directly in Scene Graph, the frame is rendered to FBO first. Task-number: QT-5423 Change-Id: I16f7e6351578bae21f8642a8028538c441e1f544 Reviewed-by: Lev Zelenskiy <lev.zelenskiy@nokia.com> Reviewed-by: Michael Goddard <michael.goddard@nokia.com>
This commit is contained in:
committed by
Qt by Nokia
parent
8bdceb9357
commit
f9516c4c5b
@@ -47,6 +47,8 @@
|
||||
#include <private/qmediapluginloader_p.h>
|
||||
#include <private/qsgvideonode_p.h>
|
||||
|
||||
#include <QtGui/QOpenGLContext>
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
|
||||
Q_GLOBAL_STATIC_WITH_ARGS(QMediaPluginLoader, videoNodeFactoryLoader,
|
||||
@@ -54,6 +56,7 @@ Q_GLOBAL_STATIC_WITH_ARGS(QMediaPluginLoader, videoNodeFactoryLoader,
|
||||
|
||||
QDeclarativeVideoRendererBackend::QDeclarativeVideoRendererBackend(QDeclarativeVideoOutput *parent)
|
||||
: QDeclarativeVideoBackend(parent),
|
||||
m_glContext(0),
|
||||
m_frameChanged(false)
|
||||
{
|
||||
m_surface = new QSGVideoItemSurface(this);
|
||||
@@ -69,6 +72,7 @@ QDeclarativeVideoRendererBackend::QDeclarativeVideoRendererBackend(QDeclarativeV
|
||||
// Append existing node factories as fallback if we have no plugins
|
||||
m_videoNodeFactories.append(&m_i420Factory);
|
||||
m_videoNodeFactories.append(&m_rgbFactory);
|
||||
m_videoNodeFactories.append(&m_textureFactory);
|
||||
}
|
||||
|
||||
QDeclarativeVideoRendererBackend::~QDeclarativeVideoRendererBackend()
|
||||
@@ -165,6 +169,11 @@ QSGNode *QDeclarativeVideoRendererBackend::updatePaintNode(QSGNode *oldNode,
|
||||
|
||||
QMutexLocker lock(&m_frameMutex);
|
||||
|
||||
if (!m_glContext) {
|
||||
m_glContext = QOpenGLContext::currentContext();
|
||||
m_surface->setProperty("GLContext", QVariant::fromValue<QObject*>(m_glContext));
|
||||
}
|
||||
|
||||
if (m_frameChanged) {
|
||||
if (videoNode && videoNode->pixelFormat() != m_frame.pixelFormat()) {
|
||||
#ifdef DEBUG_VIDEOITEM
|
||||
|
||||
Reference in New Issue
Block a user