diff options
author | Andrew den Exter <andrew.den-exter@nokia.com> | 2010-02-16 04:26:14 (GMT) |
---|---|---|
committer | Andrew den Exter <andrew.den-exter@nokia.com> | 2010-02-16 04:28:01 (GMT) |
commit | a7f6af9817771b8211433c8cf24fe7150c5b7bf5 (patch) | |
tree | 9bf42838ee4ff1778f4aabfc8a73dd1ad03e34f3 /src/multimedia/base | |
parent | be2c02716595545a87330cdbe38a4ec5cd3522e3 (diff) | |
download | Qt-a7f6af9817771b8211433c8cf24fe7150c5b7bf5.zip Qt-a7f6af9817771b8211433c8cf24fe7150c5b7bf5.tar.gz Qt-a7f6af9817771b8211433c8cf24fe7150c5b7bf5.tar.bz2 |
Don't paint RGB24 frames as BGR24.
A non-swizzling shader was being used for RGB24. This looked correct on
linux because the gstreamer backend was misidentifying BGR24 as RGB24.
And since BGR is supported include it in the list of supported formats.
Diffstat (limited to 'src/multimedia/base')
-rw-r--r-- | src/multimedia/base/qpaintervideosurface.cpp | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/src/multimedia/base/qpaintervideosurface.cpp b/src/multimedia/base/qpaintervideosurface.cpp index f7ffb02..58d7412 100644 --- a/src/multimedia/base/qpaintervideosurface.cpp +++ b/src/multimedia/base/qpaintervideosurface.cpp @@ -579,8 +579,10 @@ QVideoSurfaceArbFpPainter::QVideoSurfaceArbFpPainter(QGLContext *context) m_imagePixelFormats << QVideoFrame::Format_RGB32 + << QVideoFrame::Format_BGR32 << QVideoFrame::Format_ARGB32 << QVideoFrame::Format_RGB24 + << QVideoFrame::Format_BGR24 << QVideoFrame::Format_RGB565 << QVideoFrame::Format_YV12 << QVideoFrame::Format_YUV420P; @@ -605,6 +607,10 @@ QAbstractVideoSurface::Error QVideoSurfaceArbFpPainter::start(const QVideoSurfac initRgbTextureInfo(GL_RGBA, GL_RGBA, GL_UNSIGNED_BYTE, format.frameSize()); program = qt_arbfp_xrgbShaderProgram; break; + case QVideoFrame::Format_BGR32: + initRgbTextureInfo(GL_RGBA, GL_RGBA, GL_UNSIGNED_BYTE, format.frameSize()); + program = qt_arbfp_rgbShaderProgram; + break; case QVideoFrame::Format_ARGB32: initRgbTextureInfo(GL_RGBA, GL_RGBA, GL_UNSIGNED_BYTE, format.frameSize()); program = qt_arbfp_argbShaderProgram; @@ -613,6 +619,10 @@ QAbstractVideoSurface::Error QVideoSurfaceArbFpPainter::start(const QVideoSurfac initRgbTextureInfo(GL_RGB8, GL_RGBA, GL_UNSIGNED_BYTE, format.frameSize()); program = qt_arbfp_argbShaderProgram; break; + case QVideoFrame::Format_BGR24: + initRgbTextureInfo(GL_RGB8, GL_RGBA, GL_UNSIGNED_BYTE, format.frameSize()); + program = qt_arbfp_rgbShaderProgram; + break; case QVideoFrame::Format_RGB565: initRgbTextureInfo(GL_RGB, GL_RGB, GL_UNSIGNED_SHORT_5_6_5, format.frameSize()); program = qt_arbfp_rgbShaderProgram; @@ -706,6 +716,9 @@ QAbstractVideoSurface::Error QVideoSurfaceArbFpPainter::paint( if (m_frame.isValid()) { painter->beginNativePainting(); + glEnable(GL_STENCIL_TEST); + glEnable(GL_SCISSOR_TEST); + const float txLeft = source.left() / m_frameSize.width(); const float txRight = source.right() / m_frameSize.width(); const float txTop = m_scanLineDirection == QVideoSurfaceFormat::TopToBottom @@ -779,6 +792,9 @@ QAbstractVideoSurface::Error QVideoSurfaceArbFpPainter::paint( glDisableClientState(GL_VERTEX_ARRAY); glDisable(GL_FRAGMENT_PROGRAM_ARB); + glDisable(GL_STENCIL_TEST); + glDisable(GL_SCISSOR_TEST); + painter->endNativePainting(); } return QAbstractVideoSurface::NoError; @@ -872,9 +888,11 @@ QVideoSurfaceGlslPainter::QVideoSurfaceGlslPainter(QGLContext *context) { m_imagePixelFormats << QVideoFrame::Format_RGB32 + << QVideoFrame::Format_BGR32 << QVideoFrame::Format_ARGB32 #ifndef QT_OPENGL_ES << QVideoFrame::Format_RGB24 + << QVideoFrame::Format_BGR24 #endif << QVideoFrame::Format_RGB565 << QVideoFrame::Format_YV12 @@ -900,6 +918,10 @@ QAbstractVideoSurface::Error QVideoSurfaceGlslPainter::start(const QVideoSurface initRgbTextureInfo(GL_RGBA, GL_RGBA, GL_UNSIGNED_BYTE, format.frameSize()); fragmentProgram = qt_glsl_xrgbShaderProgram; break; + case QVideoFrame::Format_BGR32: + initRgbTextureInfo(GL_RGBA, GL_RGBA, GL_UNSIGNED_BYTE, format.frameSize()); + fragmentProgram = qt_glsl_rgbShaderProgram; + break; case QVideoFrame::Format_ARGB32: initRgbTextureInfo(GL_RGBA, GL_RGBA, GL_UNSIGNED_BYTE, format.frameSize()); fragmentProgram = qt_glsl_argbShaderProgram; @@ -907,6 +929,10 @@ QAbstractVideoSurface::Error QVideoSurfaceGlslPainter::start(const QVideoSurface #ifndef QT_OPENGL_ES case QVideoFrame::Format_RGB24: initRgbTextureInfo(GL_RGB8, GL_RGB, GL_UNSIGNED_BYTE, format.frameSize()); + fragmentProgram = qt_glsl_argbShaderProgram; + break; + case QVideoFrame::Format_BGR24: + initRgbTextureInfo(GL_RGB8, GL_RGB, GL_UNSIGNED_BYTE, format.frameSize()); fragmentProgram = qt_glsl_rgbShaderProgram; break; #endif |