summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJustin McPherson <justin.mcpherson@nokia.com>2010-02-17 01:48:51 (GMT)
committerJustin McPherson <justin.mcpherson@nokia.com>2010-02-17 01:48:51 (GMT)
commitefb58e8a0b164747becbac01ec742c2b4a0459ac (patch)
tree367fc667515c66111597072d3e8571ca1cd448c7
parent08815ab306eb61d4a6abdfce0fe3ea9d50d46212 (diff)
parent1f93babe307efa37f0ca93c235ae1b616f303ee4 (diff)
downloadQt-efb58e8a0b164747becbac01ec742c2b4a0459ac.zip
Qt-efb58e8a0b164747becbac01ec742c2b4a0459ac.tar.gz
Qt-efb58e8a0b164747becbac01ec742c2b4a0459ac.tar.bz2
Merge branch 'master' of git@scm.dev.nokia.troll.no:qt/qt-multimedia-team
-rw-r--r--src/multimedia/base/qpaintervideosurface.cpp76
-rw-r--r--src/plugins/mediaservices/gstreamer/qvideosurfacegstsink.cpp3
-rw-r--r--tests/auto/qmediaplayer/tst_qmediaplayer.cpp2
3 files changed, 78 insertions, 3 deletions
diff --git a/src/multimedia/base/qpaintervideosurface.cpp b/src/multimedia/base/qpaintervideosurface.cpp
index 58d7412..dcc81d9 100644
--- a/src/multimedia/base/qpaintervideosurface.cpp
+++ b/src/multimedia/base/qpaintervideosurface.cpp
@@ -531,6 +531,32 @@ static const char *qt_arbfp_yuvPlanarShaderProgram =
"DP4 result.color.z, yuv, matrix[2];\n"
"END";
+// Paints a YUV444 frame.
+static const char *qt_arbfp_xyuvShaderProgram =
+ "!!ARBfp1.0\n"
+ "PARAM matrix[4] = { program.local[0..2],"
+ "{ 0.0, 0.0, 0.0, 1.0 } };\n"
+ "TEMP ayuv;\n"
+ "TEX ayuv, fragment.texcoord[0], texture[0], 2D;\n"
+ "MOV ayuv.x, matrix[3].w;\n"
+ "DP4 result.color.x, ayuv.yzwx, matrix[0];\n"
+ "DP4 result.color.y, ayuv.yzwx, matrix[1];\n"
+ "DP4 result.color.z, ayuv.yzwx, matrix[2];\n"
+ "END";
+
+// Paints a AYUV444 frame.
+static const char *qt_arbfp_ayuvShaderProgram =
+ "!!ARBfp1.0\n"
+ "PARAM matrix[4] = { program.local[0..2],"
+ "{ 0.0, 0.0, 0.0, 1.0 } };\n"
+ "TEMP ayuv;\n"
+ "TEX ayuv, fragment.texcoord[0], texture[0], 2D;\n"
+ "MOV ayuv.x, matrix[3].w;\n"
+ "DP4 result.color.x, ayuv.yzwx, matrix[0];\n"
+ "DP4 result.color.y, ayuv.yzwx, matrix[1];\n"
+ "DP4 result.color.z, ayuv.yzwx, matrix[2];\n"
+ "TEX result.color.w, fragment.texcoord[0], texture, 2D;\n"
+ "END";
class QVideoSurfaceArbFpPainter : public QVideoSurfaceGLPainter
{
@@ -584,6 +610,8 @@ QVideoSurfaceArbFpPainter::QVideoSurfaceArbFpPainter(QGLContext *context)
<< QVideoFrame::Format_RGB24
<< QVideoFrame::Format_BGR24
<< QVideoFrame::Format_RGB565
+ << QVideoFrame::Format_AYUV444
+ << QVideoFrame::Format_YUV444
<< QVideoFrame::Format_YV12
<< QVideoFrame::Format_YUV420P;
m_glPixelFormats
@@ -617,7 +645,7 @@ QAbstractVideoSurface::Error QVideoSurfaceArbFpPainter::start(const QVideoSurfac
break;
case QVideoFrame::Format_RGB24:
initRgbTextureInfo(GL_RGB8, GL_RGBA, GL_UNSIGNED_BYTE, format.frameSize());
- program = qt_arbfp_argbShaderProgram;
+ program = qt_arbfp_xrgbShaderProgram;
break;
case QVideoFrame::Format_BGR24:
initRgbTextureInfo(GL_RGB8, GL_RGBA, GL_UNSIGNED_BYTE, format.frameSize());
@@ -627,6 +655,16 @@ QAbstractVideoSurface::Error QVideoSurfaceArbFpPainter::start(const QVideoSurfac
initRgbTextureInfo(GL_RGB, GL_RGB, GL_UNSIGNED_SHORT_5_6_5, format.frameSize());
program = qt_arbfp_rgbShaderProgram;
break;
+ case QVideoFrame::Format_YUV444:
+ initRgbTextureInfo(GL_RGB, GL_RGB, GL_UNSIGNED_BYTE, format.frameSize());
+ program = qt_arbfp_xyuvShaderProgram;
+ m_yuv = true;
+ break;
+ case QVideoFrame::Format_AYUV444:
+ initRgbTextureInfo(GL_RGBA, GL_RGBA, GL_UNSIGNED_BYTE, format.frameSize());
+ program = qt_arbfp_ayuvShaderProgram;
+ m_yuv = true;
+ break;
case QVideoFrame::Format_YV12:
initYv12TextureInfo(format.frameSize());
program = qt_arbfp_yuvPlanarShaderProgram;
@@ -865,6 +903,28 @@ static const char *qt_glsl_yuvPlanarShaderProgram =
" gl_FragColor = colorMatrix * color;\n"
"}\n";
+// Paints a YUV444 frame.
+static const char *qt_glsl_xyuvShaderProgram =
+ "uniform sampler2D texRgb;\n"
+ "uniform mediump mat4 colorMatrix;\n"
+ "varying highp vec2 textureCoord;\n"
+ "void main(void)\n"
+ "{\n"
+ " highp vec4 color = vec4(texture2D(texRgb, textureCoord.st).gba, 1.0);\n"
+ " gl_FragColor = colorMatrix * color;\n"
+ "}\n";
+
+// Paints a AYUV444 frame.
+static const char *qt_glsl_ayuvShaderProgram =
+ "uniform sampler2D texRgb;\n"
+ "uniform mediump mat4 colorMatrix;\n"
+ "varying highp vec2 textureCoord;\n"
+ "void main(void)\n"
+ "{\n"
+ " highp vec4 color = vec4(texture2D(texRgb, textureCoord.st).gba, 1.0);\n"
+ " color = colorMatrix * color;\n"
+ " gl_FragColor = vec4(color.rgb, texture2D(texRgb, textureCoord.st).r);\n"
+ "}\n";
class QVideoSurfaceGlslPainter : public QVideoSurfaceGLPainter
{
@@ -895,6 +955,8 @@ QVideoSurfaceGlslPainter::QVideoSurfaceGlslPainter(QGLContext *context)
<< QVideoFrame::Format_BGR24
#endif
<< QVideoFrame::Format_RGB565
+ << QVideoFrame::Format_YUV444
+ << QVideoFrame::Format_AYUV444
<< QVideoFrame::Format_YV12
<< QVideoFrame::Format_YUV420P;
m_glPixelFormats
@@ -919,7 +981,7 @@ QAbstractVideoSurface::Error QVideoSurfaceGlslPainter::start(const QVideoSurface
fragmentProgram = qt_glsl_xrgbShaderProgram;
break;
case QVideoFrame::Format_BGR32:
- initRgbTextureInfo(GL_RGBA, GL_RGBA, GL_UNSIGNED_BYTE, format.frameSize());
+ initRgbTextureInfo(GL_RGB, GL_RGBA, GL_UNSIGNED_BYTE, format.frameSize());
fragmentProgram = qt_glsl_rgbShaderProgram;
break;
case QVideoFrame::Format_ARGB32:
@@ -940,6 +1002,16 @@ QAbstractVideoSurface::Error QVideoSurfaceGlslPainter::start(const QVideoSurface
initRgbTextureInfo(GL_RGB, GL_RGB, GL_UNSIGNED_SHORT_5_6_5, format.frameSize());
fragmentProgram = qt_glsl_rgbShaderProgram;
break;
+ case QVideoFrame::Format_YUV444:
+ initRgbTextureInfo(GL_RGB, GL_RGB, GL_UNSIGNED_BYTE, format.frameSize());
+ fragmentProgram = qt_glsl_xyuvShaderProgram;
+ m_yuv = true;
+ break;
+ case QVideoFrame::Format_AYUV444:
+ initRgbTextureInfo(GL_RGBA, GL_RGBA, GL_UNSIGNED_BYTE, format.frameSize());
+ fragmentProgram = qt_glsl_ayuvShaderProgram;
+ m_yuv = true;
+ break;
case QVideoFrame::Format_YV12:
initYv12TextureInfo(format.frameSize());
fragmentProgram = qt_glsl_yuvPlanarShaderProgram;
diff --git a/src/plugins/mediaservices/gstreamer/qvideosurfacegstsink.cpp b/src/plugins/mediaservices/gstreamer/qvideosurfacegstsink.cpp
index 3108e1a..a3c7157 100644
--- a/src/plugins/mediaservices/gstreamer/qvideosurfacegstsink.cpp
+++ b/src/plugins/mediaservices/gstreamer/qvideosurfacegstsink.cpp
@@ -227,7 +227,8 @@ static const YuvFormat qt_yuvColorLookup[] =
{ QVideoFrame::Format_UYVY, GST_MAKE_FOURCC('U','Y','V','Y'), 16 },
{ QVideoFrame::Format_YUYV, GST_MAKE_FOURCC('Y','U','Y','2'), 16 },
{ QVideoFrame::Format_NV12, GST_MAKE_FOURCC('N','V','1','2'), 8 },
- { QVideoFrame::Format_NV21, GST_MAKE_FOURCC('N','V','2','1'), 8 }
+ { QVideoFrame::Format_NV21, GST_MAKE_FOURCC('N','V','2','1'), 8 },
+ { QVideoFrame::Format_AYUV444, GST_MAKE_FOURCC('A','Y','U','V'), 32 }
};
static int indexOfYuvColor(QVideoFrame::PixelFormat format)
diff --git a/tests/auto/qmediaplayer/tst_qmediaplayer.cpp b/tests/auto/qmediaplayer/tst_qmediaplayer.cpp
index 7f3cb3a..1775ec6 100644
--- a/tests/auto/qmediaplayer/tst_qmediaplayer.cpp
+++ b/tests/auto/qmediaplayer/tst_qmediaplayer.cpp
@@ -96,6 +96,7 @@ public:
int bufferStatus() const { return _bufferStatus; }
+ bool isAudioAvailable() const { return _audioAvailable; }
bool isVideoAvailable() const { return _videoAvailable; }
bool isSeekable() const { return _isSeekable; }
@@ -131,6 +132,7 @@ public:
int _volume;
bool _muted;
int _bufferStatus;
+ bool _audioAvailable;
bool _videoAvailable;
bool _isSeekable;
QPair<qint64, qint64> _seekRange;