summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorMichael Goddard <michael.goddard@nokia.com>2011-10-07 12:03:35 +1000
committerQt by Nokia <qt-info@nokia.com>2011-10-07 08:29:57 +0200
commitadca03adfd80c0a87083d73e8d8c71229fc35652 (patch)
tree51e76584ae08b14f85fbf8f5197fac554d63cd64 /src
parent03f22bcdaf1f80083618856d6e4140d3062f175b (diff)
Improve video test coverage and debugging output.
Added a few debug operators for some useful enums, and added tests for them. One or two other features not really tested. Change-Id: Idffec6ade1d4e05dbf72f3dc47dfc0d01ddddf8b Reviewed-on: http://codereview.qt-project.org/6201 Reviewed-by: Qt Sanity Bot <qt_sanity_bot@ovi.com> Reviewed-by: Jonas Rabbe <jonas.rabbe@nokia.com>
Diffstat (limited to 'src')
-rw-r--r--src/multimedia/video/qabstractvideobuffer.cpp22
-rw-r--r--src/multimedia/video/qabstractvideobuffer.h4
-rw-r--r--src/multimedia/video/qvideoframe.cpp97
-rw-r--r--src/multimedia/video/qvideoframe.h4
-rw-r--r--src/multimedia/video/qvideosurfaceformat.cpp123
-rw-r--r--src/multimedia/video/qvideosurfaceformat.h1
6 files changed, 137 insertions, 114 deletions
diff --git a/src/multimedia/video/qabstractvideobuffer.cpp b/src/multimedia/video/qabstractvideobuffer.cpp
index 6480bc850..d0f07ab01 100644
--- a/src/multimedia/video/qabstractvideobuffer.cpp
+++ b/src/multimedia/video/qabstractvideobuffer.cpp
@@ -43,6 +43,9 @@
#include <qvariant.h>
+#include <QDebug>
+
+
QT_BEGIN_NAMESPACE
/*!
@@ -198,5 +201,24 @@ QVariant QAbstractVideoBuffer::handle() const
return QVariant();
}
+#ifndef QT_NO_DEBUG_STREAM
+QDebug operator<<(QDebug dbg, QAbstractVideoBuffer::HandleType type)
+{
+ switch (type) {
+ case QAbstractVideoBuffer::NoHandle:
+ return dbg.nospace() << "NoHandle";
+ case QAbstractVideoBuffer::GLTextureHandle:
+ return dbg.nospace() << "GLTextureHandle";
+ case QAbstractVideoBuffer::XvShmImageHandle:
+ return dbg.nospace() << "XvShmImageHandle";
+ case QAbstractVideoBuffer::CoreImageHandle:
+ return dbg.nospace() << "CoreImageHandle";
+ case QAbstractVideoBuffer::QPixmapHandle:
+ return dbg.nospace() << "QPixmapHandle";
+ default:
+ return dbg.nospace() << QString(QLatin1String("UserHandle(%1)")).arg(int(type)).toAscii().constData();
+ }
+}
+#endif
QT_END_NAMESPACE
diff --git a/src/multimedia/video/qabstractvideobuffer.h b/src/multimedia/video/qabstractvideobuffer.h
index 2c66dfd65..a7f51f4ad 100644
--- a/src/multimedia/video/qabstractvideobuffer.h
+++ b/src/multimedia/video/qabstractvideobuffer.h
@@ -102,6 +102,10 @@ private:
Q_DISABLE_COPY(QAbstractVideoBuffer)
};
+#ifndef QT_NO_DEBUG_STREAM
+Q_MULTIMEDIA_EXPORT QDebug operator<<(QDebug, QAbstractVideoBuffer::HandleType);
+#endif
+
QT_END_NAMESPACE
Q_DECLARE_METATYPE(QAbstractVideoBuffer::HandleType)
diff --git a/src/multimedia/video/qvideoframe.cpp b/src/multimedia/video/qvideoframe.cpp
index eaef644e9..efcb4d54f 100644
--- a/src/multimedia/video/qvideoframe.cpp
+++ b/src/multimedia/video/qvideoframe.cpp
@@ -50,6 +50,8 @@
#include <qvariant.h>
#include <qvector.h>
+#include <QDebug>
+
QT_BEGIN_NAMESPACE
namespace
@@ -682,11 +684,6 @@ void QVideoFrame::setEndTime(qint64 time)
QVideoFrame::PixelFormat QVideoFrame::pixelFormatFromImageFormat(QImage::Format format)
{
switch (format) {
- case QImage::Format_Invalid:
- case QImage::Format_Mono:
- case QImage::Format_MonoLSB:
- case QImage::Format_Indexed8:
- return Format_Invalid;
case QImage::Format_RGB32:
return Format_RGB32;
case QImage::Format_ARGB32:
@@ -697,22 +694,13 @@ QVideoFrame::PixelFormat QVideoFrame::pixelFormatFromImageFormat(QImage::Format
return Format_RGB565;
case QImage::Format_ARGB8565_Premultiplied:
return Format_ARGB8565_Premultiplied;
- case QImage::Format_RGB666:
- case QImage::Format_ARGB6666_Premultiplied:
- return Format_Invalid;
case QImage::Format_RGB555:
return Format_RGB555;
- case QImage::Format_ARGB8555_Premultiplied:
- return Format_Invalid;
case QImage::Format_RGB888:
return Format_RGB24;
- case QImage::Format_RGB444:
- case QImage::Format_ARGB4444_Premultiplied:
- return Format_Invalid;
- case QImage::NImageFormats:
+ default:
return Format_Invalid;
}
- return Format_Invalid;
}
/*!
@@ -772,5 +760,84 @@ QImage::Format QVideoFrame::imageFormatFromPixelFormat(PixelFormat format)
return QImage::Format_Invalid;
}
+#ifndef QT_NO_DEBUG_STREAM
+
+QDebug operator<<(QDebug dbg, QVideoFrame::PixelFormat pf)
+{
+ switch (pf) {
+ case QVideoFrame::Format_Invalid:
+ return dbg.nospace() << "Format_Invalid";
+ case QVideoFrame::Format_ARGB32:
+ return dbg.nospace() << "Format_ARGB32";
+ case QVideoFrame::Format_ARGB32_Premultiplied:
+ return dbg.nospace() << "Format_ARGB32_Premultiplied";
+ case QVideoFrame::Format_RGB32:
+ return dbg.nospace() << "Format_RGB32";
+ case QVideoFrame::Format_RGB24:
+ return dbg.nospace() << "Format_RGB24";
+ case QVideoFrame::Format_RGB565:
+ return dbg.nospace() << "Format_RGB565";
+ case QVideoFrame::Format_RGB555:
+ return dbg.nospace() << "Format_RGB555";
+ case QVideoFrame::Format_ARGB8565_Premultiplied:
+ return dbg.nospace() << "Format_ARGB8565_Premultiplied";
+ case QVideoFrame::Format_BGRA32:
+ return dbg.nospace() << "Format_BGRA32";
+ case QVideoFrame::Format_BGRA32_Premultiplied:
+ return dbg.nospace() << "Format_BGRA32_Premultiplied";
+ case QVideoFrame::Format_BGR32:
+ return dbg.nospace() << "Format_BGR32";
+ case QVideoFrame::Format_BGR24:
+ return dbg.nospace() << "Format_BGR24";
+ case QVideoFrame::Format_BGR565:
+ return dbg.nospace() << "Format_BGR565";
+ case QVideoFrame::Format_BGR555:
+ return dbg.nospace() << "Format_BGR555";
+ case QVideoFrame::Format_BGRA5658_Premultiplied:
+ return dbg.nospace() << "Format_BGRA5658_Premultiplied";
+ case QVideoFrame::Format_AYUV444:
+ return dbg.nospace() << "Format_AYUV444";
+ case QVideoFrame::Format_AYUV444_Premultiplied:
+ return dbg.nospace() << "Format_AYUV444_Premultiplied";
+ case QVideoFrame::Format_YUV444:
+ return dbg.nospace() << "Format_YUV444";
+ case QVideoFrame::Format_YUV420P:
+ return dbg.nospace() << "Format_YUV420P";
+ case QVideoFrame::Format_YV12:
+ return dbg.nospace() << "Format_YV12";
+ case QVideoFrame::Format_UYVY:
+ return dbg.nospace() << "Format_UYVY";
+ case QVideoFrame::Format_YUYV:
+ return dbg.nospace() << "Format_YUYV";
+ case QVideoFrame::Format_NV12:
+ return dbg.nospace() << "Format_NV12";
+ case QVideoFrame::Format_NV21:
+ return dbg.nospace() << "Format_NV21";
+ case QVideoFrame::Format_IMC1:
+ return dbg.nospace() << "Format_IMC1";
+ case QVideoFrame::Format_IMC2:
+ return dbg.nospace() << "Format_IMC2";
+ case QVideoFrame::Format_IMC3:
+ return dbg.nospace() << "Format_IMC3";
+ case QVideoFrame::Format_IMC4:
+ return dbg.nospace() << "Format_IMC4";
+ case QVideoFrame::Format_Y8:
+ return dbg.nospace() << "Format_Y8";
+ case QVideoFrame::Format_Y16:
+ return dbg.nospace() << "Format_Y16";
+ case QVideoFrame::Format_Jpeg:
+ return dbg.nospace() << "Format_Jpeg";
+ case QVideoFrame::Format_AdobeDng:
+ return dbg.nospace() << "Format_AdobeDng";
+ case QVideoFrame::Format_CameraRaw:
+ return dbg.nospace() << "Format_CameraRaw";
+
+ default:
+ return dbg.nospace() << QString(QLatin1String("UserType(%1)" )).arg(int(pf)).toAscii().constData();
+ }
+}
+
+#endif
+
QT_END_NAMESPACE
diff --git a/src/multimedia/video/qvideoframe.h b/src/multimedia/video/qvideoframe.h
index 6dffaf59d..9797a586a 100644
--- a/src/multimedia/video/qvideoframe.h
+++ b/src/multimedia/video/qvideoframe.h
@@ -163,6 +163,10 @@ private:
QExplicitlySharedDataPointer<QVideoFramePrivate> d;
};
+#ifndef QT_NO_DEBUG_STREAM
+Q_MULTIMEDIA_EXPORT QDebug operator<<(QDebug, QVideoFrame::PixelFormat );
+#endif
+
QT_END_NAMESPACE
Q_DECLARE_METATYPE(QVideoFrame::FieldType)
diff --git a/src/multimedia/video/qvideosurfaceformat.cpp b/src/multimedia/video/qvideosurfaceformat.cpp
index 8286d18e1..3808292df 100644
--- a/src/multimedia/video/qvideosurfaceformat.cpp
+++ b/src/multimedia/video/qvideosurfaceformat.cpp
@@ -504,8 +504,6 @@ QVariant QVideoSurfaceFormat::property(const char *name) const
return qVariantFromValue(d->handleType);
} else if (qstrcmp(name, "pixelFormat") == 0) {
return qVariantFromValue(d->pixelFormat);
- } else if (qstrcmp(name, "handleType") == 0) {
- return qVariantFromValue(d->handleType);
} else if (qstrcmp(name, "frameSize") == 0) {
return d->frameSize;
} else if (qstrcmp(name, "frameWidth") == 0) {
@@ -593,108 +591,35 @@ void QVideoSurfaceFormat::setProperty(const char *name, const QVariant &value)
#ifndef QT_NO_DEBUG_STREAM
-QDebug operator<<(QDebug dbg, const QVideoSurfaceFormat &f)
-{
- QString typeName;
- switch (f.pixelFormat()) {
- case QVideoFrame::Format_Invalid:
- typeName = QLatin1String("Format_Invalid");
- break;
- case QVideoFrame::Format_ARGB32:
- typeName = QLatin1String("Format_ARGB32");
- break;
- case QVideoFrame::Format_ARGB32_Premultiplied:
- typeName = QLatin1String("Format_ARGB32_Premultiplied");
- break;
- case QVideoFrame::Format_RGB32:
- typeName = QLatin1String("Format_RGB32");
- break;
- case QVideoFrame::Format_RGB24:
- typeName = QLatin1String("Format_RGB24");
- break;
- case QVideoFrame::Format_RGB565:
- typeName = QLatin1String("Format_RGB565");
- break;
- case QVideoFrame::Format_RGB555:
- typeName = QLatin1String("Format_RGB555");
- break;
- case QVideoFrame::Format_ARGB8565_Premultiplied:
- typeName = QLatin1String("Format_ARGB8565_Premultiplied");
- break;
- case QVideoFrame::Format_BGRA32:
- typeName = QLatin1String("Format_BGRA32");
- break;
- case QVideoFrame::Format_BGRA32_Premultiplied:
- typeName = QLatin1String("Format_BGRA32_Premultiplied");
- break;
- case QVideoFrame::Format_BGR32:
- typeName = QLatin1String("Format_BGR32");
- break;
- case QVideoFrame::Format_BGR24:
- typeName = QLatin1String("Format_BGR24");
- break;
- case QVideoFrame::Format_BGR565:
- typeName = QLatin1String("Format_BGR565");
- break;
- case QVideoFrame::Format_BGR555:
- typeName = QLatin1String("Format_BGR555");
- break;
- case QVideoFrame::Format_BGRA5658_Premultiplied:
- typeName = QLatin1String("Format_BGRA5658_Premultiplied");
- break;
- case QVideoFrame::Format_AYUV444:
- typeName = QLatin1String("Format_AYUV444");
- break;
- case QVideoFrame::Format_AYUV444_Premultiplied:
- typeName = QLatin1String("Format_AYUV444_Premultiplied");
- break;
- case QVideoFrame::Format_YUV444:
- typeName = QLatin1String("Format_YUV444");
- break;
- case QVideoFrame::Format_YUV420P:
- typeName = QLatin1String("Format_YUV420P");
- break;
- case QVideoFrame::Format_YV12:
- typeName = QLatin1String("Format_YV12");
- break;
- case QVideoFrame::Format_UYVY:
- typeName = QLatin1String("Format_UYVY");
- break;
- case QVideoFrame::Format_YUYV:
- typeName = QLatin1String("Format_YUYV");
- break;
- case QVideoFrame::Format_NV12:
- typeName = QLatin1String("Format_NV12");
- break;
- case QVideoFrame::Format_NV21:
- typeName = QLatin1String("Format_NV21");
- break;
- case QVideoFrame::Format_IMC1:
- typeName = QLatin1String("Format_IMC1");
- break;
- case QVideoFrame::Format_IMC2:
- typeName = QLatin1String("Format_IMC2");
- break;
- case QVideoFrame::Format_IMC3:
- typeName = QLatin1String("Format_IMC3");
- break;
- case QVideoFrame::Format_IMC4:
- typeName = QLatin1String("Format_IMC4");
- break;
- case QVideoFrame::Format_Y8:
- typeName = QLatin1String("Format_Y8");
- break;
- case QVideoFrame::Format_Y16:
- typeName = QLatin1String("Format_Y16");
- break;
- default:
- typeName = QString(QLatin1String("UserType(%1)" )).arg(int(f.pixelFormat()));
+
+QDebug operator<<(QDebug dbg, QVideoSurfaceFormat::YCbCrColorSpace cs)
+{
+ switch (cs) {
+ case QVideoSurfaceFormat::YCbCr_BT601:
+ return dbg.nospace() << "YCbCr_BT601";
+ case QVideoSurfaceFormat::YCbCr_BT709:
+ return dbg.nospace() << "YCbCr_BT709";
+ case QVideoSurfaceFormat::YCbCr_JPEG:
+ return dbg.nospace() << "YCbCr_JPEG";
+ case QVideoSurfaceFormat::YCbCr_xvYCC601:
+ return dbg.nospace() << "YCbCr_xvYCC601";
+ case QVideoSurfaceFormat::YCbCr_xvYCC709:
+ return dbg.nospace() << "YCbCr_xvYCC709";
+ case QVideoSurfaceFormat::YCbCr_CustomMatrix:
+ return dbg.nospace() << "YCbCr_CustomMatrix";
+ default:
+ return dbg.nospace() << "YCbCr_Undefined";
}
+}
- dbg.nospace() << "QVideoSurfaceFormat(" << typeName;
+QDebug operator<<(QDebug dbg, const QVideoSurfaceFormat &f)
+{
+ dbg.nospace() << "QVideoSurfaceFormat(" << f.pixelFormat();
dbg.nospace() << ", " << f.frameSize();
dbg.nospace() << ", viewport=" << f.viewport();
dbg.nospace() << ", pixelAspectRatio=" << f.pixelAspectRatio();
+ dbg.nospace() << ", handleType=" << f.handleType();
+ dbg.nospace() << ", yCbCrColorSpace=" << f.yCbCrColorSpace();
dbg.nospace() << ")";
foreach(const QByteArray& propertyName, f.propertyNames())
diff --git a/src/multimedia/video/qvideosurfaceformat.h b/src/multimedia/video/qvideosurfaceformat.h
index f830b80a6..67299177b 100644
--- a/src/multimedia/video/qvideosurfaceformat.h
+++ b/src/multimedia/video/qvideosurfaceformat.h
@@ -135,6 +135,7 @@ private:
#ifndef QT_NO_DEBUG_STREAM
Q_MULTIMEDIA_EXPORT QDebug operator<<(QDebug, const QVideoSurfaceFormat &);
+Q_MULTIMEDIA_EXPORT QDebug operator<<(QDebug, QVideoSurfaceFormat::YCbCrColorSpace);
#endif
QT_END_NAMESPACE