summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAndrew den Exter <andrew.den-exter@nokia.com>2009-11-04 07:56:49 (GMT)
committerAndrew den Exter <andrew.den-exter@nokia.com>2009-11-04 07:59:06 (GMT)
commitdb997a02c1d306260d8bbfe4f13e8312efb6fa7c (patch)
treefbb267f5aacd06b6328f36936f35f655978e90cf
parent70e62dacd529e9257c5bb372a680fe2ec4786a9c (diff)
downloadQt-db997a02c1d306260d8bbfe4f13e8312efb6fa7c.zip
Qt-db997a02c1d306260d8bbfe4f13e8312efb6fa7c.tar.gz
Qt-db997a02c1d306260d8bbfe4f13e8312efb6fa7c.tar.bz2
QVideoFrame API review changes.
Rename equivalentImageFormat() to imageFormatFromPixelFormat(). Rename equivalentPixelFormat() to pixelFormatFromImageFormat(). Rename numBytes() to mappedBytes(). Reviewed-by: Justin McPherson
-rw-r--r--examples/multimedia/videographicsitem/videoitem.cpp2
-rw-r--r--examples/multimedia/videowidget/videowidgetsurface.cpp4
-rw-r--r--src/multimedia/video/qvideoframe.cpp34
-rw-r--r--src/multimedia/video/qvideoframe.h6
-rw-r--r--tests/auto/qvideoframe/tst_qvideoframe.cpp18
5 files changed, 32 insertions, 32 deletions
diff --git a/examples/multimedia/videographicsitem/videoitem.cpp b/examples/multimedia/videographicsitem/videoitem.cpp
index 2d7b38e..99e8df8 100644
--- a/examples/multimedia/videographicsitem/videoitem.cpp
+++ b/examples/multimedia/videographicsitem/videoitem.cpp
@@ -104,7 +104,7 @@ QList<QVideoFrame::PixelFormat> VideoItem::supportedPixelFormats(
bool VideoItem::start(const QVideoSurfaceFormat &format)
{
if (isFormatSupported(format)) {
- imageFormat = QVideoFrame::equivalentImageFormat(format.pixelFormat());
+ imageFormat = QVideoFrame::imageFormatFromPixelFormat(format.pixelFormat());
imageSize = format.frameSize();
framePainted = true;
diff --git a/examples/multimedia/videowidget/videowidgetsurface.cpp b/examples/multimedia/videowidget/videowidgetsurface.cpp
index ec9b8b5..b69375c 100644
--- a/examples/multimedia/videowidget/videowidgetsurface.cpp
+++ b/examples/multimedia/videowidget/videowidgetsurface.cpp
@@ -73,7 +73,7 @@ bool VideoWidgetSurface::isFormatSupported(
{
Q_UNUSED(similar);
- const QImage::Format imageFormat = QVideoFrame::equivalentImageFormat(format.pixelFormat());
+ const QImage::Format imageFormat = QVideoFrame::imageFormatFromPixelFormat(format.pixelFormat());
const QSize size = format.frameSize();
return imageFormat != QImage::Format_Invalid
@@ -85,7 +85,7 @@ bool VideoWidgetSurface::isFormatSupported(
//! [2]
bool VideoWidgetSurface::start(const QVideoSurfaceFormat &format)
{
- const QImage::Format imageFormat = QVideoFrame::equivalentImageFormat(format.pixelFormat());
+ const QImage::Format imageFormat = QVideoFrame::imageFormatFromPixelFormat(format.pixelFormat());
const QSize size = format.frameSize();
if (imageFormat != QImage::Format_Invalid && !size.isEmpty()) {
diff --git a/src/multimedia/video/qvideoframe.cpp b/src/multimedia/video/qvideoframe.cpp
index c884da0..ae38e82 100644
--- a/src/multimedia/video/qvideoframe.cpp
+++ b/src/multimedia/video/qvideoframe.cpp
@@ -59,7 +59,7 @@ public:
: startTime(-1)
, endTime(-1)
, data(0)
- , numBytes(0)
+ , mappedBytes(0)
, bytesPerLine(0)
, pixelFormat(QVideoFrame::Format_Invalid)
, fieldType(QVideoFrame::ProgressiveFrame)
@@ -72,7 +72,7 @@ public:
, startTime(-1)
, endTime(-1)
, data(0)
- , numBytes(0)
+ , mappedBytes(0)
, bytesPerLine(0)
, pixelFormat(format)
, fieldType(QVideoFrame::ProgressiveFrame)
@@ -89,7 +89,7 @@ public:
qint64 startTime;
qint64 endTime;
uchar *data;
- int numBytes;
+ int mappedBytes;
int bytesPerLine;
QVideoFrame::PixelFormat pixelFormat;
QVideoFrame::FieldType fieldType;
@@ -109,7 +109,7 @@ private:
The contents of a video frame can be mapped to memory using the map() function. While
mapped the video data can accessed using the bits() function which returns a pointer to a
- buffer, the total size of which is given by the numBytes(), and the size of each line is given
+ buffer, the total size of which is given by the mappedBytes(), and the size of each line is given
by bytesPerLine(). The return value of the handle() function may be used to access frame data
using the internal buffer's native APIs.
@@ -304,12 +304,12 @@ QVideoFrame::QVideoFrame(int bytes, const QSize &size, int bytesPerLine, PixelFo
\note This will construct an invalid video frame if there is no frame type equivalent to the
image format.
- \sa equivalentPixelFormat()
+ \sa pixelFormatFromImageFormat()
*/
QVideoFrame::QVideoFrame(const QImage &image)
: d(new QVideoFramePrivate(
- image.size(), equivalentPixelFormat(image.format())))
+ image.size(), pixelFormatFromImageFormat(image.format())))
{
if (d->pixelFormat != Format_Invalid)
d->buffer = new QImageVideoBuffer(image);
@@ -510,9 +510,9 @@ bool QVideoFrame::map(QAbstractVideoBuffer::MapMode mode)
{
if (d->buffer != 0 && d->data == 0) {
Q_ASSERT(d->bytesPerLine == 0);
- Q_ASSERT(d->numBytes == 0);
+ Q_ASSERT(d->mappedBytes == 0);
- d->data = d->buffer->map(mode, &d->numBytes, &d->bytesPerLine);
+ d->data = d->buffer->map(mode, &d->mappedBytes, &d->bytesPerLine);
return d->data != 0;
}
@@ -532,7 +532,7 @@ bool QVideoFrame::map(QAbstractVideoBuffer::MapMode mode)
void QVideoFrame::unmap()
{
if (d->data != 0) {
- d->numBytes = 0;
+ d->mappedBytes = 0;
d->bytesPerLine = 0;
d->data = 0;
@@ -548,7 +548,7 @@ void QVideoFrame::unmap()
This value is only valid while the frame data is \l {map()}{mapped}.
- \sa bits(), map(), numBytes()
+ \sa bits(), map(), mappedBytes()
*/
int QVideoFrame::bytesPerLine() const
@@ -561,7 +561,7 @@ int QVideoFrame::bytesPerLine() const
This value is only valid while the frame data is \l {map()}{mapped}.
- \sa map(), numBytes(), bytesPerLine()
+ \sa map(), mappedBytes(), bytesPerLine()
*/
uchar *QVideoFrame::bits()
@@ -574,7 +574,7 @@ uchar *QVideoFrame::bits()
This value is only valid while the frame data is \l {map()}{mapped}.
- \sa map(), numBytes(), bytesPerLine()
+ \sa map(), mappedBytes(), bytesPerLine()
*/
const uchar *QVideoFrame::bits() const
@@ -583,16 +583,16 @@ const uchar *QVideoFrame::bits() const
}
/*!
- Returns the number of bytes occupied by the frame data.
+ Returns the number of bytes occupied by the mapped frame data.
This value is only valid while the frame data is \l {map()}{mapped}.
\sa map()
*/
-int QVideoFrame::numBytes() const
+int QVideoFrame::mappedBytes() const
{
- return d->numBytes;
+ return d->mappedBytes;
}
/*!
@@ -649,7 +649,7 @@ void QVideoFrame::setEndTime(qint64 time)
format QVideoFrame::InvalidType is returned instead.
*/
-QVideoFrame::PixelFormat QVideoFrame::equivalentPixelFormat(QImage::Format format)
+QVideoFrame::PixelFormat QVideoFrame::pixelFormatFromImageFormat(QImage::Format format)
{
switch (format) {
case QImage::Format_Invalid:
@@ -689,7 +689,7 @@ QVideoFrame::PixelFormat QVideoFrame::equivalentPixelFormat(QImage::Format forma
format QImage::Format_Invalid is returned instead.
*/
-QImage::Format QVideoFrame::equivalentImageFormat(PixelFormat format)
+QImage::Format QVideoFrame::imageFormatFromPixelFormat(PixelFormat format)
{
switch (format) {
case Format_Invalid:
diff --git a/src/multimedia/video/qvideoframe.h b/src/multimedia/video/qvideoframe.h
index e1b46a8..d08008b 100644
--- a/src/multimedia/video/qvideoframe.h
+++ b/src/multimedia/video/qvideoframe.h
@@ -141,7 +141,7 @@ public:
uchar *bits();
const uchar *bits() const;
- int numBytes() const;
+ int mappedBytes() const;
QVariant handle() const;
@@ -151,8 +151,8 @@ public:
qint64 endTime() const;
void setEndTime(qint64 time);
- static PixelFormat equivalentPixelFormat(QImage::Format format);
- static QImage::Format equivalentImageFormat(PixelFormat format);
+ static PixelFormat pixelFormatFromImageFormat(QImage::Format format);
+ static QImage::Format imageFormatFromPixelFormat(PixelFormat format);
private:
QExplicitlySharedDataPointer<QVideoFramePrivate> d;
diff --git a/tests/auto/qvideoframe/tst_qvideoframe.cpp b/tests/auto/qvideoframe/tst_qvideoframe.cpp
index b231069..432ef5c 100644
--- a/tests/auto/qvideoframe/tst_qvideoframe.cpp
+++ b/tests/auto/qvideoframe/tst_qvideoframe.cpp
@@ -524,7 +524,7 @@ void tst_QVideoFrame::assign()
void tst_QVideoFrame::map_data()
{
QTest::addColumn<QSize>("size");
- QTest::addColumn<int>("numBytes");
+ QTest::addColumn<int>("mappedBytes");
QTest::addColumn<int>("bytesPerLine");
QTest::addColumn<QVideoFrame::PixelFormat>("pixelFormat");
QTest::addColumn<QAbstractVideoBuffer::MapMode>("mode");
@@ -554,29 +554,29 @@ void tst_QVideoFrame::map_data()
void tst_QVideoFrame::map()
{
QFETCH(QSize, size);
- QFETCH(int, numBytes);
+ QFETCH(int, mappedBytes);
QFETCH(int, bytesPerLine);
QFETCH(QVideoFrame::PixelFormat, pixelFormat);
QFETCH(QAbstractVideoBuffer::MapMode, mode);
- QVideoFrame frame(numBytes, size, bytesPerLine, pixelFormat);
+ QVideoFrame frame(mappedBytes, size, bytesPerLine, pixelFormat);
QVERIFY(!frame.bits());
- QCOMPARE(frame.numBytes(), 0);
+ QCOMPARE(frame.mappedBytes(), 0);
QCOMPARE(frame.bytesPerLine(), 0);
QCOMPARE(frame.mapMode(), QAbstractVideoBuffer::NotMapped);
QVERIFY(frame.map(mode));
QVERIFY(frame.bits());
- QCOMPARE(frame.numBytes(), numBytes);
+ QCOMPARE(frame.mappedBytes(), mappedBytes);
QCOMPARE(frame.bytesPerLine(), bytesPerLine);
QCOMPARE(frame.mapMode(), mode);
frame.unmap();
QVERIFY(!frame.bits());
- QCOMPARE(frame.numBytes(), 0);
+ QCOMPARE(frame.mappedBytes(), 0);
QCOMPARE(frame.bytesPerLine(), 0);
QCOMPARE(frame.mapMode(), QAbstractVideoBuffer::NotMapped);
}
@@ -614,21 +614,21 @@ void tst_QVideoFrame::mapImage()
QVideoFrame frame(image);
QVERIFY(!frame.bits());
- QCOMPARE(frame.numBytes(), 0);
+ QCOMPARE(frame.mappedBytes(), 0);
QCOMPARE(frame.bytesPerLine(), 0);
QCOMPARE(frame.mapMode(), QAbstractVideoBuffer::NotMapped);
QVERIFY(frame.map(mode));
QVERIFY(frame.bits());
- QCOMPARE(frame.numBytes(), image.numBytes());
+ QCOMPARE(frame.mappedBytes(), image.numBytes());
QCOMPARE(frame.bytesPerLine(), image.bytesPerLine());
QCOMPARE(frame.mapMode(), mode);
frame.unmap();
QVERIFY(!frame.bits());
- QCOMPARE(frame.numBytes(), 0);
+ QCOMPARE(frame.mappedBytes(), 0);
QCOMPARE(frame.bytesPerLine(), 0);
QCOMPARE(frame.mapMode(), QAbstractVideoBuffer::NotMapped);
}