summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAndrew den Exter <andrew.den-exter@nokia.com>2010-02-16 04:26:14 (GMT)
committerAndrew den Exter <andrew.den-exter@nokia.com>2010-02-16 04:28:01 (GMT)
commita7f6af9817771b8211433c8cf24fe7150c5b7bf5 (patch)
tree9bf42838ee4ff1778f4aabfc8a73dd1ad03e34f3
parentbe2c02716595545a87330cdbe38a4ec5cd3522e3 (diff)
downloadQt-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.
-rw-r--r--src/multimedia/base/qpaintervideosurface.cpp26
-rw-r--r--src/plugins/mediaservices/gstreamer/qvideosurfacegstsink.cpp5
2 files changed, 30 insertions, 1 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
diff --git a/src/plugins/mediaservices/gstreamer/qvideosurfacegstsink.cpp b/src/plugins/mediaservices/gstreamer/qvideosurfacegstsink.cpp
index 8c61846..3108e1a 100644
--- a/src/plugins/mediaservices/gstreamer/qvideosurfacegstsink.cpp
+++ b/src/plugins/mediaservices/gstreamer/qvideosurfacegstsink.cpp
@@ -268,9 +268,12 @@ static const RgbFormat qt_rgbColorLookup[] =
{
{ QVideoFrame::Format_RGB32 , 32, 24, 4321, 0x0000FF00, 0x00FF0000, 0xFF000000, 0x00000000 },
{ QVideoFrame::Format_RGB32 , 32, 24, 1234, 0x00FF0000, 0x0000FF00, 0x000000FF, 0x00000000 },
+ { QVideoFrame::Format_BGR32 , 32, 24, 4321, 0xFF000000, 0x00FF0000, 0x0000FF00, 0x00000000 },
+ { QVideoFrame::Format_BGR32 , 32, 24, 1234, 0x000000FF, 0x0000FF00, 0x00FF0000, 0x00000000 },
{ QVideoFrame::Format_ARGB32, 32, 24, 4321, 0x0000FF00, 0x00FF0000, 0xFF000000, 0x000000FF },
{ QVideoFrame::Format_ARGB32, 32, 24, 1234, 0x00FF0000, 0x0000FF00, 0x000000FF, 0xFF000000 },
- { QVideoFrame::Format_RGB24 , 24, 24, 4321, 0x00FF0000, 0x0000FF00, 0x000000FF, 0x00000000 },
+ { QVideoFrame::Format_RGB24 , 24, 24, 4321, 0x000000FF, 0x0000FF00, 0x00FF0000, 0x00000000 },
+ { QVideoFrame::Format_BGR24 , 24, 24, 4321, 0x00FF0000, 0x0000FF00, 0x000000FF, 0x00000000 },
{ QVideoFrame::Format_RGB565, 16, 16, 1234, 0x0000F800, 0x000007E0, 0x0000001F, 0x00000000 }
};