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>
This commit is contained in:
Michael Goddard
2011-10-07 12:03:35 +10:00
committed by Qt by Nokia
parent 03f22bcdaf
commit adca03adfd
10 changed files with 464 additions and 149 deletions

View File

@@ -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

View File

@@ -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)

View File

@@ -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

View File

@@ -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)

View File

@@ -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, 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";
}
}
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()));
}
dbg.nospace() << "QVideoSurfaceFormat(" << typeName;
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())

View File

@@ -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