diff options
author | Lars Knoll <lars.knoll@qt.io> | 2021-02-11 09:20:08 +0100 |
---|---|---|
committer | Lars Knoll <lars.knoll@qt.io> | 2021-02-17 08:26:34 +0000 |
commit | a8eb585f239c2e5c0a5fed8a1a279fbd076c8446 (patch) | |
tree | 8edab7e7e297bc42e3ee214bf803e03a393e8ad8 /src/multimediawidgets/qpaintervideosurface.cpp | |
parent | 5b08bbc4a244416ee961e9793cc12a652994573b (diff) |
Rework how to set a video output surface
Setting a video output should not require QMediaService
anymore.
Reverse the logic, by making QAbstractVideoSurface the primary
interface. Use runtime method lookup to get a pointer to the
video surface from QVideoWidget/QGraphicsVideoItem.
QAbstractVideoSurface is now the primary interface for setting
up a video output. We will need to add some API there to allow for
windows/fullscreen rendering.
With this change, QVideoRendererControl/QVideoWindowControl can
also be retired as an abstraction layer in the longer term.
Change-Id: Iedff18c6b95fedc7cb914075a8c84081080deab1
Reviewed-by: Doris Verria <doris.verria@qt.io>
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
Diffstat (limited to 'src/multimediawidgets/qpaintervideosurface.cpp')
-rw-r--r-- | src/multimediawidgets/qpaintervideosurface.cpp | 19 |
1 files changed, 7 insertions, 12 deletions
diff --git a/src/multimediawidgets/qpaintervideosurface.cpp b/src/multimediawidgets/qpaintervideosurface.cpp index 8a3567d01..9e6d8fa8a 100644 --- a/src/multimediawidgets/qpaintervideosurface.cpp +++ b/src/multimediawidgets/qpaintervideosurface.cpp @@ -150,12 +150,12 @@ QAbstractVideoSurface::Error QVideoSurfaceGenericPainter::start(const QVideoSurf const QAbstractVideoBuffer::HandleType t = format.handleType(); if (t == QAbstractVideoBuffer::NoHandle) { - bool ok = m_imageFormat != QImage::Format_Invalid && !m_imageSize.isEmpty(); -#ifndef QT_NO_OPENGL - if (QOpenGLContext::openGLModuleType() == QOpenGLContext::LibGLES) - ok &= format.pixelFormat() != QVideoFrame::Format_RGB24; -#endif - if (ok) +// bool ok = m_imageFormat != QImage::Format_Invalid && !m_imageSize.isEmpty(); +//#ifndef QT_NO_OPENGL +// if (QOpenGLContext::openGLModuleType() == QOpenGLContext::LibGLES) +// ok &= format.pixelFormat() != QVideoFrame::Format_RGB24; +//#endif +// if (ok) return QAbstractVideoSurface::NoError; } else if (t == QAbstractVideoBuffer::QPixmapHandle) { return QAbstractVideoSurface::NoError; @@ -186,12 +186,7 @@ QAbstractVideoSurface::Error QVideoSurfaceGenericPainter::paint( if (m_frame.handleType() == QAbstractVideoBuffer::QPixmapHandle) { painter->drawPixmap(target, m_frame.handle().value<QPixmap>(), source); } else if (m_frame.map(QAbstractVideoBuffer::ReadOnly)) { - QImage image( - m_frame.bits(), - m_imageSize.width(), - m_imageSize.height(), - m_frame.bytesPerLine(), - m_imageFormat); + QImage image = m_frame.image(); const QTransform oldTransform = painter->transform(); QTransform transform = oldTransform; |