Commit 1fe5a796 authored by Andy Nichols's avatar Andy Nichols Committed by The Qt Project
Browse files

AVFoundation: Fix y-inverted QML Videos


When the code that supports iOS was added, we introduced a bug where QML
videos would be played y-inverted on OS X.  This is because we made no
effort to y-invert the Framebuffer Object before rendering the texture
in the SceneGraph.  Now we render the video the the FBO y-inverted, so
there is no need to y-invert the resulting texture.

Task-number: QTBUG-35955
Change-Id: I41af1aaae57923b9972b5be5ec65f7d2a97d77c5
Reviewed-by: default avatarYoann Lopes <yoann.lopes@digia.com>
Showing with 3 additions and 2 deletions
...@@ -120,7 +120,7 @@ QImage AVFVideoFrameRenderer::renderLayerToImage(AVPlayerLayer *layer) ...@@ -120,7 +120,7 @@ QImage AVFVideoFrameRenderer::renderLayerToImage(AVPlayerLayer *layer)
return QImage(); return QImage();
renderLayerToFBO(layer, fbo); renderLayerToFBO(layer, fbo);
QImage fboImage = fbo->toImage().mirrored(); QImage fboImage = fbo->toImage();
m_glContext->doneCurrent(); m_glContext->doneCurrent();
return fboImage; return fboImage;
...@@ -204,7 +204,8 @@ void AVFVideoFrameRenderer::renderLayerToFBO(AVPlayerLayer *layer, QOpenGLFrameb ...@@ -204,7 +204,8 @@ void AVFVideoFrameRenderer::renderLayerToFBO(AVPlayerLayer *layer, QOpenGLFrameb
glPushMatrix(); glPushMatrix();
glLoadIdentity(); glLoadIdentity();
glOrtho(0.0f, m_targetSize.width(), m_targetSize.height(), 0.0f, 0.0f, 1.0f); //Render to FBO with inverted Y
glOrtho(0.0, m_targetSize.width(), 0.0, m_targetSize.height(), 0.0, 1.0);
glMatrixMode(GL_MODELVIEW); glMatrixMode(GL_MODELVIEW);
glPushMatrix(); glPushMatrix();
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment