summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorVal Doroshchuk <valentyn.doroshchuk@qt.io>2020-01-09 14:19:59 +0100
committerVal Doroshchuk <valentyn.doroshchuk@qt.io>2020-01-14 16:21:38 +0100
commit8e1c90f1a1776449d9fdd13f9026b415ac438bc6 (patch)
treec2eeabe69f2a9cec8818e2fe7a7266f95b759b81 /src
parent12e31cd9b912368f88d0f776b1efff3d6111078a (diff)
AVF: Check supported surface's pixel formats to enable gl
Supported formats might be changed, thus need to inform the renderer control about this. If gl textures are supported by the surface, the video frames will be rendered to FBO instead of QImage, next time when the update request will be received. Change-Id: I7750def3e943ea2680bb8b83853cb987ab554f00 Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
Diffstat (limited to 'src')
-rw-r--r--src/plugins/avfoundation/mediaplayer/avfvideorenderercontrol.mm6
1 files changed, 5 insertions, 1 deletions
diff --git a/src/plugins/avfoundation/mediaplayer/avfvideorenderercontrol.mm b/src/plugins/avfoundation/mediaplayer/avfvideorenderercontrol.mm
index e06ddc4b0..63bdee4f5 100644
--- a/src/plugins/avfoundation/mediaplayer/avfvideorenderercontrol.mm
+++ b/src/plugins/avfoundation/mediaplayer/avfvideorenderercontrol.mm
@@ -177,7 +177,11 @@ void AVFVideoRendererControl::setSurface(QAbstractVideoSurface *surface)
#endif
//Check for needed formats to render as OpenGL Texture
- m_enableOpenGL = m_surface->supportedPixelFormats(QAbstractVideoBuffer::GLTextureHandle).contains(QVideoFrame::Format_BGR32);
+ auto handleGlEnabled = [this] {
+ m_enableOpenGL = m_surface->supportedPixelFormats(QAbstractVideoBuffer::GLTextureHandle).contains(QVideoFrame::Format_BGR32);
+ };
+ handleGlEnabled();
+ connect(m_surface, &QAbstractVideoSurface::supportedFormatsChanged, this, handleGlEnabled);
//If we already have a layer, but changed surfaces start rendering again
if (m_playerLayer && !m_displayLink->isActive()) {