diff options
Diffstat (limited to 'src/multimedia/video')
-rw-r--r-- | src/multimedia/video/qabstractvideobuffer.cpp | 4 | ||||
-rw-r--r-- | src/multimedia/video/qabstractvideobuffer_p.h | 2 | ||||
-rw-r--r-- | src/multimedia/video/qimagevideobuffer.cpp | 2 | ||||
-rw-r--r-- | src/multimedia/video/qmemoryvideobuffer.cpp | 2 | ||||
-rw-r--r-- | src/multimedia/video/qvideoframe.cpp | 40 | ||||
-rw-r--r-- | src/multimedia/video/qvideoframe.h | 2 | ||||
-rw-r--r-- | src/multimedia/video/qvideooutputorientationhandler_p.h | 2 | ||||
-rw-r--r-- | src/multimedia/video/qvideoprobe.cpp | 6 | ||||
-rw-r--r-- | src/multimedia/video/qvideosurfaceoutput.cpp | 4 | ||||
-rw-r--r-- | src/multimedia/video/qvideosurfaceoutput_p.h | 2 |
10 files changed, 42 insertions, 24 deletions
diff --git a/src/multimedia/video/qabstractvideobuffer.cpp b/src/multimedia/video/qabstractvideobuffer.cpp index 50e38a98c..f0dd6d2eb 100644 --- a/src/multimedia/video/qabstractvideobuffer.cpp +++ b/src/multimedia/video/qabstractvideobuffer.cpp @@ -126,7 +126,7 @@ int QAbstractVideoBufferPrivate::map( Constructs an abstract video buffer of the given \a type. */ QAbstractVideoBuffer::QAbstractVideoBuffer(HandleType type) - : d_ptr(0) + : d_ptr(nullptr) , m_type(type) { } @@ -328,7 +328,7 @@ uchar *QAbstractPlanarVideoBuffer::map(MapMode mode, int *numBytes, int *bytesPe *bytesPerLine = strides[0]; return data[0]; } else { - return 0; + return nullptr; } } diff --git a/src/multimedia/video/qabstractvideobuffer_p.h b/src/multimedia/video/qabstractvideobuffer_p.h index 9e3ced9b5..4877d3120 100644 --- a/src/multimedia/video/qabstractvideobuffer_p.h +++ b/src/multimedia/video/qabstractvideobuffer_p.h @@ -64,7 +64,7 @@ class QAbstractVideoBufferPrivate { public: QAbstractVideoBufferPrivate() - : q_ptr(0) + : q_ptr(nullptr) {} virtual ~QAbstractVideoBufferPrivate() diff --git a/src/multimedia/video/qimagevideobuffer.cpp b/src/multimedia/video/qimagevideobuffer.cpp index f407e02d0..28dacefc6 100644 --- a/src/multimedia/video/qimagevideobuffer.cpp +++ b/src/multimedia/video/qimagevideobuffer.cpp @@ -96,7 +96,7 @@ uchar *QImageVideoBuffer::map(MapMode mode, int *numBytes, int *bytesPerLine) return d->image.bits(); } else { - return 0; + return nullptr; } } diff --git a/src/multimedia/video/qmemoryvideobuffer.cpp b/src/multimedia/video/qmemoryvideobuffer.cpp index 1b52bb7cd..e05210d9d 100644 --- a/src/multimedia/video/qmemoryvideobuffer.cpp +++ b/src/multimedia/video/qmemoryvideobuffer.cpp @@ -112,7 +112,7 @@ uchar *QMemoryVideoBuffer::map(MapMode mode, int *numBytes, int *bytesPerLine) return reinterpret_cast<uchar *>(d->data.data()); } else { - return 0; + return nullptr; } } diff --git a/src/multimedia/video/qvideoframe.cpp b/src/multimedia/video/qvideoframe.cpp index bbb87b63b..e94b838f9 100644 --- a/src/multimedia/video/qvideoframe.cpp +++ b/src/multimedia/video/qvideoframe.cpp @@ -75,7 +75,7 @@ public: , planeCount(0) , pixelFormat(QVideoFrame::Format_Invalid) , fieldType(QVideoFrame::ProgressiveFrame) - , buffer(0) + , buffer(nullptr) , mappedCount(0) { memset(data, 0, sizeof(data)); @@ -90,7 +90,7 @@ public: , planeCount(0) , pixelFormat(format) , fieldType(QVideoFrame::ProgressiveFrame) - , buffer(0) + , buffer(nullptr) , mappedCount(0) { memset(data, 0, sizeof(data)); @@ -195,6 +195,9 @@ private: \value Format_BGRA32_Premultiplied The frame is stored using a premultiplied 32bit BGRA format. + \value Format_ABGR32 + The frame is stored using a 32-bit ABGR format (0xAABBGGRR). + \value Format_BGR32 The frame is stored using a 32-bit BGR format (0xBBGGRRff). @@ -401,6 +404,15 @@ QVideoFrame::~QVideoFrame() } /*! + \return underlying video buffer or \c null if there is none. + \since 5.13 +*/ +QAbstractVideoBuffer *QVideoFrame::buffer() const +{ + return d->buffer; +} + +/*! Identifies whether a video frame is valid. An invalid frame has no video buffer associated with it. @@ -409,7 +421,7 @@ QVideoFrame::~QVideoFrame() */ bool QVideoFrame::isValid() const { - return d->buffer != 0; + return d->buffer != nullptr; } /*! @@ -485,7 +497,7 @@ void QVideoFrame::setFieldType(QVideoFrame::FieldType field) bool QVideoFrame::isMapped() const { - return d->buffer != 0 && d->buffer->mapMode() != QAbstractVideoBuffer::NotMapped; + return d->buffer != nullptr && d->buffer->mapMode() != QAbstractVideoBuffer::NotMapped; } /*! @@ -504,7 +516,7 @@ bool QVideoFrame::isMapped() const */ bool QVideoFrame::isWritable() const { - return d->buffer != 0 && (d->buffer->mapMode() & QAbstractVideoBuffer::WriteOnly); + return d->buffer != nullptr && (d->buffer->mapMode() & QAbstractVideoBuffer::WriteOnly); } /*! @@ -520,7 +532,7 @@ bool QVideoFrame::isWritable() const */ bool QVideoFrame::isReadable() const { - return d->buffer != 0 && (d->buffer->mapMode() & QAbstractVideoBuffer::ReadOnly); + return d->buffer != nullptr && (d->buffer->mapMode() & QAbstractVideoBuffer::ReadOnly); } /*! @@ -530,7 +542,7 @@ bool QVideoFrame::isReadable() const */ QAbstractVideoBuffer::MapMode QVideoFrame::mapMode() const { - return d->buffer != 0 ? d->buffer->mapMode() : QAbstractVideoBuffer::NotMapped; + return d->buffer != nullptr ? d->buffer->mapMode() : QAbstractVideoBuffer::NotMapped; } /*! @@ -584,7 +596,7 @@ bool QVideoFrame::map(QAbstractVideoBuffer::MapMode mode) } } - Q_ASSERT(d->data[0] == 0); + Q_ASSERT(d->data[0] == nullptr); Q_ASSERT(d->bytesPerLine[0] == 0); Q_ASSERT(d->planeCount == 0); Q_ASSERT(d->mappedBytes == 0); @@ -606,6 +618,7 @@ bool QVideoFrame::map(QAbstractVideoBuffer::MapMode mode) case Format_ARGB8565_Premultiplied: case Format_BGRA32: case Format_BGRA32_Premultiplied: + case Format_ABGR32: case Format_BGR32: case Format_BGR24: case Format_BGR565: @@ -763,7 +776,7 @@ uchar *QVideoFrame::bits() */ uchar *QVideoFrame::bits(int plane) { - return plane >= 0 && plane < d->planeCount ? d->data[plane] : 0; + return plane >= 0 && plane < d->planeCount ? d->data[plane] : nullptr; } /*! @@ -794,7 +807,7 @@ const uchar *QVideoFrame::bits() const */ const uchar *QVideoFrame::bits(int plane) const { - return plane >= 0 && plane < d->planeCount ? d->data[plane] : 0; + return plane >= 0 && plane < d->planeCount ? d->data[plane] : nullptr; } /*! @@ -832,7 +845,7 @@ int QVideoFrame::planeCount() const */ QVariant QVideoFrame::handle() const { - return d->buffer != 0 ? d->buffer->handle() : QVariant(); + return d->buffer != nullptr ? d->buffer->handle() : QVariant(); } /*! @@ -1035,6 +1048,7 @@ static VideoFrameConvertFunc qConvertFuncs[QVideoFrame::NPixelFormats] = { /* Format_ARGB8565_Premultiplied */ nullptr, // Not needed /* Format_BGRA32 */ qt_convert_BGRA32_to_ARGB32, /* Format_BGRA32_Premultiplied */ qt_convert_BGRA32_to_ARGB32, + /* Format_ABGR32 */ nullptr, /* Format_BGR32 */ qt_convert_BGRA32_to_ARGB32, /* Format_BGR24 */ qt_convert_BGR24_to_ARGB32, /* Format_BGR565 */ qt_convert_BGR565_to_ARGB32, @@ -1102,7 +1116,7 @@ QImage qt_imageFromVideoFrame(const QVideoFrame &f) // Formats supported by QImage don't need conversion QImage::Format imageFormat = QVideoFrame::imageFormatFromPixelFormat(frame.pixelFormat()); if (imageFormat != QImage::Format_Invalid) { - result = QImage(frame.bits(), frame.width(), frame.height(), imageFormat).copy(); + result = QImage(frame.bits(), frame.width(), frame.height(), frame.bytesPerLine(), imageFormat).copy(); } // Load from JPG @@ -1157,6 +1171,8 @@ QDebug operator<<(QDebug dbg, QVideoFrame::PixelFormat pf) return dbg << "Format_BGRA32"; case QVideoFrame::Format_BGRA32_Premultiplied: return dbg << "Format_BGRA32_Premultiplied"; + case QVideoFrame::Format_ABGR32: + return dbg << "Format_ABGR32"; case QVideoFrame::Format_BGR32: return dbg << "Format_BGR32"; case QVideoFrame::Format_BGR24: diff --git a/src/multimedia/video/qvideoframe.h b/src/multimedia/video/qvideoframe.h index be7517c7c..375f80dac 100644 --- a/src/multimedia/video/qvideoframe.h +++ b/src/multimedia/video/qvideoframe.h @@ -75,6 +75,7 @@ public: Format_ARGB8565_Premultiplied, Format_BGRA32, Format_BGRA32_Premultiplied, + Format_ABGR32, Format_BGR32, Format_BGR24, Format_BGR565, @@ -119,6 +120,7 @@ public: bool operator==(const QVideoFrame &other) const; bool operator!=(const QVideoFrame &other) const; + QAbstractVideoBuffer *buffer() const; bool isValid() const; PixelFormat pixelFormat() const; diff --git a/src/multimedia/video/qvideooutputorientationhandler_p.h b/src/multimedia/video/qvideooutputorientationhandler_p.h index b5cfc089b..d04a781ab 100644 --- a/src/multimedia/video/qvideooutputorientationhandler_p.h +++ b/src/multimedia/video/qvideooutputorientationhandler_p.h @@ -61,7 +61,7 @@ class Q_MULTIMEDIA_EXPORT QVideoOutputOrientationHandler : public QObject { Q_OBJECT public: - explicit QVideoOutputOrientationHandler(QObject *parent = 0); + explicit QVideoOutputOrientationHandler(QObject *parent = nullptr); int currentOrientation() const; diff --git a/src/multimedia/video/qvideoprobe.cpp b/src/multimedia/video/qvideoprobe.cpp index b1531df63..f7995b297 100644 --- a/src/multimedia/video/qvideoprobe.cpp +++ b/src/multimedia/video/qvideoprobe.cpp @@ -161,7 +161,7 @@ bool QVideoProbe::setSource(QMediaObject *source) } } - return (!source || d->probee != 0); + return (!source || d->probee != nullptr); } /*! @@ -179,7 +179,7 @@ bool QVideoProbe::setSource(QMediaObject *source) */ bool QVideoProbe::setSource(QMediaRecorder *mediaRecorder) { - QMediaObject *source = mediaRecorder ? mediaRecorder->mediaObject() : 0; + QMediaObject *source = mediaRecorder ? mediaRecorder->mediaObject() : nullptr; bool result = setSource(source); if (!mediaRecorder) @@ -198,7 +198,7 @@ bool QVideoProbe::setSource(QMediaRecorder *mediaRecorder) */ bool QVideoProbe::isActive() const { - return d->probee != 0; + return d->probee != nullptr; } /*! diff --git a/src/multimedia/video/qvideosurfaceoutput.cpp b/src/multimedia/video/qvideosurfaceoutput.cpp index feb956dd0..ebc9e1cb6 100644 --- a/src/multimedia/video/qvideosurfaceoutput.cpp +++ b/src/multimedia/video/qvideosurfaceoutput.cpp @@ -55,7 +55,7 @@ QVideoSurfaceOutput::QVideoSurfaceOutput(QObject*parent) QVideoSurfaceOutput::~QVideoSurfaceOutput() { if (m_control) { - m_control.data()->setSurface(0); + m_control.data()->setSurface(nullptr); m_service.data()->releaseControl(m_control.data()); } } @@ -76,7 +76,7 @@ void QVideoSurfaceOutput::setVideoSurface(QAbstractVideoSurface *surface) bool QVideoSurfaceOutput::setMediaObject(QMediaObject *object) { if (m_control) { - m_control.data()->setSurface(0); + m_control.data()->setSurface(nullptr); m_service.data()->releaseControl(m_control.data()); } m_control.clear(); diff --git a/src/multimedia/video/qvideosurfaceoutput_p.h b/src/multimedia/video/qvideosurfaceoutput_p.h index a1b24abbf..5d050bcb0 100644 --- a/src/multimedia/video/qvideosurfaceoutput_p.h +++ b/src/multimedia/video/qvideosurfaceoutput_p.h @@ -67,7 +67,7 @@ class QVideoSurfaceOutput : public QObject, public QMediaBindableInterface Q_OBJECT Q_INTERFACES(QMediaBindableInterface) public: - QVideoSurfaceOutput(QObject*parent = 0); + QVideoSurfaceOutput(QObject *parent = nullptr); ~QVideoSurfaceOutput(); QMediaObject *mediaObject() const override; |