summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLars Knoll <lars.knoll@qt.io>2021-03-02 13:11:36 +0100
committerLars Knoll <lars.knoll@qt.io>2021-03-16 07:41:44 +0000
commit5671ab651d9c938a0ff2df3a9c0baef9891e7e23 (patch)
tree4c5c6fde332af93b3d5f5cb4198df1ee0668434a
parente7702afc9dfa6e69b1b05d68a38248ccc6b6dd87 (diff)
Move HandleType and MapMode from QAbstractVideoBuffer to QVideoFrame
QAbstractVideoBuffer is a class that is only required inside our implementation, so we can make it private. This change prepares for it. Change-Id: I4ba4542c1eab742f2fc93231e2e5063dbc5d5e94 Reviewed-by: Doris Verria <doris.verria@qt.io> Reviewed-by: Lars Knoll <lars.knoll@qt.io>
-rw-r--r--examples/multimedia/video/qmlvideofilter_opencl/main.cpp12
-rw-r--r--examples/multimedia/video/qmlvideofilter_opencl/rgbframehelper.h6
-rw-r--r--examples/multimediawidgets/customvideosurface/customvideoitem/videoitem.cpp6
-rw-r--r--examples/multimediawidgets/customvideosurface/customvideoitem/videoitem.h2
-rw-r--r--examples/multimediawidgets/customvideosurface/customvideowidget/videowidgetsurface.cpp8
-rw-r--r--examples/multimediawidgets/customvideosurface/customvideowidget/videowidgetsurface.h2
-rw-r--r--examples/multimediawidgets/player/histogramwidget.cpp2
-rw-r--r--src/imports/multimedia/qmldir1
-rw-r--r--src/multimedia/doc/snippets/multimedia-snippets/camera.cpp2
-rw-r--r--src/multimedia/doc/snippets/multimedia-snippets/media.cpp4
-rw-r--r--src/multimedia/doc/snippets/multimedia-snippets/video.cpp2
-rw-r--r--src/multimedia/platform/android/common/qandroidvideooutput.cpp17
-rw-r--r--src/multimedia/platform/android/mediacapture/qandroidcamerasession.cpp4
-rw-r--r--src/multimedia/platform/android/mediacapture/qandroidcameravideorenderercontrol.cpp2
-rw-r--r--src/multimedia/platform/darwin/camera/avfcamerarenderercontrol.mm30
-rw-r--r--src/multimedia/platform/darwin/mediaplayer/avfvideorenderercontrol.mm20
-rw-r--r--src/multimedia/platform/gstreamer/common/qgstutils.cpp2
-rw-r--r--src/multimedia/platform/gstreamer/common/qgstutils_p.h2
-rw-r--r--src/multimedia/platform/gstreamer/common/qgstvideobuffer.cpp18
-rw-r--r--src/multimedia/platform/gstreamer/common/qgstvideobuffer_p.h8
-rw-r--r--src/multimedia/platform/gstreamer/common/qgstvideorendererplugin_p.h5
-rw-r--r--src/multimedia/platform/gstreamer/common/qgstvideorenderersink.cpp10
-rw-r--r--src/multimedia/platform/gstreamer/common/qgstvideorenderersink_p.h2
-rw-r--r--src/multimedia/platform/qnx/mediaplayer/mmrendererplayervideorenderercontrol.cpp8
-rw-r--r--src/multimedia/platform/windows/evr/evrcustompresenter.cpp4
-rw-r--r--src/multimedia/platform/windows/evr/evrd3dpresentengine.cpp26
-rw-r--r--src/multimedia/platform/windows/player/mfvideorenderercontrol.cpp17
-rw-r--r--src/multimedia/video/qabstractvideobuffer.cpp54
-rw-r--r--src/multimedia/video/qabstractvideobuffer.h37
-rw-r--r--src/multimedia/video/qabstractvideosurface.cpp4
-rw-r--r--src/multimedia/video/qabstractvideosurface.h2
-rw-r--r--src/multimedia/video/qimagevideobuffer.cpp12
-rw-r--r--src/multimedia/video/qimagevideobuffer_p.h4
-rw-r--r--src/multimedia/video/qmemoryvideobuffer.cpp12
-rw-r--r--src/multimedia/video/qmemoryvideobuffer_p.h4
-rw-r--r--src/multimedia/video/qvideoframe.cpp72
-rw-r--r--src/multimedia/video/qvideoframe.h33
-rw-r--r--src/multimedia/video/qvideosurfaceformat.cpp14
-rw-r--r--src/multimedia/video/qvideosurfaceformat.h4
-rw-r--r--src/multimedia/video/qvideosurfaces.cpp2
-rw-r--r--src/multimedia/video/qvideosurfaces_p.h2
-rw-r--r--src/multimediawidgets/qpaintervideosurface.cpp88
-rw-r--r--src/multimediawidgets/qpaintervideosurface_p.h4
-rw-r--r--src/plugins/videonode/imx6/qsgvivantevideomaterial.cpp2
-rw-r--r--src/plugins/videonode/imx6/qsgvivantevideonode.h2
-rw-r--r--src/plugins/videonode/imx6/qsgvivantevideonodefactory.cpp4
-rw-r--r--src/plugins/videonode/imx6/qsgvivantevideonodefactory.h2
-rw-r--r--src/qtmultimediaquicktools/qdeclarativevideooutput_render.cpp6
-rw-r--r--src/qtmultimediaquicktools/qdeclarativevideooutput_render_p.h2
-rw-r--r--src/qtmultimediaquicktools/qsgvideonode_p.h6
-rw-r--r--src/qtmultimediaquicktools/qsgvideonode_rgb.cpp6
-rw-r--r--src/qtmultimediaquicktools/qsgvideonode_rgb_p.h6
-rw-r--r--src/qtmultimediaquicktools/qsgvideonode_texture.cpp8
-rw-r--r--src/qtmultimediaquicktools/qsgvideonode_texture_p.h4
-rw-r--r--src/qtmultimediaquicktools/qsgvideonode_yuv.cpp16
-rw-r--r--src/qtmultimediaquicktools/qsgvideonode_yuv_p.h6
-rw-r--r--tests/auto/integration/qmediaplayerbackend/tst_qmediaplayerbackend.cpp10
-rw-r--r--tests/auto/unit/mockbackend/mockvideosurface.h2
-rw-r--r--tests/auto/unit/multimedia/qabstractvideobuffer/tst_qabstractvideobuffer.cpp29
-rw-r--r--tests/auto/unit/multimedia/qabstractvideosurface/tst_qabstractvideosurface.cpp34
-rw-r--r--tests/auto/unit/multimedia/qvideoframe/tst_qvideoframe.cpp160
-rw-r--r--tests/auto/unit/multimedia/qvideosurfaceformat/tst_qvideosurfaceformat.cpp52
-rw-r--r--tests/auto/unit/multimediawidgets/qgraphicsvideoitem/tst_qgraphicsvideoitem.cpp4
-rw-r--r--tests/auto/unit/multimediawidgets/qpaintervideosurface/tst_qpaintervideosurface.cpp111
-rw-r--r--tests/auto/unit/multimediawidgets/qvideowidget/tst_qvideowidget.cpp4
-rw-r--r--tests/auto/unit/qml/qdeclarativeaudio/tst_qdeclarativeaudio.cpp2
66 files changed, 520 insertions, 528 deletions
diff --git a/examples/multimedia/video/qmlvideofilter_opencl/main.cpp b/examples/multimedia/video/qmlvideofilter_opencl/main.cpp
index 255c0b61b..58c8967f0 100644
--- a/examples/multimedia/video/qmlvideofilter_opencl/main.cpp
+++ b/examples/multimedia/video/qmlvideofilter_opencl/main.cpp
@@ -317,8 +317,8 @@ QVideoFrame CLFilterRunnable::run(QVideoFrame *input, const QVideoSurfaceFormat
// The latter is the fast path where everything happens on GPU. THe former involves a texture upload.
if (!input->isValid()
- || (input->handleType() != QAbstractVideoBuffer::NoHandle
- && input->handleType() != QAbstractVideoBuffer::GLTextureHandle)) {
+ || (input->handleType() != QVideoFrame::NoHandle
+ && input->handleType() != QVideoFrame::GLTextureHandle)) {
qWarning("Invalid input format");
return *input;
}
@@ -337,13 +337,13 @@ QVideoFrame CLFilterRunnable::run(QVideoFrame *input, const QVideoSurfaceFormat
// Create a texture from the image data.
QOpenGLFunctions *f = QOpenGLContext::currentContext()->functions();
GLuint texture;
- if (input->handleType() == QAbstractVideoBuffer::NoHandle) {
+ if (input->handleType() == QVideoFrame::NoHandle) {
// Upload.
if (m_tempTexture)
f->glBindTexture(GL_TEXTURE_2D, m_tempTexture);
else
m_tempTexture = newTexture();
- input->map(QAbstractVideoBuffer::ReadOnly);
+ input->map(QVideoFrame::ReadOnly);
// glTexImage2D only once and use TexSubImage later on. This avoids the need
// to recreate the CL image object on every frame.
f->glTexSubImage2D(GL_TEXTURE_2D, 0, 0, 0, m_size.width(), m_size.height(),
@@ -482,11 +482,11 @@ QVideoFrame InfoFilterRunnable::run(QVideoFrame *input, const QVideoSurfaceForma
InfoFilterResult *result = new InfoFilterResult;
result->m_frameResolution = input->size();
switch (input->handleType()) {
- case QAbstractVideoBuffer::NoHandle:
+ case QVideoFrame::NoHandle:
result->m_handleType = QLatin1String("pixel data");
result->m_pixelFormat = input->pixelFormat();
break;
- case QAbstractVideoBuffer::GLTextureHandle:
+ case QVideoFrame::GLTextureHandle:
result->m_handleType = QLatin1String("OpenGL texture");
break;
default:
diff --git a/examples/multimedia/video/qmlvideofilter_opencl/rgbframehelper.h b/examples/multimedia/video/qmlvideofilter_opencl/rgbframehelper.h
index 638337ea4..ea82b267e 100644
--- a/examples/multimedia/video/qmlvideofilter_opencl/rgbframehelper.h
+++ b/examples/multimedia/video/qmlvideofilter_opencl/rgbframehelper.h
@@ -60,21 +60,21 @@
/*
Returns a QImage that wraps the given video frame.
- This is suitable only for QAbstractVideoBuffer::NoHandle frames with RGB (or BGR)
+ This is suitable only for QVideoFrame::NoHandle frames with RGB (or BGR)
data. YUV is not supported here.
The QVideoFrame must be mapped and kept mapped as long as the wrapping QImage
exists.
As a convenience the function also supports frames with a handle type of
- QAbstractVideoBuffer::GLTextureHandle. This allows creating a system memory backed
+ QVideoFrame::GLTextureHandle. This allows creating a system memory backed
QVideoFrame containing the image data from an OpenGL texture. However, readback is a
slow operation and may stall the GPU pipeline and should be avoided in production code.
*/
QImage imageWrapper(const QVideoFrame &frame)
{
#ifndef QT_NO_OPENGL
- if (frame.handleType() == QAbstractVideoBuffer::GLTextureHandle) {
+ if (frame.handleType() == QVideoFrame::GLTextureHandle) {
// Slow and inefficient path. Ideally what's on the GPU should remain on the GPU, instead of readbacks like this.
QImage img(frame.width(), frame.height(), QImage::Format_RGBA8888);
GLuint textureId = frame.handle().toUInt();
diff --git a/examples/multimediawidgets/customvideosurface/customvideoitem/videoitem.cpp b/examples/multimediawidgets/customvideosurface/customvideoitem/videoitem.cpp
index b2dc6331d..0271f023a 100644
--- a/examples/multimediawidgets/customvideosurface/customvideoitem/videoitem.cpp
+++ b/examples/multimediawidgets/customvideosurface/customvideoitem/videoitem.cpp
@@ -73,7 +73,7 @@ void VideoItem::paint(QPainter *painter, const QStyleOptionGraphicsItem *option,
Q_UNUSED(option);
Q_UNUSED(widget);
- if (currentFrame.map(QAbstractVideoBuffer::ReadOnly)) {
+ if (currentFrame.map(QVideoFrame::ReadOnly)) {
const QTransform oldTransform = painter->transform();
if (surfaceFormat().scanLineDirection() == QVideoSurfaceFormat::BottomToTop) {
@@ -96,9 +96,9 @@ void VideoItem::paint(QPainter *painter, const QStyleOptionGraphicsItem *option,
}
QList<QVideoFrame::PixelFormat> VideoItem::supportedPixelFormats(
- QAbstractVideoBuffer::HandleType handleType) const
+ QVideoFrame::HandleType handleType) const
{
- if (handleType == QAbstractVideoBuffer::NoHandle) {
+ if (handleType == QVideoFrame::NoHandle) {
return QList<QVideoFrame::PixelFormat>()
<< QVideoFrame::Format_RGB32
<< QVideoFrame::Format_ARGB32
diff --git a/examples/multimediawidgets/customvideosurface/customvideoitem/videoitem.h b/examples/multimediawidgets/customvideosurface/customvideoitem/videoitem.h
index 2dc121d92..7fff81a2f 100644
--- a/examples/multimediawidgets/customvideosurface/customvideoitem/videoitem.h
+++ b/examples/multimediawidgets/customvideosurface/customvideoitem/videoitem.h
@@ -70,7 +70,7 @@ public:
//video surface
QList<QVideoFrame::PixelFormat> supportedPixelFormats(
- QAbstractVideoBuffer::HandleType handleType = QAbstractVideoBuffer::NoHandle) const override;
+ QVideoFrame::HandleType handleType = QVideoFrame::NoHandle) const override;
bool start(const QVideoSurfaceFormat &format) override;
void stop() override;
diff --git a/examples/multimediawidgets/customvideosurface/customvideowidget/videowidgetsurface.cpp b/examples/multimediawidgets/customvideosurface/customvideowidget/videowidgetsurface.cpp
index 9b1d68202..a9b98e06e 100644
--- a/examples/multimediawidgets/customvideosurface/customvideowidget/videowidgetsurface.cpp
+++ b/examples/multimediawidgets/customvideosurface/customvideowidget/videowidgetsurface.cpp
@@ -63,9 +63,9 @@ VideoWidgetSurface::VideoWidgetSurface(QWidget *widget, QObject *parent)
//! [0]
QList<QVideoFrame::PixelFormat> VideoWidgetSurface::supportedPixelFormats(
- QAbstractVideoBuffer::HandleType handleType) const
+ QVideoFrame::HandleType handleType) const
{
- if (handleType == QAbstractVideoBuffer::NoHandle) {
+ if (handleType == QVideoFrame::NoHandle) {
return QList<QVideoFrame::PixelFormat>()
<< QVideoFrame::Format_RGB32
<< QVideoFrame::Format_ARGB32
@@ -86,7 +86,7 @@ bool VideoWidgetSurface::isFormatSupported(const QVideoSurfaceFormat &format) co
return imageFormat != QImage::Format_Invalid
&& !size.isEmpty()
- && format.handleType() == QAbstractVideoBuffer::NoHandle;
+ && format.handleType() == QVideoFrame::NoHandle;
}
//! [1]
@@ -157,7 +157,7 @@ void VideoWidgetSurface::updateVideoRect()
//! [6]
void VideoWidgetSurface::paint(QPainter *painter)
{
- if (currentFrame.map(QAbstractVideoBuffer::ReadOnly)) {
+ if (currentFrame.map(QVideoFrame::ReadOnly)) {
const QTransform oldTransform = painter->transform();
if (surfaceFormat().scanLineDirection() == QVideoSurfaceFormat::BottomToTop) {
diff --git a/examples/multimediawidgets/customvideosurface/customvideowidget/videowidgetsurface.h b/examples/multimediawidgets/customvideosurface/customvideowidget/videowidgetsurface.h
index d9765d836..a445cf6d6 100644
--- a/examples/multimediawidgets/customvideosurface/customvideowidget/videowidgetsurface.h
+++ b/examples/multimediawidgets/customvideosurface/customvideowidget/videowidgetsurface.h
@@ -65,7 +65,7 @@ public:
VideoWidgetSurface(QWidget *widget, QObject *parent = 0);
QList<QVideoFrame::PixelFormat> supportedPixelFormats(
- QAbstractVideoBuffer::HandleType handleType = QAbstractVideoBuffer::NoHandle) const override;
+ QVideoFrame::HandleType handleType = QVideoFrame::NoHandle) const override;
bool isFormatSupported(const QVideoSurfaceFormat &format) const override;
bool start(const QVideoSurfaceFormat &format) override;
diff --git a/examples/multimediawidgets/player/histogramwidget.cpp b/examples/multimediawidgets/player/histogramwidget.cpp
index 488c89511..78a666c6d 100644
--- a/examples/multimediawidgets/player/histogramwidget.cpp
+++ b/examples/multimediawidgets/player/histogramwidget.cpp
@@ -208,7 +208,7 @@ void FrameProcessor::processFrame(QVideoFrame frame, int levels)
if (!levels)
break;
- if (!frame.map(QAbstractVideoBuffer::ReadOnly))
+ if (!frame.map(QVideoFrame::ReadOnly))
break;
if (frame.pixelFormat() == QVideoFrame::Format_YUV420P ||
diff --git a/src/imports/multimedia/qmldir b/src/imports/multimedia/qmldir
index d68049f63..e7dcc3dd6 100644
--- a/src/imports/multimedia/qmldir
+++ b/src/imports/multimedia/qmldir
@@ -4,3 +4,4 @@ classname QMultimediaDeclarativeModule
typeinfo plugins.qmltypes
typeinfo plugins.qmltypes
Video 5.0 Video.qml
+
diff --git a/src/multimedia/doc/snippets/multimedia-snippets/camera.cpp b/src/multimedia/doc/snippets/multimedia-snippets/camera.cpp
index eeb24a6a2..85b2072dd 100644
--- a/src/multimedia/doc/snippets/multimedia-snippets/camera.cpp
+++ b/src/multimedia/doc/snippets/multimedia-snippets/camera.cpp
@@ -87,7 +87,7 @@ void overview_camera_by_position()
// -.-
class MyVideoSurface : public QAbstractVideoSurface
{
- QList<QVideoFrame::PixelFormat> supportedPixelFormats(QAbstractVideoBuffer::HandleType handleType) const
+ QList<QVideoFrame::PixelFormat> supportedPixelFormats(QVideoFrame::HandleType handleType) const
{
Q_UNUSED(handleType);
return QList<QVideoFrame::PixelFormat>();
diff --git a/src/multimedia/doc/snippets/multimedia-snippets/media.cpp b/src/multimedia/doc/snippets/multimedia-snippets/media.cpp
index 4acbdc842..a4dc3156d 100644
--- a/src/multimedia/doc/snippets/multimedia-snippets/media.cpp
+++ b/src/multimedia/doc/snippets/multimedia-snippets/media.cpp
@@ -62,7 +62,7 @@ class MediaExample : public QObject {
void AudioRecorder();
void EncoderSettings();
void ImageEncoderSettings();
-
+
private:
// Common naming
QVideoWidget *videoWidget;
@@ -174,7 +174,7 @@ void MediaExample::MediaPlayer()
{
public:
Surface(QObject *p) : QAbstractVideoSurface(p) { }
- QList<QVideoFrame::PixelFormat> supportedPixelFormats(QAbstractVideoBuffer::HandleType) const override
+ QList<QVideoFrame::PixelFormat> supportedPixelFormats(QVideoFrame::HandleType) const override
{
// Make sure that the driver supports this pixel format.
return QList<QVideoFrame::PixelFormat>() << QVideoFrame::Format_YUYV;
diff --git a/src/multimedia/doc/snippets/multimedia-snippets/video.cpp b/src/multimedia/doc/snippets/multimedia-snippets/video.cpp
index 2e290408f..561a852b5 100644
--- a/src/multimedia/doc/snippets/multimedia-snippets/video.cpp
+++ b/src/multimedia/doc/snippets/multimedia-snippets/video.cpp
@@ -53,7 +53,7 @@
class MyVideoSurface : public QAbstractVideoSurface
{
QList<QVideoFrame::PixelFormat> supportedPixelFormats(
- QAbstractVideoBuffer::HandleType handleType = QAbstractVideoBuffer::NoHandle) const
+ QVideoFrame::HandleType handleType = QVideoFrame::NoHandle) const
{
Q_UNUSED(handleType);
diff --git a/src/multimedia/platform/android/common/qandroidvideooutput.cpp b/src/multimedia/platform/android/common/qandroidvideooutput.cpp
index 0fa6cb84a..5db89639f 100644
--- a/src/multimedia/platform/android/common/qandroidvideooutput.cpp
+++ b/src/multimedia/platform/android/common/qandroidvideooutput.cpp
@@ -41,6 +41,7 @@
#include "androidsurfacetexture_p.h"
#include <QAbstractVideoSurface>
+#include <QAbstractVideoBuffer>
#include <QVideoSurfaceFormat>
#include <qevent.h>
#include <qcoreapplication.h>
@@ -93,8 +94,8 @@ class AndroidTextureVideoBuffer : public QAbstractVideoBuffer
{
public:
AndroidTextureVideoBuffer(QAndroidTextureVideoOutput *output, const QSize &size)
- : QAbstractVideoBuffer(GLTextureHandle)
- , m_mapMode(NotMapped)
+ : QAbstractVideoBuffer(QVideoFrame::GLTextureHandle)
+ , m_mapMode(QVideoFrame::NotMapped)
, m_output(output)
, m_size(size)
, m_textureUpdated(false)
@@ -103,12 +104,12 @@ public:
virtual ~AndroidTextureVideoBuffer() {}
- MapMode mapMode() const override { return m_mapMode; }
+ QVideoFrame::MapMode mapMode() const override { return m_mapMode; }
- MapData map(MapMode mode) override
+ MapData map(QVideoFrame::MapMode mode) override
{
MapData mapData;
- if (m_mapMode == NotMapped && mode == ReadOnly && updateFrame()) {
+ if (m_mapMode == QVideoFrame::NotMapped && mode == QVideoFrame::ReadOnly && updateFrame()) {
m_mapMode = mode;
m_image = m_output->m_fbo->toImage();
@@ -124,7 +125,7 @@ public:
void unmap() override
{
m_image = QImage();
- m_mapMode = NotMapped;
+ m_mapMode = QVideoFrame::NotMapped;
}
QVariant handle() const override
@@ -160,7 +161,7 @@ private:
return (m_textureUpdated = m_output->renderFrameToFbo());
}
- MapMode m_mapMode;
+ QVideoFrame::MapMode m_mapMode;
QAndroidTextureVideoOutput *m_output;
QImage m_image;
QSize m_size;
@@ -331,7 +332,7 @@ void QAndroidTextureVideoOutput::onFrameAvailable()
if (!m_surface->isActive()) {
QVideoSurfaceFormat format(frame.size(), frame.pixelFormat(),
- QAbstractVideoBuffer::GLTextureHandle);
+ QVideoFrame::GLTextureHandle);
m_surface->start(format);
}
diff --git a/src/multimedia/platform/android/mediacapture/qandroidcamerasession.cpp b/src/multimedia/platform/android/mediacapture/qandroidcamerasession.cpp
index ab72ad836..20be56916 100644
--- a/src/multimedia/platform/android/mediacapture/qandroidcamerasession.cpp
+++ b/src/multimedia/platform/android/mediacapture/qandroidcamerasession.cpp
@@ -366,10 +366,10 @@ struct NullSurface : QAbstractVideoSurface
{
NullSurface(QObject *parent = nullptr) : QAbstractVideoSurface(parent) { }
QList<QVideoFrame::PixelFormat> supportedPixelFormats(
- QAbstractVideoBuffer::HandleType type = QAbstractVideoBuffer::NoHandle) const override
+ QVideoFrame::HandleType type = QVideoFrame::NoHandle) const override
{
QList<QVideoFrame::PixelFormat> result;
- if (type == QAbstractVideoBuffer::NoHandle)
+ if (type == QVideoFrame::NoHandle)
result << QVideoFrame::Format_NV21;
return result;
diff --git a/src/multimedia/platform/android/mediacapture/qandroidcameravideorenderercontrol.cpp b/src/multimedia/platform/android/mediacapture/qandroidcameravideorenderercontrol.cpp
index 47fac4e63..ceafd08cd 100644
--- a/src/multimedia/platform/android/mediacapture/qandroidcameravideorenderercontrol.cpp
+++ b/src/multimedia/platform/android/mediacapture/qandroidcameravideorenderercontrol.cpp
@@ -255,7 +255,7 @@ void QAndroidCameraVideoRendererControl::setSurface(QAbstractVideoSurface *surfa
QAndroidVideoOutput *newOutput = 0;
if (m_surface) {
- if (!m_surface->supportedPixelFormats(QAbstractVideoBuffer::GLTextureHandle).isEmpty()) {
+ if (!m_surface->supportedPixelFormats(QVideoFrame::GLTextureHandle).isEmpty()) {
if (!m_textureOutput) {
m_dataOutput = 0;
newOutput = m_textureOutput = new QAndroidTextureVideoOutput(this);
diff --git a/src/multimedia/platform/darwin/camera/avfcamerarenderercontrol.mm b/src/multimedia/platform/darwin/camera/avfcamerarenderercontrol.mm
index 01ad9c30d..528007c9e 100644
--- a/src/multimedia/platform/darwin/camera/avfcamerarenderercontrol.mm
+++ b/src/multimedia/platform/darwin/camera/avfcamerarenderercontrol.mm
@@ -60,16 +60,16 @@ class CVImageVideoBuffer : public QAbstractVideoBuffer
public:
CVImageVideoBuffer(CVImageBufferRef buffer, AVFCameraRendererControl *renderer)
#ifndef Q_OS_IOS
- : QAbstractVideoBuffer(NoHandle)
+ : QAbstractVideoBuffer(QVideoFrame::NoHandle)
#else
: QAbstractVideoBuffer(renderer->supportsTextures()
&& CVPixelBufferGetPixelFormatType(buffer) == kCVPixelFormatType_32BGRA
- ? GLTextureHandle : NoHandle)
+ ? QVideoFrame::GLTextureHandle : QVideoFrame::NoHandle)
, m_texture(nullptr)
, m_renderer(renderer)
#endif
, m_buffer(buffer)
- , m_mode(NotMapped)
+ , m_mode(QVideoFrame::NotMapped)
{
#ifndef Q_OS_IOS
Q_UNUSED(renderer);
@@ -87,9 +87,9 @@ public:
CVPixelBufferRelease(m_buffer);
}
- MapMode mapMode() const { return m_mode; }
+ QVideoFrame::MapMode mapMode() const { return m_mode; }
- MapData map(QAbstractVideoBuffer::MapMode mode)
+ MapData map(QVideoFrame::MapMode mode)
{
MapData mapData;
@@ -105,8 +105,8 @@ public:
}
// For a bi-planar format we have to set the parameters correctly:
- if (mode != QAbstractVideoBuffer::NotMapped && m_mode == QAbstractVideoBuffer::NotMapped) {
- CVPixelBufferLockBaseAddress(m_buffer, mode == QAbstractVideoBuffer::ReadOnly
+ if (mode != QVideoFrame::NotMapped && m_mode == QVideoFrame::NotMapped) {
+ CVPixelBufferLockBaseAddress(m_buffer, mode == QVideoFrame::ReadOnly
? kCVPixelBufferLock_ReadOnly
: 0);
@@ -125,10 +125,10 @@ public:
return mapData;
}
- uchar *map(MapMode mode, qsizetype *numBytes, int *bytesPerLine)
+ uchar *map(QVideoFrame::MapMode mode, qsizetype *numBytes, int *bytesPerLine)
{
- if (mode != NotMapped && m_mode == NotMapped) {
- CVPixelBufferLockBaseAddress(m_buffer, mode == QAbstractVideoBuffer::ReadOnly
+ if (mode != QVideoFrame::NotMapped && m_mode == QVideoFrame::NotMapped) {
+ CVPixelBufferLockBaseAddress(m_buffer, mode == QVideoFrame::ReadOnly
? kCVPixelBufferLock_ReadOnly
: 0);
if (numBytes)
@@ -146,11 +146,11 @@ public:
void unmap()
{
- if (m_mode != NotMapped) {
- CVPixelBufferUnlockBaseAddress(m_buffer, m_mode == QAbstractVideoBuffer::ReadOnly
+ if (m_mode != QVideoFrame::NotMapped) {
+ CVPixelBufferUnlockBaseAddress(m_buffer, m_mode == QVideoFrame::ReadOnly
? kCVPixelBufferLock_ReadOnly
: 0);
- m_mode = NotMapped;
+ m_mode = QVideoFrame::NotMapped;
}
}
@@ -204,7 +204,7 @@ private:
AVFCameraRendererControl *m_renderer;
#endif
CVImageBufferRef m_buffer;
- MapMode m_mode;
+ QVideoFrame::MapMode m_mode;
};
@@ -296,7 +296,7 @@ void AVFCameraRendererControl::setSurface(QAbstractVideoSurface *surface)
if (m_surface != surface) {
m_surface = surface;
m_supportsTextures = m_surface
- ? !m_surface->supportedPixelFormats(QAbstractVideoBuffer::GLTextureHandle).isEmpty()
+ ? !m_surface->supportedPixelFormats(QVideoFrame::GLTextureHandle).isEmpty()
: false;
Q_EMIT surfaceChanged(surface);
}
diff --git a/src/multimedia/platform/darwin/mediaplayer/avfvideorenderercontrol.mm b/src/multimedia/platform/darwin/mediaplayer/avfvideorenderercontrol.mm
index 456ffff71..42dd0ccff 100644
--- a/src/multimedia/platform/darwin/mediaplayer/avfvideorenderercontrol.mm
+++ b/src/multimedia/platform/darwin/mediaplayer/avfvideorenderercontrol.mm
@@ -61,7 +61,7 @@ QT_USE_NAMESPACE
class TextureVideoBuffer : public QAbstractVideoBuffer
{
public:
- TextureVideoBuffer(HandleType type, quint64 tex)
+ TextureVideoBuffer(QVideoFrame::HandleType type, quint64 tex)
: QAbstractVideoBuffer(type)
, m_texture(tex)
{}
@@ -70,8 +70,8 @@ public:
{
}
- MapMode mapMode() const override { return NotMapped; }
- MapData map(MapMode /*mode*/) override { return {}; }
+ QVideoFrame::MapMode mapMode() const override { return QVideoFrame::NotMapped; }
+ MapData map(QVideoFrame::MapMode /*mode*/) override { return {}; }
void unmap() override {}
QVariant handle() const override
@@ -147,8 +147,8 @@ void AVFVideoRendererControl::setSurface(QAbstractVideoSurface *surface)
#endif
auto checkHandleType = [this] {
- m_enableOpenGL = m_surface->supportedPixelFormats(QAbstractVideoBuffer::GLTextureHandle).contains(QVideoFrame::Format_BGR32);
- m_enableMetal = m_surface->supportedPixelFormats(QAbstractVideoBuffer::MTLTextureHandle).contains(QVideoFrame::Format_BGR32);
+ m_enableOpenGL = m_surface->supportedPixelFormats(QVideoFrame::GLTextureHandle).contains(QVideoFrame::Format_BGR32);
+ m_enableMetal = m_surface->supportedPixelFormats(QVideoFrame::MTLTextureHandle).contains(QVideoFrame::Format_BGR32);
};
checkHandleType();
connect(m_surface, &QAbstractVideoSurface::supportedFormatsChanged, this, checkHandleType);
@@ -211,13 +211,13 @@ void AVFVideoRendererControl::updateVideoFrame(const CVTimeStamp &ts)
if (tex == 0)
return;
- auto buffer = new TextureVideoBuffer(QAbstractVideoBuffer::MTLTextureHandle, tex);
+ auto buffer = new TextureVideoBuffer(QVideoFrame::MTLTextureHandle, tex);
QVideoFrame frame(buffer, m_nativeSize, QVideoFrame::Format_BGR32);
if (m_surface->isActive() && m_surface->surfaceFormat().pixelFormat() != frame.pixelFormat())
m_surface->stop();
if (!m_surface->isActive()) {
- QVideoSurfaceFormat format(frame.size(), frame.pixelFormat(), QAbstractVideoBuffer::MTLTextureHandle);
+ QVideoSurfaceFormat format(frame.size(), frame.pixelFormat(), QVideoFrame::MTLTextureHandle);
#if defined(Q_OS_IOS) || defined(Q_OS_TVOS)
format.setScanLineDirection(QVideoSurfaceFormat::TopToBottom);
#else
@@ -239,7 +239,7 @@ void AVFVideoRendererControl::updateVideoFrame(const CVTimeStamp &ts)
if (tex == 0)
return;
- QAbstractVideoBuffer *buffer = new TextureVideoBuffer(QAbstractVideoBuffer::GLTextureHandle, tex);
+ QAbstractVideoBuffer *buffer = new TextureVideoBuffer(QVideoFrame::GLTextureHandle, tex);
QVideoFrame frame = QVideoFrame(buffer, m_nativeSize, QVideoFrame::Format_BGR32);
if (m_surface && frame.isValid()) {
@@ -247,7 +247,7 @@ void AVFVideoRendererControl::updateVideoFrame(const CVTimeStamp &ts)
m_surface->stop();
if (!m_surface->isActive()) {
- QVideoSurfaceFormat format(frame.size(), frame.pixelFormat(), QAbstractVideoBuffer::GLTextureHandle);
+ QVideoSurfaceFormat format(frame.size(), frame.pixelFormat(), QVideoFrame::GLTextureHandle);
#if defined(Q_OS_IOS) || defined(Q_OS_TVOS)
format.setScanLineDirection(QVideoSurfaceFormat::TopToBottom);
#else
@@ -277,7 +277,7 @@ void AVFVideoRendererControl::updateVideoFrame(const CVTimeStamp &ts)
m_surface->stop();
if (!m_surface->isActive()) {
- QVideoSurfaceFormat format(frame.size(), frame.pixelFormat(), QAbstractVideoBuffer::NoHandle);
+ QVideoSurfaceFormat format(frame.size(), frame.pixelFormat(), QVideoFrame::NoHandle);
if (!m_surface->start(format)) {
qWarning("Failed to activate video surface");
diff --git a/src/multimedia/platform/gstreamer/common/qgstutils.cpp b/src/multimedia/platform/gstreamer/common/qgstutils.cpp
index ba61be3d2..1fed48717 100644
--- a/src/multimedia/platform/gstreamer/common/qgstutils.cpp
+++ b/src/multimedia/platform/gstreamer/common/qgstutils.cpp
@@ -345,7 +345,7 @@ static int indexOfVideoFormat(GstVideoFormat format)
}
QVideoSurfaceFormat QGstUtils::formatForCaps(
- GstCaps *caps, GstVideoInfo *info, QAbstractVideoBuffer::HandleType handleType)
+ GstCaps *caps, GstVideoInfo *info, QVideoFrame::HandleType handleType)
{
GstVideoInfo vidInfo;
GstVideoInfo *infoPtr = info ? info : &vidInfo;
diff --git a/src/multimedia/platform/gstreamer/common/qgstutils_p.h b/src/multimedia/platform/gstreamer/common/qgstutils_p.h
index 6d7f83f5e..e2b4ff90e 100644
--- a/src/multimedia/platform/gstreamer/common/qgstutils_p.h
+++ b/src/multimedia/platform/gstreamer/common/qgstutils_p.h
@@ -83,7 +83,7 @@ namespace QGstUtils {
Q_MULTIMEDIA_EXPORT QVideoSurfaceFormat formatForCaps(
GstCaps *caps,
GstVideoInfo *info = 0,
- QAbstractVideoBuffer::HandleType handleType = QAbstractVideoBuffer::NoHandle);
+ QVideoFrame::HandleType handleType = QVideoFrame::NoHandle);
Q_MULTIMEDIA_EXPORT GstCaps *capsForFormats(const QList<QVideoFrame::PixelFormat> &formats);
void setFrameTimeStamps(QVideoFrame *frame, GstBuffer *buffer);
diff --git a/src/multimedia/platform/gstreamer/common/qgstvideobuffer.cpp b/src/multimedia/platform/gstreamer/common/qgstvideobuffer.cpp
index 58738ffa0..711472f29 100644
--- a/src/multimedia/platform/gstreamer/common/qgstvideobuffer.cpp
+++ b/src/multimedia/platform/gstreamer/common/qgstvideobuffer.cpp
@@ -42,7 +42,7 @@
QT_BEGIN_NAMESPACE
QGstVideoBuffer::QGstVideoBuffer(GstBuffer *buffer, const GstVideoInfo &info)
- : QAbstractVideoBuffer(NoHandle)
+ : QAbstractVideoBuffer(QVideoFrame::NoHandle)
, m_videoInfo(info)
, m_buffer(buffer)
{
@@ -50,7 +50,7 @@ QGstVideoBuffer::QGstVideoBuffer(GstBuffer *buffer, const GstVideoInfo &info)
}
QGstVideoBuffer::QGstVideoBuffer(GstBuffer *buffer, const GstVideoInfo &info,
- QGstVideoBuffer::HandleType handleType,
+ QVideoFrame::HandleType handleType,
const QVariant &handle)
: QAbstractVideoBuffer(handleType)
, m_videoInfo(info)
@@ -68,18 +68,18 @@ QGstVideoBuffer::~QGstVideoBuffer()
}
-QAbstractVideoBuffer::MapMode QGstVideoBuffer::mapMode() const
+QVideoFrame::MapMode QGstVideoBuffer::mapMode() const
{
return m_mode;
}
-QAbstractVideoBuffer::MapData QGstVideoBuffer::map(MapMode mode)
+QAbstractVideoBuffer::MapData QGstVideoBuffer::map(QVideoFrame::MapMode mode)
{
- const GstMapFlags flags = GstMapFlags(((mode & ReadOnly) ? GST_MAP_READ : 0)
- | ((mode & WriteOnly) ? GST_MAP_WRITE : 0));
+ const GstMapFlags flags = GstMapFlags(((mode & QVideoFrame::ReadOnly) ? GST_MAP_READ : 0)
+ | ((mode & QVideoFrame::WriteOnly) ? GST_MAP_WRITE : 0));
MapData mapData;
- if (mode == NotMapped || m_mode != NotMapped)
+ if (mode == QVideoFrame::NotMapped || m_mode != QVideoFrame::NotMapped)
return mapData;
if (m_videoInfo.finfo->n_planes == 0) { // Encoded
@@ -107,13 +107,13 @@ QAbstractVideoBuffer::MapData QGstVideoBuffer::map(MapMode mode)
void QGstVideoBuffer::unmap()
{
- if (m_mode != NotMapped) {
+ if (m_mode != QVideoFrame::NotMapped) {
if (m_videoInfo.finfo->n_planes == 0)
gst_buffer_unmap(m_buffer, &m_frame.map[0]);
else
gst_video_frame_unmap(&m_frame);
}
- m_mode = NotMapped;
+ m_mode = QVideoFrame::NotMapped;
}
QT_END_NAMESPACE
diff --git a/src/multimedia/platform/gstreamer/common/qgstvideobuffer_p.h b/src/multimedia/platform/gstreamer/common/qgstvideobuffer_p.h
index 11a217f51..0efa0ae48 100644
--- a/src/multimedia/platform/gstreamer/common/qgstvideobuffer_p.h
+++ b/src/multimedia/platform/gstreamer/common/qgstvideobuffer_p.h
@@ -65,14 +65,14 @@ class Q_MULTIMEDIA_EXPORT QGstVideoBuffer : public QAbstractVideoBuffer
public:
QGstVideoBuffer(GstBuffer *buffer, const GstVideoInfo &info);
QGstVideoBuffer(GstBuffer *buffer, const GstVideoInfo &info,
- HandleType handleType, const QVariant &handle);
+ QVideoFrame::HandleType handleType, const QVariant &handle);
~QGstVideoBuffer();
GstBuffer *buffer() const { return m_buffer; }
- MapMode mapMode() const override;
+ QVideoFrame::MapMode mapMode() const override;
- MapData map(MapMode mode) override;
+ MapData map(QVideoFrame::MapMode mode) override;
void unmap() override;
QVariant handle() const override { return m_handle; }
@@ -80,7 +80,7 @@ private:
GstVideoInfo m_videoInfo;
GstVideoFrame m_frame;
GstBuffer *m_buffer = nullptr;
- MapMode m_mode = NotMapped;
+ QVideoFrame::MapMode m_mode = QVideoFrame::NotMapped;
QVariant m_handle;
};
diff --git a/src/multimedia/platform/gstreamer/common/qgstvideorendererplugin_p.h b/src/multimedia/platform/gstreamer/common/qgstvideorendererplugin_p.h
index d6f13062e..97420842f 100644
--- a/src/multimedia/platform/gstreamer/common/qgstvideorendererplugin_p.h
+++ b/src/multimedia/platform/gstreamer/common/qgstvideorendererplugin_p.h
@@ -52,7 +52,6 @@
//
#include <private/qtmultimediaglobal_p.h>
-#include <qabstractvideobuffer.h>
#include <qvideosurfaceformat.h>
#include <QtCore/qobject.h>
#include <QtCore/qplugin.h>
@@ -63,10 +62,6 @@ QT_BEGIN_NAMESPACE
class QAbstractVideoSurface;
-#ifndef Q_MULTIMEDIA_EXPORT
-#error XXX
-#endif
-
class Q_MULTIMEDIA_EXPORT QGstVideoRenderer
{
public:
diff --git a/src/multimedia/platform/gstreamer/common/qgstvideorenderersink.cpp b/src/multimedia/platform/gstreamer/common/qgstvideorenderersink.cpp
index 9afd79a80..9751652c9 100644
--- a/src/multimedia/platform/gstreamer/common/qgstvideorenderersink.cpp
+++ b/src/multimedia/platform/gstreamer/common/qgstvideorenderersink.cpp
@@ -85,14 +85,14 @@ GstCaps *QGstDefaultVideoRenderer::getCaps(QAbstractVideoSurface *surface)
{
#if QT_CONFIG(gstreamer_gl)
if (QGstUtils::useOpenGL()) {
- m_handleType = QAbstractVideoBuffer::GLTextureHandle;
+ m_handleType = QVideoFrame::GLTextureHandle;
auto formats = surface->supportedPixelFormats(m_handleType);
// Even if the surface does not support gl textures,
// glupload will be added to the pipeline and GLMemory will be requested.
// This will lead to upload data to gl textures
// and download it when the buffer will be used within rendering.
if (formats.isEmpty()) {
- m_handleType = QAbstractVideoBuffer::NoHandle;
+ m_handleType = QVideoFrame::NoHandle;
formats = surface->supportedPixelFormats(m_handleType);
}
@@ -103,7 +103,7 @@ GstCaps *QGstDefaultVideoRenderer::getCaps(QAbstractVideoSurface *surface)
return caps;
}
#endif
- return QGstUtils::capsForFormats(surface->supportedPixelFormats(QAbstractVideoBuffer::NoHandle));
+ return QGstUtils::capsForFormats(surface->supportedPixelFormats(QVideoFrame::NoHandle));
}
bool QGstDefaultVideoRenderer::start(QAbstractVideoSurface *surface, GstCaps *caps)
@@ -127,7 +127,7 @@ bool QGstDefaultVideoRenderer::present(QAbstractVideoSurface *surface, GstBuffer
QGstVideoBuffer *videoBuffer = nullptr;
#if QT_CONFIG(gstreamer_gl)
- if (m_format.handleType() == QAbstractVideoBuffer::GLTextureHandle) {
+ if (m_format.handleType() == QVideoFrame::GLTextureHandle) {
GstGLMemory *glmem = GST_GL_MEMORY_CAST(gst_buffer_peek_memory(buffer, 0));
guint textureId = gst_gl_memory_get_texture_id(glmem);
videoBuffer = new QGstVideoBuffer(buffer, m_videoInfo, m_format.handleType(), textureId);
@@ -652,7 +652,7 @@ struct NullSurface : QAbstractVideoSurface
{
NullSurface(QObject *parent = nullptr) : QAbstractVideoSurface(parent) { }
- QList<QVideoFrame::PixelFormat> supportedPixelFormats(QAbstractVideoBuffer::HandleType) const override
+ QList<QVideoFrame::PixelFormat> supportedPixelFormats(QVideoFrame::HandleType) const override
{
return QList<QVideoFrame::PixelFormat>() << QVideoFrame::Format_RGB32;
}
diff --git a/src/multimedia/platform/gstreamer/common/qgstvideorenderersink_p.h b/src/multimedia/platform/gstreamer/common/qgstvideorenderersink_p.h
index 0b05bbe83..f330e871f 100644
--- a/src/multimedia/platform/gstreamer/common/qgstvideorenderersink_p.h
+++ b/src/multimedia/platform/gstreamer/common/qgstvideorenderersink_p.h
@@ -97,7 +97,7 @@ private:
QVideoSurfaceFormat m_format;
GstVideoInfo m_videoInfo;
bool m_flushed = true;
- QAbstractVideoBuffer::HandleType m_handleType = QAbstractVideoBuffer::NoHandle;
+ QVideoFrame::HandleType m_handleType = QVideoFrame::NoHandle;
};
class QVideoSurfaceGstDelegate : public QObject
diff --git a/src/multimedia/platform/qnx/mediaplayer/mmrendererplayervideorenderercontrol.cpp b/src/multimedia/platform/qnx/mediaplayer/mmrendererplayervideorenderercontrol.cpp
index d682c40a3..b44fbe64e 100644
--- a/src/multimedia/platform/qnx/mediaplayer/mmrendererplayervideorenderercontrol.cpp
+++ b/src/multimedia/platform/qnx/mediaplayer/mmrendererplayervideorenderercontrol.cpp
@@ -146,13 +146,13 @@ class QnxTextureBuffer : public QAbstractVideoBuffer
{
public:
QnxTextureBuffer(WindowGrabber *windowGrabber) :
- QAbstractVideoBuffer(QAbstractVideoBuffer::GLTextureHandle)
+ QAbstractVideoBuffer(QVideoFrame::GLTextureHandle)
{
m_windowGrabber = windowGrabber;
m_handle = 0;
}
MapMode mapMode() const {
- return QAbstractVideoBuffer::ReadWrite;
+ return QVideoFrame::ReadWrite;
}
void unmap() {}
MapData map(MapMode mode) override { return {}; }
@@ -173,7 +173,7 @@ void MmRendererPlayerVideoRendererControl::updateScene(const QSize &size)
if (!m_surface->isActive()) {
if (m_windowGrabber->eglImageSupported()) {
m_surface->start(QVideoSurfaceFormat(size, QVideoFrame::Format_BGR32,
- QAbstractVideoBuffer::GLTextureHandle));
+ QVideoFrame::GLTextureHandle));
} else {
m_surface->start(QVideoSurfaceFormat(size, QVideoFrame::Format_ARGB32));
}
@@ -182,7 +182,7 @@ void MmRendererPlayerVideoRendererControl::updateScene(const QSize &size)
m_surface->stop();
if (m_windowGrabber->eglImageSupported()) {
m_surface->start(QVideoSurfaceFormat(size, QVideoFrame::Format_BGR32,
- QAbstractVideoBuffer::GLTextureHandle));
+ QVideoFrame::GLTextureHandle));
} else {
m_surface->start(QVideoSurfaceFormat(size, QVideoFrame::Format_ARGB32));
}
diff --git a/src/multimedia/platform/windows/evr/evrcustompresenter.cpp b/src/multimedia/platform/windows/evr/evrcustompresenter.cpp
index dd6c0021b..ed398675e 100644
--- a/src/multimedia/platform/windows/evr/evrcustompresenter.cpp
+++ b/src/multimedia/platform/windows/evr/evrcustompresenter.cpp
@@ -1026,12 +1026,12 @@ void EVRCustomPresenter::supportedFormatsChanged()
// check if we can render to the surface (compatible formats)
if (m_surface) {
- QList<QVideoFrame::PixelFormat> formats = m_surface->supportedPixelFormats(QAbstractVideoBuffer::GLTextureHandle);
+ QList<QVideoFrame::PixelFormat> formats = m_surface->supportedPixelFormats(QVideoFrame::GLTextureHandle);
if (m_presentEngine->supportsTextureRendering() && formats.contains(QVideoFrame::Format_RGB32)) {
m_presentEngine->setHint(D3DPresentEngine::RenderToTexture, true);
m_canRenderToSurface = true;
} else {
- formats = m_surface->supportedPixelFormats(QAbstractVideoBuffer::NoHandle);
+ formats = m_surface->supportedPixelFormats(QVideoFrame::NoHandle);
for (QVideoFrame::PixelFormat format : qAsConst(formats)) {
if (SUCCEEDED(m_presentEngine->checkFormat(qt_evr_D3DFormatFromPixelFormat(format)))) {
m_canRenderToSurface = true;
diff --git a/src/multimedia/platform/windows/evr/evrd3dpresentengine.cpp b/src/multimedia/platform/windows/evr/evrd3dpresentengine.cpp
index 8cb6d2593..9d32ce4f0 100644
--- a/src/multimedia/platform/windows/evr/evrd3dpresentengine.cpp
+++ b/src/multimedia/platform/windows/evr/evrd3dpresentengine.cpp
@@ -55,12 +55,12 @@ QT_BEGIN_NAMESPACE
class IMFSampleVideoBuffer: public QAbstractVideoBuffer
{
public:
- IMFSampleVideoBuffer(D3DPresentEngine *engine, IMFSample *sample, QAbstractVideoBuffer::HandleType handleType)
+ IMFSampleVideoBuffer(D3DPresentEngine *engine, IMFSample *sample, QVideoFrame::HandleType handleType)
: QAbstractVideoBuffer(handleType)
, m_engine(engine)
, m_sample(sample)
, m_surface(0)
- , m_mapMode(NotMapped)
+ , m_mapMode(QVideoFrame::NotMapped)
{
if (m_sample) {
m_sample->AddRef();
@@ -79,7 +79,7 @@ public:
~IMFSampleVideoBuffer() override
{
if (m_surface) {
- if (m_mapMode != NotMapped)
+ if (m_mapMode != QVideoFrame::NotMapped)
m_surface->UnlockRect();
m_surface->Release();
}
@@ -89,21 +89,21 @@ public:
QVariant handle() const override;
- MapMode mapMode() const override { return m_mapMode; }
- MapData map(MapMode mode) override;
+ QVideoFrame::MapMode mapMode() const override { return m_mapMode; }
+ MapData map(QVideoFrame::MapMode mode) override;
void unmap() override;
private:
mutable D3DPresentEngine *m_engine;
IMFSample *m_sample;
IDirect3DSurface9 *m_surface;
- MapMode m_mapMode;
+ QVideoFrame::MapMode m_mapMode;
mutable unsigned int m_textureId = 0;
};
-IMFSampleVideoBuffer::MapData IMFSampleVideoBuffer::map(MapMode mode)
+IMFSampleVideoBuffer::MapData IMFSampleVideoBuffer::map(QVideoFrame::MapMode mode)
{
- if (!m_surface || m_mapMode != NotMapped)
+ if (!m_surface || m_mapMode != QVideoFrame::NotMapped)
return {};
D3DSURFACE_DESC desc;
@@ -111,7 +111,7 @@ IMFSampleVideoBuffer::MapData IMFSampleVideoBuffer::map(MapMode mode)
return {};
D3DLOCKED_RECT rect;
- if (FAILED(m_surface->LockRect(&rect, NULL, mode == ReadOnly ? D3DLOCK_READONLY : 0)))
+ if (FAILED(m_surface->LockRect(&rect, NULL, mode == QVideoFrame::ReadOnly ? D3DLOCK_READONLY : 0)))
return {};
m_mapMode = mode;
@@ -126,10 +126,10 @@ IMFSampleVideoBuffer::MapData IMFSampleVideoBuffer::map(MapMode mode)
void IMFSampleVideoBuffer::unmap()
{
- if (m_mapMode == NotMapped)
+ if (m_mapMode == QVideoFrame::NotMapped)
return;
- m_mapMode = NotMapped;
+ m_mapMode = QVideoFrame::NotMapped;
m_surface->UnlockRect();
}
@@ -371,8 +371,8 @@ done:
m_surfaceFormat = QVideoSurfaceFormat(QSize(width, height),
m_useTextureRendering ? QVideoFrame::Format_RGB32
: qt_evr_pixelFormatFromD3DFormat(d3dFormat),
- m_useTextureRendering ? QAbstractVideoBuffer::GLTextureHandle
- : QAbstractVideoBuffer::NoHandle);
+ m_useTextureRendering ? QVideoFrame::GLTextureHandle
+ : QVideoFrame::NoHandle);
UINT32 horizontal = 1, vertical = 1;
hr = MFGetAttributeRatio(format, MF_MT_PIXEL_ASPECT_RATIO, &horizontal, &vertical);
if (SUCCEEDED(hr))
diff --git a/src/multimedia/platform/windows/player/mfvideorenderercontrol.cpp b/src/multimedia/platform/windows/player/mfvideorenderercontrol.cpp
index 7c973f214..1957bf072 100644
--- a/src/multimedia/platform/windows/player/mfvideorenderercontrol.cpp
+++ b/src/multimedia/platform/windows/player/mfvideorenderercontrol.cpp
@@ -44,6 +44,7 @@
#include <qabstractvideosurface.h>
#include <qvideosurfaceformat.h>
+#include <qabstractvideobuffer.h>
#include <qtcore/qtimer.h>
#include <qtcore/qmutex.h>
#include <qtcore/qcoreevent.h>
@@ -61,10 +62,10 @@ namespace
{
public:
MediaSampleVideoBuffer(IMFMediaBuffer *buffer, int bytesPerLine)
- : QAbstractVideoBuffer(NoHandle)
+ : QAbstractVideoBuffer(QVideoFrame::NoHandle)
, m_buffer(buffer)
, m_bytesPerLine(bytesPerLine)
- , m_mapMode(NotMapped)
+ , m_mapMode(QVideoFrame::NotMapped)
{
buffer->AddRef();
}
@@ -74,10 +75,10 @@ namespace
m_buffer->Release();
}
- MapData map(MapMode mode) override
+ MapData map(QVideoFrame::MapMode mode) override
{
MapData mapData;
- if (m_mapMode == NotMapped && mode != NotMapped) {
+ if (m_mapMode == QVideoFrame::NotMapped && mode != QVideoFrame::NotMapped) {
BYTE *bytes;
DWORD length;
HRESULT hr = m_buffer->Lock(&bytes, NULL, &length);
@@ -96,13 +97,13 @@ namespace
void unmap() override
{
- if (m_mapMode == NotMapped)
+ if (m_mapMode == QVideoFrame::NotMapped)
return;
- m_mapMode = NotMapped;
+ m_mapMode = QVideoFrame::NotMapped;
m_buffer->Unlock();
}
- MapMode mapMode() const override
+ QVideoFrame::MapMode mapMode() const override
{
return m_mapMode;
}
@@ -110,7 +111,7 @@ namespace
private:
IMFMediaBuffer *m_buffer;
int m_bytesPerLine;
- MapMode m_mapMode;
+ QVideoFrame::MapMode m_mapMode;
};
// Custom interface for handling IMFStreamSink::PlaceMarker calls asynchronously.
diff --git a/src/multimedia/video/qabstractvideobuffer.cpp b/src/multimedia/video/qabstractvideobuffer.cpp
index a79bae86a..6fe351e8d 100644
--- a/src/multimedia/video/qabstractvideobuffer.cpp
+++ b/src/multimedia/video/qabstractvideobuffer.cpp
@@ -73,7 +73,7 @@ QT_BEGIN_NAMESPACE
*/
/*!
- \enum QAbstractVideoBuffer::HandleType
+ \enum QVideoFrame::HandleType
Identifies the type of a video buffers handle.
@@ -90,7 +90,7 @@ QT_BEGIN_NAMESPACE
*/
/*!
- \enum QAbstractVideoBuffer::MapMode
+ \enum QVideoFrame::MapMode
Enumerates how a video buffer's data is mapped to system memory.
@@ -108,7 +108,7 @@ QT_BEGIN_NAMESPACE
/*!
Constructs an abstract video buffer of the given \a type.
*/
-QAbstractVideoBuffer::QAbstractVideoBuffer(HandleType type)
+QAbstractVideoBuffer::QAbstractVideoBuffer(QVideoFrame::HandleType type)
: m_type(type)
{
}
@@ -116,7 +116,7 @@ QAbstractVideoBuffer::QAbstractVideoBuffer(HandleType type)
/*!
\internal
*/
-QAbstractVideoBuffer::QAbstractVideoBuffer(QAbstractVideoBufferPrivate &dd, HandleType type)
+QAbstractVideoBuffer::QAbstractVideoBuffer(QAbstractVideoBufferPrivate &dd, QVideoFrame::HandleType type)
: d_ptr(&dd)
, m_type(type)
{
@@ -149,13 +149,13 @@ void QAbstractVideoBuffer::release()
\sa handle()
*/
-QAbstractVideoBuffer::HandleType QAbstractVideoBuffer::handleType() const
+QVideoFrame::HandleType QAbstractVideoBuffer::handleType() const
{
return m_type;
}
/*!
- \fn QAbstractVideoBuffer::mapMode() const
+ \fn QVideoFrame::mapMode() const
Returns the mode a video buffer is mapped in.
@@ -167,9 +167,9 @@ QAbstractVideoBuffer::HandleType QAbstractVideoBuffer::handleType() const
Independently maps the planes of a video buffer to memory.
The map \a mode indicates whether the contents of the mapped memory should be read from and/or
- written to the buffer. If the map mode includes the \c QAbstractVideoBuffer::ReadOnly flag the
+ written to the buffer. If the map mode includes the \c QVideoFrame::ReadOnly flag the
mapped memory will be populated with the content of the buffer when initially mapped. If the map
- mode includes the \c QAbstractVideoBuffer::WriteOnly flag the content of the possibly modified
+ mode includes the \c QVideoFrame::WriteOnly flag the content of the possibly modified
mapped memory will be written back to the buffer when unmapped.
When access to the data is no longer needed be sure to call the unmap() function to release the
@@ -195,7 +195,7 @@ QAbstractVideoBuffer::HandleType QAbstractVideoBuffer::handleType() const
Releases the memory mapped by the map() function.
- If the \l {QAbstractVideoBuffer::MapMode}{MapMode} included the \c QAbstractVideoBuffer::WriteOnly
+ If the \l {QVideoFrame::MapMode}{MapMode} included the \c QVideoFrame::WriteOnly
flag this will write the current content of the mapped memory back to the video frame.
\sa map()
@@ -219,9 +219,9 @@ QVariant QAbstractVideoBuffer::handle() const
Maps the contents of a video buffer to memory.
The map \a mode indicates whether the contents of the mapped memory should be read from and/or
- written to the buffer. If the map mode includes the \c QAbstractVideoBuffer::ReadOnly flag the
+ written to the buffer. If the map mode includes the \c QVideoFrame::ReadOnly flag the
mapped memory will be populated with the content of the buffer when initially mapped. If the map
- mode includes the \c QAbstractVideoBuffer::WriteOnly flag the content of the possibly modified
+ mode includes the \c QVideoFrame::WriteOnly flag the content of the possibly modified
mapped memory will be written back to the buffer when unmapped.
When access to the data is no longer needed be sure to call the unmap() function to release the
@@ -231,42 +231,20 @@ QVariant QAbstractVideoBuffer::handle() const
plane will be returned in \a bytesPerLine, and a pointer to the plane data will be returned in
\a data. The accumulative size of the mapped data is returned in \a numBytes.
- \sa QAbstractVideoBuffer::map(), QAbstractVideoBuffer::unmap(), QAbstractVideoBuffer::mapMode()
+ \sa QAbstractVideoBuffer::map(), QAbstractVideoBuffer::unmap(), QVideoFrame::mapMode()
*/
#ifndef QT_NO_DEBUG_STREAM
-QDebug operator<<(QDebug dbg, QAbstractVideoBuffer::HandleType type)
-{
- QDebugStateSaver saver(dbg);
- dbg.nospace();
- switch (type) {
- case QAbstractVideoBuffer::NoHandle:
- return dbg << "NoHandle";
- case QAbstractVideoBuffer::GLTextureHandle:
- return dbg << "GLTextureHandle";
- case QAbstractVideoBuffer::MTLTextureHandle:
- return dbg << "MTLTextureHandle";
- case QAbstractVideoBuffer::XvShmImageHandle:
- return dbg << "XvShmImageHandle";
- case QAbstractVideoBuffer::CoreImageHandle:
- return dbg << "CoreImageHandle";
- case QAbstractVideoBuffer::QPixmapHandle:
- return dbg << "QPixmapHandle";
- default:
- return dbg << "UserHandle(" << int(type) << ')';
- }
-}
-
-QDebug operator<<(QDebug dbg, QAbstractVideoBuffer::MapMode mode)
+QDebug operator<<(QDebug dbg, QVideoFrame::MapMode mode)
{
QDebugStateSaver saver(dbg);
dbg.nospace();
switch (mode) {
- case QAbstractVideoBuffer::ReadOnly:
+ case QVideoFrame::ReadOnly:
return dbg << "ReadOnly";
- case QAbstractVideoBuffer::ReadWrite:
+ case QVideoFrame::ReadWrite:
return dbg << "ReadWrite";
- case QAbstractVideoBuffer::WriteOnly:
+ case QVideoFrame::WriteOnly:
return dbg << "WriteOnly";
default:
return dbg << "NotMapped";
diff --git a/src/multimedia/video/qabstractvideobuffer.h b/src/multimedia/video/qabstractvideobuffer.h
index d25a06bbf..d8ce72431 100644
--- a/src/multimedia/video/qabstractvideobuffer.h
+++ b/src/multimedia/video/qabstractvideobuffer.h
@@ -42,7 +42,7 @@
#include <QtMultimedia/qtmultimediaglobal.h>
#include <QtMultimedia/qmultimedia.h>
-
+#include <QtMultimedia/qvideoframe.h>
#include <QtCore/qmetatype.h>
@@ -56,31 +56,11 @@ class QAbstractVideoBufferPrivate;
class Q_MULTIMEDIA_EXPORT QAbstractVideoBuffer
{
public:
- enum HandleType
- {
- NoHandle,
- GLTextureHandle,
- MTLTextureHandle,
- XvShmImageHandle,
- CoreImageHandle,
- QPixmapHandle,
- EGLImageHandle,
- UserHandle = 1000
- };
-
- enum MapMode
- {
- NotMapped = 0x00,
- ReadOnly = 0x01,
- WriteOnly = 0x02,
- ReadWrite = ReadOnly | WriteOnly
- };
-
- QAbstractVideoBuffer(HandleType type);
+ QAbstractVideoBuffer(QVideoFrame::HandleType type);
virtual ~QAbstractVideoBuffer();
virtual void release();
- HandleType handleType() const;
+ QVideoFrame::HandleType handleType() const;
struct MapData
{
@@ -90,25 +70,24 @@ public:
uchar *data[4] = {};
};
- virtual MapMode mapMode() const = 0;
- virtual MapData map(MapMode mode) = 0;
+ virtual QVideoFrame::MapMode mapMode() const = 0;
+ virtual MapData map(QVideoFrame::MapMode mode) = 0;
virtual void unmap() = 0;
virtual QVariant handle() const;
protected:
- QAbstractVideoBuffer(QAbstractVideoBufferPrivate &dd, HandleType type);
+ QAbstractVideoBuffer(QAbstractVideoBufferPrivate &dd, QVideoFrame::HandleType type);
QAbstractVideoBufferPrivate *d_ptr = nullptr; // currently unused
- HandleType m_type;
+ QVideoFrame::HandleType m_type;
private:
Q_DISABLE_COPY(QAbstractVideoBuffer)
};
#ifndef QT_NO_DEBUG_STREAM
-Q_MULTIMEDIA_EXPORT QDebug operator<<(QDebug, QAbstractVideoBuffer::HandleType);
-Q_MULTIMEDIA_EXPORT QDebug operator<<(QDebug, QAbstractVideoBuffer::MapMode);
+Q_MULTIMEDIA_EXPORT QDebug operator<<(QDebug, QVideoFrame::MapMode);
#endif
QT_END_NAMESPACE
diff --git a/src/multimedia/video/qabstractvideosurface.cpp b/src/multimedia/video/qabstractvideosurface.cpp
index aa8dcbd0d..46d5933f4 100644
--- a/src/multimedia/video/qabstractvideosurface.cpp
+++ b/src/multimedia/video/qabstractvideosurface.cpp
@@ -130,11 +130,11 @@ QAbstractVideoSurface::QAbstractVideoSurface(QObject *parent)
QAbstractVideoSurface::~QAbstractVideoSurface() = default;
/*!
- \fn QAbstractVideoSurface::supportedPixelFormats(QAbstractVideoBuffer::HandleType type) const
+ \fn QAbstractVideoSurface::supportedPixelFormats(QVideoFrame::HandleType type) const
Returns a list of pixel formats a video surface can present for a given handle \a type.
- The pixel formats returned for the QAbstractVideoBuffer::NoHandle type are valid for any buffer
+ The pixel formats returned for the QVideoFrame::NoHandle type are valid for any buffer
that can be mapped in read-only mode.
Types that are first in the list can be assumed to be faster to render.
diff --git a/src/multimedia/video/qabstractvideosurface.h b/src/multimedia/video/qabstractvideosurface.h
index e0a42c89b..0acd18cd3 100644
--- a/src/multimedia/video/qabstractvideosurface.h
+++ b/src/multimedia/video/qabstractvideosurface.h
@@ -68,7 +68,7 @@ public:
~QAbstractVideoSurface();
virtual QList<QVideoFrame::PixelFormat> supportedPixelFormats(
- QAbstractVideoBuffer::HandleType type = QAbstractVideoBuffer::NoHandle) const = 0;
+ QVideoFrame::HandleType type = QVideoFrame::NoHandle) const = 0;
virtual bool isFormatSupported(const QVideoSurfaceFormat &format) const;
virtual QVideoSurfaceFormat nearestFormat(const QVideoSurfaceFormat &format) const;
diff --git a/src/multimedia/video/qimagevideobuffer.cpp b/src/multimedia/video/qimagevideobuffer.cpp
index 272c31ff6..d6c854f45 100644
--- a/src/multimedia/video/qimagevideobuffer.cpp
+++ b/src/multimedia/video/qimagevideobuffer.cpp
@@ -55,12 +55,12 @@ QT_BEGIN_NAMESPACE
class QImageVideoBufferPrivate : public QAbstractVideoBufferPrivate
{
public:
- QAbstractVideoBuffer::MapMode mapMode = QAbstractVideoBuffer::NotMapped;
+ QVideoFrame::MapMode mapMode = QVideoFrame::NotMapped;
QImage image;
};
QImageVideoBuffer::QImageVideoBuffer(const QImage &image)
- : QAbstractVideoBuffer(*new QImageVideoBufferPrivate, NoHandle)
+ : QAbstractVideoBuffer(*new QImageVideoBufferPrivate, QVideoFrame::NoHandle)
{
Q_D(QImageVideoBuffer);
@@ -69,17 +69,17 @@ QImageVideoBuffer::QImageVideoBuffer(const QImage &image)
QImageVideoBuffer::~QImageVideoBuffer() = default;
-QAbstractVideoBuffer::MapMode QImageVideoBuffer::mapMode() const
+QVideoFrame::MapMode QImageVideoBuffer::mapMode() const
{
return d_func()->mapMode;
}
-QImageVideoBuffer::MapData QImageVideoBuffer::map(MapMode mode)
+QImageVideoBuffer::MapData QImageVideoBuffer::map(QVideoFrame::MapMode mode)
{
Q_D(QImageVideoBuffer);
MapData mapData;
- if (d->mapMode == NotMapped && d->image.bits() && mode != NotMapped) {
+ if (d->mapMode == QVideoFrame::NotMapped && d->image.bits() && mode != QVideoFrame::NotMapped) {
d->mapMode = mode;
mapData.nBytes = int(d->image.sizeInBytes());
@@ -95,7 +95,7 @@ void QImageVideoBuffer::unmap()
{
Q_D(QImageVideoBuffer);
- d->mapMode = NotMapped;
+ d->mapMode = QVideoFrame::NotMapped;
}
QT_END_NAMESPACE
diff --git a/src/multimedia/video/qimagevideobuffer_p.h b/src/multimedia/video/qimagevideobuffer_p.h
index ba980a3fb..437d8356b 100644
--- a/src/multimedia/video/qimagevideobuffer_p.h
+++ b/src/multimedia/video/qimagevideobuffer_p.h
@@ -67,9 +67,9 @@ public:
QImageVideoBuffer(const QImage &image);
~QImageVideoBuffer();
- MapMode mapMode() const override;
+ QVideoFrame::MapMode mapMode() const override;
- MapData map(MapMode mode) override;
+ MapData map(QVideoFrame::MapMode mode) override;
void unmap() override;
};
diff --git a/src/multimedia/video/qmemoryvideobuffer.cpp b/src/multimedia/video/qmemoryvideobuffer.cpp
index 5b04ff51c..8ad0fd119 100644
--- a/src/multimedia/video/qmemoryvideobuffer.cpp
+++ b/src/multimedia/video/qmemoryvideobuffer.cpp
@@ -48,7 +48,7 @@ class QMemoryVideoBufferPrivate : public QAbstractVideoBufferPrivate
{
public:
int bytesPerLine = 0;
- QAbstractVideoBuffer::MapMode mapMode = QAbstractVideoBuffer::NotMapped;
+ QVideoFrame::MapMode mapMode = QVideoFrame::NotMapped;
QByteArray data;
};
@@ -65,7 +65,7 @@ public:
Constructs a video buffer with an image stride of \a bytesPerLine from a byte \a array.
*/
QMemoryVideoBuffer::QMemoryVideoBuffer(const QByteArray &array, int bytesPerLine)
- : QAbstractVideoBuffer(*new QMemoryVideoBufferPrivate, NoHandle)
+ : QAbstractVideoBuffer(*new QMemoryVideoBufferPrivate, QVideoFrame::NoHandle)
{
Q_D(QMemoryVideoBuffer);
@@ -81,7 +81,7 @@ QMemoryVideoBuffer::~QMemoryVideoBuffer() = default;
/*!
\reimp
*/
-QAbstractVideoBuffer::MapMode QMemoryVideoBuffer::mapMode() const
+QVideoFrame::MapMode QMemoryVideoBuffer::mapMode() const
{
return d_func()->mapMode;
}
@@ -89,12 +89,12 @@ QAbstractVideoBuffer::MapMode QMemoryVideoBuffer::mapMode() const
/*!
\reimp
*/
-QAbstractVideoBuffer::MapData QMemoryVideoBuffer::map(MapMode mode)
+QAbstractVideoBuffer::MapData QMemoryVideoBuffer::map(QVideoFrame::MapMode mode)
{
Q_D(QMemoryVideoBuffer);
MapData mapData;
- if (d->mapMode == NotMapped && d->data.size() && mode != NotMapped) {
+ if (d->mapMode == QVideoFrame::NotMapped && d->data.size() && mode != QVideoFrame::NotMapped) {
d->mapMode = mode;
mapData.nBytes = d->data.size();
@@ -111,7 +111,7 @@ QAbstractVideoBuffer::MapData QMemoryVideoBuffer::map(MapMode mode)
*/
void QMemoryVideoBuffer::unmap()
{
- d_func()->mapMode = NotMapped;
+ d_func()->mapMode = QVideoFrame::NotMapped;
}
QT_END_NAMESPACE
diff --git a/src/multimedia/video/qmemoryvideobuffer_p.h b/src/multimedia/video/qmemoryvideobuffer_p.h
index 5251b4979..5f5af9782 100644
--- a/src/multimedia/video/qmemoryvideobuffer_p.h
+++ b/src/multimedia/video/qmemoryvideobuffer_p.h
@@ -65,9 +65,9 @@ public:
QMemoryVideoBuffer(const QByteArray &data, int bytesPerLine);
~QMemoryVideoBuffer();
- MapMode mapMode() const override;
+ QVideoFrame::MapMode mapMode() const override;
- MapData map(MapMode mode) override;
+ MapData map(QVideoFrame::MapMode mode) override;
void unmap() override;
};
diff --git a/src/multimedia/video/qvideoframe.cpp b/src/multimedia/video/qvideoframe.cpp
index a92f74512..aab935534 100644
--- a/src/multimedia/video/qvideoframe.cpp
+++ b/src/multimedia/video/qvideoframe.cpp
@@ -395,9 +395,9 @@ QVideoFrame::PixelFormat QVideoFrame::pixelFormat() const
Returns the type of a video frame's handle.
*/
-QAbstractVideoBuffer::HandleType QVideoFrame::handleType() const
+QVideoFrame::HandleType QVideoFrame::handleType() const
{
- return d->buffer ? d->buffer->handleType() : QAbstractVideoBuffer::NoHandle;
+ return d->buffer ? d->buffer->handleType() : QVideoFrame::NoHandle;
}
/*!
@@ -427,25 +427,25 @@ int QVideoFrame::height() const
/*!
Identifies if a video frame's contents are currently mapped to system memory.
- This is a convenience function which checks that the \l {QAbstractVideoBuffer::MapMode}{MapMode}
- of the frame is not equal to QAbstractVideoBuffer::NotMapped.
+ This is a convenience function which checks that the \l {QVideoFrame::MapMode}{MapMode}
+ of the frame is not equal to QVideoFrame::NotMapped.
Returns true if the contents of the video frame are mapped to system memory, and false
otherwise.
- \sa mapMode(), QAbstractVideoBuffer::MapMode
+ \sa mapMode(), QVideoFrame::MapMode
*/
bool QVideoFrame::isMapped() const
{
- return d->buffer != nullptr && d->buffer->mapMode() != QAbstractVideoBuffer::NotMapped;
+ return d->buffer != nullptr && d->buffer->mapMode() != QVideoFrame::NotMapped;
}
/*!
Identifies if the mapped contents of a video frame will be persisted when the frame is unmapped.
- This is a convenience function which checks if the \l {QAbstractVideoBuffer::MapMode}{MapMode}
- contains the QAbstractVideoBuffer::WriteOnly flag.
+ This is a convenience function which checks if the \l {QVideoFrame::MapMode}{MapMode}
+ contains the QVideoFrame::WriteOnly flag.
Returns true if the video frame will be updated when unmapped, and false otherwise.
@@ -453,37 +453,37 @@ bool QVideoFrame::isMapped() const
Depending on the buffer implementation the changes may be persisted, or worse alter a shared
buffer.
- \sa mapMode(), QAbstractVideoBuffer::MapMode
+ \sa mapMode(), QVideoFrame::MapMode
*/
bool QVideoFrame::isWritable() const
{
- return d->buffer != nullptr && (d->buffer->mapMode() & QAbstractVideoBuffer::WriteOnly);
+ return d->buffer != nullptr && (d->buffer->mapMode() & QVideoFrame::WriteOnly);
}
/*!
Identifies if the mapped contents of a video frame were read from the frame when it was mapped.
- This is a convenience function which checks if the \l {QAbstractVideoBuffer::MapMode}{MapMode}
- contains the QAbstractVideoBuffer::WriteOnly flag.
+ This is a convenience function which checks if the \l {QVideoFrame::MapMode}{MapMode}
+ contains the QVideoFrame::WriteOnly flag.
Returns true if the contents of the mapped memory were read from the video frame, and false
otherwise.
- \sa mapMode(), QAbstractVideoBuffer::MapMode
+ \sa mapMode(), QVideoFrame::MapMode
*/
bool QVideoFrame::isReadable() const
{
- return d->buffer != nullptr && (d->buffer->mapMode() & QAbstractVideoBuffer::ReadOnly);
+ return d->buffer != nullptr && (d->buffer->mapMode() & QVideoFrame::ReadOnly);
}
/*!
Returns the mode a video frame was mapped to system memory in.
- \sa map(), QAbstractVideoBuffer::MapMode
+ \sa map(), QVideoFrame::MapMode
*/
-QAbstractVideoBuffer::MapMode QVideoFrame::mapMode() const
+QVideoFrame::MapMode QVideoFrame::mapMode() const
{
- return d->buffer != nullptr ? d->buffer->mapMode() : QAbstractVideoBuffer::NotMapped;
+ return d->buffer != nullptr ? d->buffer->mapMode() : QVideoFrame::NotMapped;
}
/*!
@@ -494,9 +494,9 @@ QAbstractVideoBuffer::MapMode QVideoFrame::mapMode() const
copying the contents around, so avoid mapping and unmapping unless required.
The map \a mode indicates whether the contents of the mapped memory should be read from and/or
- written to the frame. If the map mode includes the \c QAbstractVideoBuffer::ReadOnly flag the
+ written to the frame. If the map mode includes the \c QVideoFrame::ReadOnly flag the
mapped memory will be populated with the content of the video frame when initially mapped. If the map
- mode includes the \c QAbstractVideoBuffer::WriteOnly flag the content of the possibly modified
+ mode includes the \c QVideoFrame::WriteOnly flag the content of the possibly modified
mapped memory will be written back to the frame when unmapped.
While mapped the contents of a video frame can be accessed directly through the pointer returned
@@ -516,20 +516,20 @@ QAbstractVideoBuffer::MapMode QVideoFrame::mapMode() const
\sa unmap(), mapMode(), bits()
*/
-bool QVideoFrame::map(QAbstractVideoBuffer::MapMode mode)
+bool QVideoFrame::map(QVideoFrame::MapMode mode)
{
QMutexLocker lock(&d->mapMutex);
if (!d->buffer)
return false;
- if (mode == QAbstractVideoBuffer::NotMapped)
+ if (mode == QVideoFrame::NotMapped)
return false;
if (d->mappedCount > 0) {
//it's allowed to map the video frame multiple times in read only mode
- if (d->buffer->mapMode() == QAbstractVideoBuffer::ReadOnly
- && mode == QAbstractVideoBuffer::ReadOnly) {
+ if (d->buffer->mapMode() == QVideoFrame::ReadOnly
+ && mode == QVideoFrame::ReadOnly) {
d->mappedCount++;
return true;
}
@@ -630,7 +630,7 @@ bool QVideoFrame::map(QAbstractVideoBuffer::MapMode mode)
/*!
Releases the memory mapped by the map() function.
- If the \l {QAbstractVideoBuffer::MapMode}{MapMode} included the QAbstractVideoBuffer::WriteOnly
+ If the \l {QVideoFrame::MapMode}{MapMode} included the QVideoFrame::WriteOnly
flag this will persist the current content of the mapped memory to the video frame.
unmap() should not be called if map() function failed.
@@ -1053,7 +1053,7 @@ QImage QVideoFrame::image() const
QVideoFrame frame = *this;
QImage result;
- if (!frame.isValid() || !frame.map(QAbstractVideoBuffer::ReadOnly))
+ if (!frame.isValid() || !frame.map(QVideoFrame::ReadOnly))
return result;
// Formats supported by QImage don't need conversion
@@ -1239,6 +1239,28 @@ static QString qFormatTimeStamps(qint64 start, qint64 end)
.arg(e_millis, 2, 10, QLatin1Char('0'));
}
+QDebug operator<<(QDebug dbg, QVideoFrame::HandleType type)
+{
+ QDebugStateSaver saver(dbg);
+ dbg.nospace();
+ switch (type) {
+ case QVideoFrame::NoHandle:
+ return dbg << "NoHandle";
+ case QVideoFrame::GLTextureHandle:
+ return dbg << "GLTextureHandle";
+ case QVideoFrame::MTLTextureHandle:
+ return dbg << "MTLTextureHandle";
+ case QVideoFrame::XvShmImageHandle:
+ return dbg << "XvShmImageHandle";
+ case QVideoFrame::CoreImageHandle:
+ return dbg << "CoreImageHandle";
+ case QVideoFrame::QPixmapHandle:
+ return dbg << "QPixmapHandle";
+ default:
+ return dbg << "UserHandle(" << int(type) << ')';
+ }
+}
+
QDebug operator<<(QDebug dbg, const QVideoFrame& f)
{
QDebugStateSaver saver(dbg);
diff --git a/src/multimedia/video/qvideoframe.h b/src/multimedia/video/qvideoframe.h
index 5c70c06f5..c240811a4 100644
--- a/src/multimedia/video/qvideoframe.h
+++ b/src/multimedia/video/qvideoframe.h
@@ -40,17 +40,18 @@
#ifndef QVIDEOFRAME_H
#define QVIDEOFRAME_H
+#include <QtMultimedia/qtmultimediaglobal.h>
+
#include <QtCore/qmetatype.h>
#include <QtCore/qshareddata.h>
-#include <QtGui/qimage.h>
-#include <QtMultimedia/qabstractvideobuffer.h>
#include <QtCore/qvariant.h>
+#include <QtGui/qimage.h>
QT_BEGIN_NAMESPACE
class QSize;
-
class QVideoFramePrivate;
+class QAbstractVideoBuffer;
class Q_MULTIMEDIA_EXPORT QVideoFrame
{
@@ -102,6 +103,25 @@ public:
Format_User = 1000
};
+ enum HandleType
+ {
+ NoHandle,
+ GLTextureHandle,
+ MTLTextureHandle,
+ XvShmImageHandle,
+ CoreImageHandle,
+ QPixmapHandle,
+ EGLImageHandle
+ };
+
+ enum MapMode
+ {
+ NotMapped = 0x00,
+ ReadOnly = 0x01,
+ WriteOnly = 0x02,
+ ReadWrite = ReadOnly | WriteOnly
+ };
+
QVideoFrame();
QVideoFrame(QAbstractVideoBuffer *buffer, const QSize &size, PixelFormat format);
QVideoFrame(int bytes, const QSize &size, int bytesPerLine, PixelFormat format);
@@ -118,7 +138,7 @@ public:
PixelFormat pixelFormat() const;
- QAbstractVideoBuffer::HandleType handleType() const;
+ QVideoFrame::HandleType handleType() const;
QSize size() const;
int width() const;
@@ -128,9 +148,9 @@ public:
bool isReadable() const;
bool isWritable() const;
- QAbstractVideoBuffer::MapMode mapMode() const;
+ QVideoFrame::MapMode mapMode() const;
- bool map(QAbstractVideoBuffer::MapMode mode);
+ bool map(QVideoFrame::MapMode mode);
void unmap();
int bytesPerLine() const;
@@ -168,6 +188,7 @@ Q_DECLARE_METATYPE(QVideoFrame);
#ifndef QT_NO_DEBUG_STREAM
Q_MULTIMEDIA_EXPORT QDebug operator<<(QDebug, const QVideoFrame&);
+Q_MULTIMEDIA_EXPORT QDebug operator<<(QDebug, QVideoFrame::HandleType);
Q_MULTIMEDIA_EXPORT QDebug operator<<(QDebug, QVideoFrame::PixelFormat);
#endif
diff --git a/src/multimedia/video/qvideosurfaceformat.cpp b/src/multimedia/video/qvideosurfaceformat.cpp
index 2fba59744..d80389151 100644
--- a/src/multimedia/video/qvideosurfaceformat.cpp
+++ b/src/multimedia/video/qvideosurfaceformat.cpp
@@ -55,7 +55,7 @@ public:
QVideoSurfaceFormatPrivate(
const QSize &size,
QVideoFrame::PixelFormat format,
- QAbstractVideoBuffer::HandleType type)
+ QVideoFrame::HandleType type)
: pixelFormat(format)
, handleType(type)
, frameSize(size)
@@ -94,7 +94,7 @@ public:
}
QVideoFrame::PixelFormat pixelFormat = QVideoFrame::Format_Invalid;
- QAbstractVideoBuffer::HandleType handleType = QAbstractVideoBuffer::NoHandle;
+ QVideoFrame::HandleType handleType = QVideoFrame::NoHandle;
QVideoSurfaceFormat::Direction scanLineDirection = QVideoSurfaceFormat::TopToBottom;
QSize frameSize;
QSize pixelAspectRatio;
@@ -186,7 +186,7 @@ QVideoSurfaceFormat::QVideoSurfaceFormat()
\a size and pixel \a format.
*/
QVideoSurfaceFormat::QVideoSurfaceFormat(
- const QSize& size, QVideoFrame::PixelFormat format, QAbstractVideoBuffer::HandleType type)
+ const QSize& size, QVideoFrame::PixelFormat format, QVideoFrame::HandleType type)
: d(new QVideoSurfaceFormatPrivate(size, format, type))
{
}
@@ -243,12 +243,12 @@ QVideoFrame::PixelFormat QVideoSurfaceFormat::pixelFormat() const
/*!
Returns the type of handle the surface uses to present the frame data.
- If the handle type is \c QAbstractVideoBuffer::NoHandle, buffers with any handle type are valid
- provided they can be \l {QAbstractVideoBuffer::map()}{mapped} with the
- QAbstractVideoBuffer::ReadOnly flag. If the handleType() is not QAbstractVideoBuffer::NoHandle
+ If the handle type is \c QVideoFrame::NoHandle, buffers with any handle type are valid
+ provided they can be \l {QVideoFrame::map()}{mapped} with the
+ QVideoFrame::ReadOnly flag. If the handleType() is not QVideoFrame::NoHandle
then the handle type of the buffer must be the same as that of the surface format.
*/
-QAbstractVideoBuffer::HandleType QVideoSurfaceFormat::handleType() const
+QVideoFrame::HandleType QVideoSurfaceFormat::handleType() const
{
return d->handleType;
}
diff --git a/src/multimedia/video/qvideosurfaceformat.h b/src/multimedia/video/qvideosurfaceformat.h
index 5f264570c..417b53d8f 100644
--- a/src/multimedia/video/qvideosurfaceformat.h
+++ b/src/multimedia/video/qvideosurfaceformat.h
@@ -80,7 +80,7 @@ public:
QVideoSurfaceFormat(
const QSize &size,
QVideoFrame::PixelFormat pixelFormat,
- QAbstractVideoBuffer::HandleType handleType = QAbstractVideoBuffer::NoHandle);
+ QVideoFrame::HandleType handleType = QVideoFrame::NoHandle);
QVideoSurfaceFormat(const QVideoSurfaceFormat &format);
~QVideoSurfaceFormat();
@@ -92,7 +92,7 @@ public:
bool isValid() const;
QVideoFrame::PixelFormat pixelFormat() const;
- QAbstractVideoBuffer::HandleType handleType() const;
+ QVideoFrame::HandleType handleType() const;
QSize frameSize() const;
void setFrameSize(const QSize &size);
diff --git a/src/multimedia/video/qvideosurfaces.cpp b/src/multimedia/video/qvideosurfaces.cpp
index 0583133be..1870e6ebf 100644
--- a/src/multimedia/video/qvideosurfaces.cpp
+++ b/src/multimedia/video/qvideosurfaces.cpp
@@ -57,7 +57,7 @@ QVideoSurfaces::QVideoSurfaces(const QList<QAbstractVideoSurface *> &s, QObject
QVideoSurfaces::~QVideoSurfaces() = default;
-QList<QVideoFrame::PixelFormat> QVideoSurfaces::supportedPixelFormats(QAbstractVideoBuffer::HandleType type) const
+QList<QVideoFrame::PixelFormat> QVideoSurfaces::supportedPixelFormats(QVideoFrame::HandleType type) const
{
QList<QVideoFrame::PixelFormat> result;
QMap<QVideoFrame::PixelFormat, int> formats;
diff --git a/src/multimedia/video/qvideosurfaces_p.h b/src/multimedia/video/qvideosurfaces_p.h
index 9074ba458..f72bd0565 100644
--- a/src/multimedia/video/qvideosurfaces_p.h
+++ b/src/multimedia/video/qvideosurfaces_p.h
@@ -62,7 +62,7 @@ public:
QVideoSurfaces(const QList<QAbstractVideoSurface *> &surfaces, QObject *parent = nullptr);
~QVideoSurfaces();
- QList<QVideoFrame::PixelFormat> supportedPixelFormats(QAbstractVideoBuffer::HandleType type) const override;
+ QList<QVideoFrame::PixelFormat> supportedPixelFormats(QVideoFrame::HandleType type) const override;
bool start(const QVideoSurfaceFormat &format) override;
void stop() override;
bool present(const QVideoFrame &frame) override;
diff --git a/src/multimediawidgets/qpaintervideosurface.cpp b/src/multimediawidgets/qpaintervideosurface.cpp
index 9e6d8fa8a..785980db8 100644
--- a/src/multimediawidgets/qpaintervideosurface.cpp
+++ b/src/multimediawidgets/qpaintervideosurface.cpp
@@ -71,7 +71,7 @@ public:
QVideoSurfaceGenericPainter();
[[nodiscard]] QList<QVideoFrame::PixelFormat> supportedPixelFormats(
- QAbstractVideoBuffer::HandleType handleType) const override;
+ QVideoFrame::HandleType handleType) const override;
[[nodiscard]] bool isFormatSupported(const QVideoSurfaceFormat &format) const override;
@@ -109,11 +109,11 @@ QVideoSurfaceGenericPainter::QVideoSurfaceGenericPainter()
}
QList<QVideoFrame::PixelFormat> QVideoSurfaceGenericPainter::supportedPixelFormats(
- QAbstractVideoBuffer::HandleType handleType) const
+ QVideoFrame::HandleType handleType) const
{
switch (handleType) {
- case QAbstractVideoBuffer::QPixmapHandle:
- case QAbstractVideoBuffer::NoHandle:
+ case QVideoFrame::QPixmapHandle:
+ case QVideoFrame::NoHandle:
return m_imagePixelFormats;
default:
;
@@ -124,9 +124,9 @@ QList<QVideoFrame::PixelFormat> QVideoSurfaceGenericPainter::supportedPixelForma
bool QVideoSurfaceGenericPainter::isFormatSupported(const QVideoSurfaceFormat &format) const
{
switch (format.handleType()) {
- case QAbstractVideoBuffer::QPixmapHandle:
+ case QVideoFrame::QPixmapHandle:
return true;
- case QAbstractVideoBuffer::NoHandle:
+ case QVideoFrame::NoHandle:
return m_imagePixelFormats.contains(format.pixelFormat())
&& !format.frameSize().isEmpty();
default:
@@ -148,8 +148,8 @@ QAbstractVideoSurface::Error QVideoSurfaceGenericPainter::start(const QVideoSurf
m_scanLineDirection = format.scanLineDirection();
m_mirrored = format.property("mirrored").toBool();
- const QAbstractVideoBuffer::HandleType t = format.handleType();
- if (t == QAbstractVideoBuffer::NoHandle) {
+ const QVideoFrame::HandleType t = format.handleType();
+ if (t == QVideoFrame::NoHandle) {
// bool ok = m_imageFormat != QImage::Format_Invalid && !m_imageSize.isEmpty();
//#ifndef QT_NO_OPENGL
// if (QOpenGLContext::openGLModuleType() == QOpenGLContext::LibGLES)
@@ -157,7 +157,7 @@ QAbstractVideoSurface::Error QVideoSurfaceGenericPainter::start(const QVideoSurf
//#endif
// if (ok)
return QAbstractVideoSurface::NoError;
- } else if (t == QAbstractVideoBuffer::QPixmapHandle) {
+ } else if (t == QVideoFrame::QPixmapHandle) {
return QAbstractVideoSurface::NoError;
}
return QAbstractVideoSurface::UnsupportedFormatError;
@@ -183,9 +183,9 @@ QAbstractVideoSurface::Error QVideoSurfaceGenericPainter::paint(
return QAbstractVideoSurface::NoError;
}
- if (m_frame.handleType() == QAbstractVideoBuffer::QPixmapHandle) {
+ if (m_frame.handleType() == QVideoFrame::QPixmapHandle) {
painter->drawPixmap(target, m_frame.handle().value<QPixmap>(), source);
- } else if (m_frame.map(QAbstractVideoBuffer::ReadOnly)) {
+ } else if (m_frame.map(QVideoFrame::ReadOnly)) {
QImage image = m_frame.image();
const QTransform oldTransform = painter->transform();
@@ -249,7 +249,7 @@ public:
QVideoSurfaceGLPainter(QOpenGLContext *context);
~QVideoSurfaceGLPainter() override;
[[nodiscard]] QList<QVideoFrame::PixelFormat> supportedPixelFormats(
- QAbstractVideoBuffer::HandleType handleType) const override;
+ QVideoFrame::HandleType handleType) const override;
[[nodiscard]] bool isFormatSupported(const QVideoSurfaceFormat &format) const override;
@@ -279,7 +279,7 @@ protected:
QVideoFrame m_frame;
QOpenGLContext *m_context;
- QAbstractVideoBuffer::HandleType m_handleType;
+ QVideoFrame::HandleType m_handleType;
QVideoSurfaceFormat::Direction m_scanLineDirection;
bool m_mirrored;
QVideoSurfaceFormat::YCbCrColorSpace m_colorSpace;
@@ -298,7 +298,7 @@ protected:
QVideoSurfaceGLPainter::QVideoSurfaceGLPainter(QOpenGLContext *context)
: m_context(context)
- , m_handleType(QAbstractVideoBuffer::NoHandle)
+ , m_handleType(QVideoFrame::NoHandle)
, m_scanLineDirection(QVideoSurfaceFormat::TopToBottom)
, m_mirrored(false)
, m_colorSpace(QVideoSurfaceFormat::YCbCr_BT601)
@@ -326,13 +326,13 @@ void QVideoSurfaceGLPainter::viewportDestroyed()
}
QList<QVideoFrame::PixelFormat> QVideoSurfaceGLPainter::supportedPixelFormats(
- QAbstractVideoBuffer::HandleType handleType) const
+ QVideoFrame::HandleType handleType) const
{
switch (handleType) {
- case QAbstractVideoBuffer::NoHandle:
+ case QVideoFrame::NoHandle:
return m_imagePixelFormats;
- case QAbstractVideoBuffer::QPixmapHandle:
- case QAbstractVideoBuffer::GLTextureHandle:
+ case QVideoFrame::QPixmapHandle:
+ case QVideoFrame::GLTextureHandle:
return m_glPixelFormats;
default:
;
@@ -346,10 +346,10 @@ bool QVideoSurfaceGLPainter::isFormatSupported(const QVideoSurfaceFormat &format
return false;
switch (format.handleType()) {
- case QAbstractVideoBuffer::NoHandle:
+ case QVideoFrame::NoHandle:
return m_imagePixelFormats.contains(format.pixelFormat());
- case QAbstractVideoBuffer::QPixmapHandle:
- case QAbstractVideoBuffer::GLTextureHandle:
+ case QVideoFrame::QPixmapHandle:
+ case QVideoFrame::GLTextureHandle:
return m_glPixelFormats.contains(format.pixelFormat());
default:
;
@@ -368,14 +368,14 @@ QAbstractVideoSurface::Error QVideoSurfaceGLPainter::setCurrentFrame(const QVide
{
m_frame = frame;
- if (m_handleType == QAbstractVideoBuffer::GLTextureHandle) {
+ if (m_handleType == QVideoFrame::GLTextureHandle) {
m_textureIds[0] = frame.handle().toInt();
glBindTexture(GL_TEXTURE_2D, m_textureIds[0]);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
- } else if (m_frame.map(QAbstractVideoBuffer::ReadOnly)) {
+ } else if (m_frame.map(QVideoFrame::ReadOnly)) {
for (int i = 0; i < m_textureCount; ++i) {
glBindTexture(GL_TEXTURE_2D, m_textureIds[i]);
glTexImage2D(
@@ -394,7 +394,7 @@ QAbstractVideoSurface::Error QVideoSurfaceGLPainter::setCurrentFrame(const QVide
glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
}
m_frame.unmap();
- } else if (m_handleType != QAbstractVideoBuffer::QPixmapHandle && m_frame.isValid()) {
+ } else if (m_handleType != QVideoFrame::QPixmapHandle && m_frame.isValid()) {
return QAbstractVideoSurface::IncorrectFormatError;
}
@@ -409,7 +409,7 @@ QAbstractVideoSurface::Error QVideoSurfaceGLPainter::paint(
return QAbstractVideoSurface::NoError;
}
- if (m_frame.handleType() == QAbstractVideoBuffer::QPixmapHandle) {
+ if (m_frame.handleType() == QVideoFrame::QPixmapHandle) {
painter->drawPixmap(target, m_frame.handle().value<QPixmap>(), source);
} else if (m_frame.isValid()) {
return QAbstractVideoSurface::IncorrectFormatError;
@@ -718,7 +718,7 @@ QAbstractVideoSurface::Error QVideoSurfaceArbFpPainter::start(const QVideoSurfac
const char *program = nullptr;
- if (format.handleType() == QAbstractVideoBuffer::NoHandle) {
+ if (format.handleType() == QVideoFrame::NoHandle) {
switch (format.pixelFormat()) {
case QVideoFrame::Format_RGB32:
initRgbTextureInfo(GL_RGBA, GL_RGBA, GL_UNSIGNED_BYTE, format.frameSize());
@@ -765,7 +765,7 @@ QAbstractVideoSurface::Error QVideoSurfaceArbFpPainter::start(const QVideoSurfac
default:
break;
}
- } else if (format.handleType() == QAbstractVideoBuffer::GLTextureHandle) {
+ } else if (format.handleType() == QVideoFrame::GLTextureHandle) {
switch (format.pixelFormat()) {
case QVideoFrame::Format_RGB32:
case QVideoFrame::Format_ARGB32:
@@ -781,8 +781,8 @@ QAbstractVideoSurface::Error QVideoSurfaceArbFpPainter::start(const QVideoSurfac
default:
break;
}
- } else if (format.handleType() == QAbstractVideoBuffer::QPixmapHandle) {
- m_handleType = QAbstractVideoBuffer::QPixmapHandle;
+ } else if (format.handleType() == QVideoFrame::QPixmapHandle) {
+ m_handleType = QVideoFrame::QPixmapHandle;
return QAbstractVideoSurface::NoError;
}
@@ -827,7 +827,7 @@ QAbstractVideoSurface::Error QVideoSurfaceArbFpPainter::start(const QVideoSurfac
m_frameSize = format.frameSize();
m_colorSpace = format.yCbCrColorSpace();
- if (m_handleType == QAbstractVideoBuffer::NoHandle)
+ if (m_handleType == QVideoFrame::NoHandle)
glGenTextures(m_textureCount, m_textureIds);
}
}
@@ -839,14 +839,14 @@ QAbstractVideoSurface::Error QVideoSurfaceArbFpPainter::start(const QVideoSurfac
void QVideoSurfaceArbFpPainter::stop()
{
if (m_context) {
- if (m_handleType != QAbstractVideoBuffer::GLTextureHandle)
+ if (m_handleType != QVideoFrame::GLTextureHandle)
glDeleteTextures(m_textureCount, m_textureIds);
glDeleteProgramsARB(1, &m_programId);
}
m_textureCount = 0;
m_programId = 0;
- m_handleType = QAbstractVideoBuffer::NoHandle;
+ m_handleType = QVideoFrame::NoHandle;
QVideoSurfaceGLPainter::stop();
}
@@ -859,8 +859,8 @@ QAbstractVideoSurface::Error QVideoSurfaceArbFpPainter::paint(
return QAbstractVideoSurface::NoError;
}
- const QAbstractVideoBuffer::HandleType h = m_frame.handleType();
- if (h == QAbstractVideoBuffer::NoHandle || h == QAbstractVideoBuffer::GLTextureHandle) {
+ const QVideoFrame::HandleType h = m_frame.handleType();
+ if (h == QVideoFrame::NoHandle || h == QVideoFrame::GLTextureHandle) {
bool stencilTestEnabled = glIsEnabled(GL_STENCIL_TEST);
bool scissorTestEnabled = glIsEnabled(GL_SCISSOR_TEST);
@@ -1093,7 +1093,7 @@ QAbstractVideoSurface::Error QVideoSurfaceGlslPainter::start(const QVideoSurface
const char *fragmentProgram = nullptr;
- if (format.handleType() == QAbstractVideoBuffer::NoHandle) {
+ if (format.handleType() == QVideoFrame::NoHandle) {
switch (format.pixelFormat()) {
case QVideoFrame::Format_RGB32:
initRgbTextureInfo(GL_RGBA, GL_RGBA, GL_UNSIGNED_BYTE, format.frameSize());
@@ -1144,7 +1144,7 @@ QAbstractVideoSurface::Error QVideoSurfaceGlslPainter::start(const QVideoSurface
default:
break;
}
- } else if (format.handleType() == QAbstractVideoBuffer::GLTextureHandle) {
+ } else if (format.handleType() == QVideoFrame::GLTextureHandle) {
switch (format.pixelFormat()) {
case QVideoFrame::Format_RGB32:
case QVideoFrame::Format_ARGB32:
@@ -1160,8 +1160,8 @@ QAbstractVideoSurface::Error QVideoSurfaceGlslPainter::start(const QVideoSurface
default:
break;
}
- } else if (format.handleType() == QAbstractVideoBuffer::QPixmapHandle) {
- m_handleType = QAbstractVideoBuffer::QPixmapHandle;
+ } else if (format.handleType() == QVideoFrame::QPixmapHandle) {
+ m_handleType = QVideoFrame::QPixmapHandle;
return QAbstractVideoSurface::NoError;
}
@@ -1186,7 +1186,7 @@ QAbstractVideoSurface::Error QVideoSurfaceGlslPainter::start(const QVideoSurface
m_frameSize = format.frameSize();
m_colorSpace = format.yCbCrColorSpace();
- if (m_handleType == QAbstractVideoBuffer::NoHandle)
+ if (m_handleType == QVideoFrame::NoHandle)
glGenTextures(m_textureCount, m_textureIds);
}
@@ -1196,14 +1196,14 @@ QAbstractVideoSurface::Error QVideoSurfaceGlslPainter::start(const QVideoSurface
void QVideoSurfaceGlslPainter::stop()
{
if (m_context) {
- if (m_handleType != QAbstractVideoBuffer::GLTextureHandle)
+ if (m_handleType != QVideoFrame::GLTextureHandle)
glDeleteTextures(m_textureCount, m_textureIds);
}
m_program.removeAllShaders();
m_textureCount = 0;
- m_handleType = QAbstractVideoBuffer::NoHandle;
+ m_handleType = QVideoFrame::NoHandle;
QVideoSurfaceGLPainter::stop();
}
@@ -1216,8 +1216,8 @@ QAbstractVideoSurface::Error QVideoSurfaceGlslPainter::paint(
return QAbstractVideoSurface::NoError;
}
- const QAbstractVideoBuffer::HandleType h = m_frame.handleType();
- if (h == QAbstractVideoBuffer::NoHandle || h == QAbstractVideoBuffer::GLTextureHandle) {
+ const QVideoFrame::HandleType h = m_frame.handleType();
+ if (h == QVideoFrame::NoHandle || h == QVideoFrame::GLTextureHandle) {
bool stencilTestEnabled = glIsEnabled(GL_STENCIL_TEST);
bool scissorTestEnabled = glIsEnabled(GL_SCISSOR_TEST);
@@ -1368,7 +1368,7 @@ QPainterVideoSurface::~QPainterVideoSurface()
/*!
*/
QList<QVideoFrame::PixelFormat> QPainterVideoSurface::supportedPixelFormats(
- QAbstractVideoBuffer::HandleType handleType) const
+ QVideoFrame::HandleType handleType) const
{
if (!m_painter)
const_cast<QPainterVideoSurface *>(this)->createPainter();
diff --git a/src/multimediawidgets/qpaintervideosurface_p.h b/src/multimediawidgets/qpaintervideosurface_p.h
index 582d6944c..018fad36f 100644
--- a/src/multimediawidgets/qpaintervideosurface_p.h
+++ b/src/multimediawidgets/qpaintervideosurface_p.h
@@ -69,7 +69,7 @@ public:
virtual ~QVideoSurfacePainter();
virtual QList<QVideoFrame::PixelFormat> supportedPixelFormats(
- QAbstractVideoBuffer::HandleType handleType) const = 0;
+ QVideoFrame::HandleType handleType) const = 0;
virtual bool isFormatSupported(const QVideoSurfaceFormat &format) const = 0;
@@ -94,7 +94,7 @@ public:
~QPainterVideoSurface();
QList<QVideoFrame::PixelFormat> supportedPixelFormats(
- QAbstractVideoBuffer::HandleType handleType = QAbstractVideoBuffer::NoHandle) const override;
+ QVideoFrame::HandleType handleType = QVideoFrame::NoHandle) const override;
bool isFormatSupported(const QVideoSurfaceFormat &format) const override;
diff --git a/src/plugins/videonode/imx6/qsgvivantevideomaterial.cpp b/src/plugins/videonode/imx6/qsgvivantevideomaterial.cpp
index 2e6c712e3..b238dff4f 100644
--- a/src/plugins/videonode/imx6/qsgvivantevideomaterial.cpp
+++ b/src/plugins/videonode/imx6/qsgvivantevideomaterial.cpp
@@ -176,7 +176,7 @@ GLuint QSGVivanteVideoMaterial::vivanteMapping(QVideoFrame vF)
clearTextures();
}
- if (vF.map(QAbstractVideoBuffer::ReadOnly)) {
+ if (vF.map(QVideoFrame::ReadOnly)) {
if (mMappable) {
if (!mBitsToTextureMap.contains(vF.bits())) {
diff --git a/src/plugins/videonode/imx6/qsgvivantevideonode.h b/src/plugins/videonode/imx6/qsgvivantevideonode.h
index 2796f1e44..1d2f3d342 100644
--- a/src/plugins/videonode/imx6/qsgvivantevideonode.h
+++ b/src/plugins/videonode/imx6/qsgvivantevideonode.h
@@ -51,7 +51,7 @@ public:
~QSGVivanteVideoNode();
QVideoFrame::PixelFormat pixelFormat() const { return mFormat.pixelFormat(); }
- QAbstractVideoBuffer::HandleType handleType() const { return QAbstractVideoBuffer::NoHandle; }
+ QVideoFrame::HandleType handleType() const { return QVideoFrame::NoHandle; }
void setCurrentFrame(const QVideoFrame &frame, FrameFlags flags);
static const QMap<QVideoFrame::PixelFormat, GLenum>& getVideoFormat2GLFormatMap();
diff --git a/src/plugins/videonode/imx6/qsgvivantevideonodefactory.cpp b/src/plugins/videonode/imx6/qsgvivantevideonodefactory.cpp
index 55ed57c10..a4982ad46 100644
--- a/src/plugins/videonode/imx6/qsgvivantevideonodefactory.cpp
+++ b/src/plugins/videonode/imx6/qsgvivantevideonodefactory.cpp
@@ -42,10 +42,10 @@
#include <QtGui/QGuiApplication>
QList<QVideoFrame::PixelFormat> QSGVivanteVideoNodeFactory::supportedPixelFormats(
- QAbstractVideoBuffer::HandleType handleType) const
+ QVideoFrame::HandleType handleType) const
{
const bool isWebGl = QGuiApplication::platformName() == QLatin1String("webgl");
- if (!isWebGl && handleType == QAbstractVideoBuffer::NoHandle)
+ if (!isWebGl && handleType == QVideoFrame::NoHandle)
return QSGVivanteVideoNode::getVideoFormat2GLFormatMap().keys();
else
return QList<QVideoFrame::PixelFormat>();
diff --git a/src/plugins/videonode/imx6/qsgvivantevideonodefactory.h b/src/plugins/videonode/imx6/qsgvivantevideonodefactory.h
index dfb6a0123..6dd068d55 100644
--- a/src/plugins/videonode/imx6/qsgvivantevideonodefactory.h
+++ b/src/plugins/videonode/imx6/qsgvivantevideonodefactory.h
@@ -50,7 +50,7 @@ public:
Q_PLUGIN_METADATA(IID QSGVideoNodeFactoryInterface_iid FILE "imx6.json")
Q_INTERFACES(QSGVideoNodeFactoryInterface)
- QList<QVideoFrame::PixelFormat> supportedPixelFormats(QAbstractVideoBuffer::HandleType handleType) const;
+ QList<QVideoFrame::PixelFormat> supportedPixelFormats(QVideoFrame::HandleType handleType) const;
QSGVideoNode *createNode(const QVideoSurfaceFormat &format);
};
#endif // QSGVIDEONODEFACTORY_VIVANTE_H
diff --git a/src/qtmultimediaquicktools/qdeclarativevideooutput_render.cpp b/src/qtmultimediaquicktools/qdeclarativevideooutput_render.cpp
index 5ef318a22..bc5747903 100644
--- a/src/qtmultimediaquicktools/qdeclarativevideooutput_render.cpp
+++ b/src/qtmultimediaquicktools/qdeclarativevideooutput_render.cpp
@@ -333,7 +333,7 @@ QSGNode *QDeclarativeVideoBackend::updatePaintNode(QSGNode *oldNode,
if ((q->flushMode() == QDeclarativeVideoOutput::FirstFrame && !m_frameOnFlush.isValid())
|| q->flushMode() == QDeclarativeVideoOutput::LastFrame) {
- m_frameOnFlush = m_surfaceFormat.handleType() == QAbstractVideoBuffer::NoHandle
+ m_frameOnFlush = m_surfaceFormat.handleType() == QVideoFrame::NoHandle
? m_frame
: m_frame.image();
}
@@ -397,13 +397,13 @@ QSGVideoItemSurface::QSGVideoItemSurface(QDeclarativeVideoBackend *backend, QObj
QSGVideoItemSurface::~QSGVideoItemSurface() = default;
QList<QVideoFrame::PixelFormat> QSGVideoItemSurface::supportedPixelFormats(
- QAbstractVideoBuffer::HandleType handleType) const
+ QVideoFrame::HandleType handleType) const
{
QList<QVideoFrame::PixelFormat> formats;
static bool noGLTextures = false;
static bool noGLTexturesChecked = false;
- if (handleType == QAbstractVideoBuffer::GLTextureHandle) {
+ if (handleType == QVideoFrame::GLTextureHandle) {
if (!noGLTexturesChecked) {
noGLTexturesChecked = true;
noGLTextures = qEnvironmentVariableIsSet("QT_QUICK_NO_TEXTURE_VIDEOFRAMES");
diff --git a/src/qtmultimediaquicktools/qdeclarativevideooutput_render_p.h b/src/qtmultimediaquicktools/qdeclarativevideooutput_render_p.h
index 893bc14c7..e15363016 100644
--- a/src/qtmultimediaquicktools/qdeclarativevideooutput_render_p.h
+++ b/src/qtmultimediaquicktools/qdeclarativevideooutput_render_p.h
@@ -133,7 +133,7 @@ class QSGVideoItemSurface : public QAbstractVideoSurface
public:
explicit QSGVideoItemSurface(QDeclarativeVideoBackend *backend, QObject *parent = 0);
~QSGVideoItemSurface();
- QList<QVideoFrame::PixelFormat> supportedPixelFormats(QAbstractVideoBuffer::HandleType handleType) const override;
+ QList<QVideoFrame::PixelFormat> supportedPixelFormats(QVideoFrame::HandleType handleType) const override;
bool start(const QVideoSurfaceFormat &format) override;
void stop() override;
bool present(const QVideoFrame &frame) override;
diff --git a/src/qtmultimediaquicktools/qsgvideonode_p.h b/src/qtmultimediaquicktools/qsgvideonode_p.h
index c094bed1f..75bf1da5b 100644
--- a/src/qtmultimediaquicktools/qsgvideonode_p.h
+++ b/src/qtmultimediaquicktools/qsgvideonode_p.h
@@ -72,7 +72,7 @@ public:
virtual void setCurrentFrame(const QVideoFrame &frame, FrameFlags flags) = 0;
virtual QVideoFrame::PixelFormat pixelFormat() const = 0;
- virtual QAbstractVideoBuffer::HandleType handleType() const = 0;
+ virtual QVideoFrame::HandleType handleType() const = 0;
void setTexturedRectGeometry(const QRectF &boundingRect, const QRectF &textureRect, int orientation);
@@ -89,7 +89,7 @@ class Q_MULTIMEDIAQUICK_EXPORT QSGVideoNodeFactoryInterface
public:
virtual ~QSGVideoNodeFactoryInterface();
- virtual QList<QVideoFrame::PixelFormat> supportedPixelFormats(QAbstractVideoBuffer::HandleType handleType) const = 0;
+ virtual QList<QVideoFrame::PixelFormat> supportedPixelFormats(QVideoFrame::HandleType handleType) const = 0;
virtual QSGVideoNode *createNode(const QVideoSurfaceFormat &format) = 0;
};
@@ -101,7 +101,7 @@ class Q_MULTIMEDIAQUICK_EXPORT QSGVideoNodeFactoryPlugin : public QObject, publi
Q_OBJECT
Q_INTERFACES(QSGVideoNodeFactoryInterface)
public:
- QList<QVideoFrame::PixelFormat> supportedPixelFormats(QAbstractVideoBuffer::HandleType handleType) const override = 0;
+ QList<QVideoFrame::PixelFormat> supportedPixelFormats(QVideoFrame::HandleType handleType) const override = 0;
QSGVideoNode *createNode(const QVideoSurfaceFormat &format) override = 0;
};
diff --git a/src/qtmultimediaquicktools/qsgvideonode_rgb.cpp b/src/qtmultimediaquicktools/qsgvideonode_rgb.cpp
index 72404c427..57101648d 100644
--- a/src/qtmultimediaquicktools/qsgvideonode_rgb.cpp
+++ b/src/qtmultimediaquicktools/qsgvideonode_rgb.cpp
@@ -44,11 +44,11 @@
QT_BEGIN_NAMESPACE
QList<QVideoFrame::PixelFormat> QSGVideoNodeFactory_RGB::supportedPixelFormats(
- QAbstractVideoBuffer::HandleType handleType) const
+ QVideoFrame::HandleType handleType) const
{
QList<QVideoFrame::PixelFormat> pixelFormats;
- if (handleType == QAbstractVideoBuffer::NoHandle) {
+ if (handleType == QVideoFrame::NoHandle) {
pixelFormats.append(QVideoFrame::Format_RGB32);
pixelFormats.append(QVideoFrame::Format_ARGB32);
pixelFormats.append(QVideoFrame::Format_BGR32);
@@ -174,7 +174,7 @@ void QSGVideoMaterialRhiShader_RGB::updateSampledImage(RenderState &state, int b
format = QRhiTexture::BGRA8;
}
- if (frame.isValid() && frame.map(QAbstractVideoBuffer::ReadOnly)) {
+ if (frame.isValid() && frame.map(QVideoFrame::ReadOnly)) {
m->m_texture->setData(format, frame.size(), frame.bits(), frame.bytesPerLine() * frame.height());
frame.unmap();
}
diff --git a/src/qtmultimediaquicktools/qsgvideonode_rgb_p.h b/src/qtmultimediaquicktools/qsgvideonode_rgb_p.h
index 95b74be0b..c17738b0a 100644
--- a/src/qtmultimediaquicktools/qsgvideonode_rgb_p.h
+++ b/src/qtmultimediaquicktools/qsgvideonode_rgb_p.h
@@ -67,8 +67,8 @@ public:
QVideoFrame::PixelFormat pixelFormat() const override {
return m_format.pixelFormat();
}
- QAbstractVideoBuffer::HandleType handleType() const override {
- return QAbstractVideoBuffer::NoHandle;
+ QVideoFrame::HandleType handleType() const override {
+ return QVideoFrame::NoHandle;
}
void setCurrentFrame(const QVideoFrame &frame, FrameFlags flags) override;
@@ -80,7 +80,7 @@ private:
class QSGVideoNodeFactory_RGB : public QSGVideoNodeFactoryInterface {
public:
- QList<QVideoFrame::PixelFormat> supportedPixelFormats(QAbstractVideoBuffer::HandleType handleType) const override;
+ QList<QVideoFrame::PixelFormat> supportedPixelFormats(QVideoFrame::HandleType handleType) const override;
QSGVideoNode *createNode(const QVideoSurfaceFormat &format) override;
};
diff --git a/src/qtmultimediaquicktools/qsgvideonode_texture.cpp b/src/qtmultimediaquicktools/qsgvideonode_texture.cpp
index 45469125b..58a903065 100644
--- a/src/qtmultimediaquicktools/qsgvideonode_texture.cpp
+++ b/src/qtmultimediaquicktools/qsgvideonode_texture.cpp
@@ -46,19 +46,19 @@
QT_BEGIN_NAMESPACE
QList<QVideoFrame::PixelFormat> QSGVideoNodeFactory_Texture::supportedPixelFormats(
- QAbstractVideoBuffer::HandleType handleType) const
+ QVideoFrame::HandleType handleType) const
{
QList<QVideoFrame::PixelFormat> pixelFormats;
- QList<QAbstractVideoBuffer::HandleType> types;
+ QList<QVideoFrame::HandleType> types;
auto rhi = QSGRhiSupport::instance();
auto metalEnabled = rhi->isRhiEnabled() && rhi->rhiBackend() == QRhi::Metal;
if (metalEnabled)
- types.append(QAbstractVideoBuffer::MTLTextureHandle);
+ types.append(QVideoFrame::MTLTextureHandle);
#if QT_CONFIG(opengl)
- types.append(QAbstractVideoBuffer::GLTextureHandle);
+ types.append(QVideoFrame::GLTextureHandle);
#endif
if (types.contains(handleType)) {
diff --git a/src/qtmultimediaquicktools/qsgvideonode_texture_p.h b/src/qtmultimediaquicktools/qsgvideonode_texture_p.h
index d7348473e..7f0b02220 100644
--- a/src/qtmultimediaquicktools/qsgvideonode_texture_p.h
+++ b/src/qtmultimediaquicktools/qsgvideonode_texture_p.h
@@ -67,7 +67,7 @@ public:
QVideoFrame::PixelFormat pixelFormat() const override {
return m_format.pixelFormat();
}
- QAbstractVideoBuffer::HandleType handleType() const override {
+ QVideoFrame::HandleType handleType() const override {
return m_format.handleType();
}
void setCurrentFrame(const QVideoFrame &frame, FrameFlags flags) override;
@@ -80,7 +80,7 @@ private:
class QSGVideoNodeFactory_Texture : public QSGVideoNodeFactoryInterface {
public:
- QList<QVideoFrame::PixelFormat> supportedPixelFormats(QAbstractVideoBuffer::HandleType handleType) const override;
+ QList<QVideoFrame::PixelFormat> supportedPixelFormats(QVideoFrame::HandleType handleType) const override;
QSGVideoNode *createNode(const QVideoSurfaceFormat &format) override;
};
diff --git a/src/qtmultimediaquicktools/qsgvideonode_yuv.cpp b/src/qtmultimediaquicktools/qsgvideonode_yuv.cpp
index 5979c4c1c..51b02f43b 100644
--- a/src/qtmultimediaquicktools/qsgvideonode_yuv.cpp
+++ b/src/qtmultimediaquicktools/qsgvideonode_yuv.cpp
@@ -44,17 +44,17 @@
QT_BEGIN_NAMESPACE
QList<QVideoFrame::PixelFormat> QSGVideoNodeFactory_YUV::supportedPixelFormats(
- QAbstractVideoBuffer::HandleType handleType) const
+ QVideoFrame::HandleType handleType) const
{
QList<QVideoFrame::PixelFormat> formats;
- if (handleType == QAbstractVideoBuffer::NoHandle) {
+ if (handleType == QVideoFrame::NoHandle) {
formats << QVideoFrame::Format_YUV420P << QVideoFrame::Format_YV12 << QVideoFrame::Format_YUV422P
<< QVideoFrame::Format_NV12 << QVideoFrame::Format_NV21
<< QVideoFrame::Format_UYVY << QVideoFrame::Format_YUYV;
- } else if (handleType == QAbstractVideoBuffer::GLTextureHandle) {
+ } else if (handleType == QVideoFrame::GLTextureHandle) {
formats << QVideoFrame::Format_NV12 << QVideoFrame::Format_NV21;
- } else if (handleType == QAbstractVideoBuffer::MTLTextureHandle) {
+ } else if (handleType == QVideoFrame::MTLTextureHandle) {
formats << QVideoFrame::Format_NV12 << QVideoFrame::Format_NV21;
}
@@ -269,7 +269,7 @@ void QSGVideoMaterialRhiShader_YUV::updateSampledImage(RenderState &state, int b
void QSGVideoMaterialRhiShader_UYVY::mapFrame(QSGVideoMaterial_YUV *m)
{
- if (!m->m_frame.isValid() || !m->m_frame.map(QAbstractVideoBuffer::ReadOnly))
+ if (!m->m_frame.isValid() || !m->m_frame.map(QVideoFrame::ReadOnly))
return;
int fw = m->m_frame.width();
@@ -290,7 +290,7 @@ void QSGVideoMaterialRhiShader_UYVY::mapFrame(QSGVideoMaterial_YUV *m)
void QSGVideoMaterialRhiShader_YUV_YV::mapFrame(QSGVideoMaterial_YUV *m)
{
- if (!m->m_frame.isValid() || !m->m_frame.map(QAbstractVideoBuffer::ReadOnly))
+ if (!m->m_frame.isValid() || !m->m_frame.map(QVideoFrame::ReadOnly))
return;
int y = 0;
@@ -318,7 +318,7 @@ void QSGVideoMaterialRhiShader_NV12::mapFrame(QSGVideoMaterial_YUV *m)
if (!m->m_frame.isValid())
return;
- if (m->m_frame.handleType() == QAbstractVideoBuffer::GLTextureHandle || m->m_frame.handleType() == QAbstractVideoBuffer::MTLTextureHandle) {
+ if (m->m_frame.handleType() == QVideoFrame::GLTextureHandle || m->m_frame.handleType() == QVideoFrame::MTLTextureHandle) {
m->m_planeWidth[0] = m->m_planeWidth[1] = 1;
auto textures = m->m_frame.handle().toList();
if (!textures.isEmpty()) {
@@ -333,7 +333,7 @@ void QSGVideoMaterialRhiShader_NV12::mapFrame(QSGVideoMaterial_YUV *m)
return;
}
- if (!m->m_frame.map(QAbstractVideoBuffer::ReadOnly))
+ if (!m->m_frame.map(QVideoFrame::ReadOnly))
return;
int y = 0;
diff --git a/src/qtmultimediaquicktools/qsgvideonode_yuv_p.h b/src/qtmultimediaquicktools/qsgvideonode_yuv_p.h
index 643f40c71..c8299e919 100644
--- a/src/qtmultimediaquicktools/qsgvideonode_yuv_p.h
+++ b/src/qtmultimediaquicktools/qsgvideonode_yuv_p.h
@@ -66,8 +66,8 @@ public:
QVideoFrame::PixelFormat pixelFormat() const override {
return m_format.pixelFormat();
}
- QAbstractVideoBuffer::HandleType handleType() const override {
- return QAbstractVideoBuffer::NoHandle;
+ QVideoFrame::HandleType handleType() const override {
+ return QVideoFrame::NoHandle;
}
void setCurrentFrame(const QVideoFrame &frame, FrameFlags flags) override;
@@ -80,7 +80,7 @@ private:
class QSGVideoNodeFactory_YUV : public QSGVideoNodeFactoryInterface {
public:
- QList<QVideoFrame::PixelFormat> supportedPixelFormats(QAbstractVideoBuffer::HandleType handleType) const override;
+ QList<QVideoFrame::PixelFormat> supportedPixelFormats(QVideoFrame::HandleType handleType) const override;
QSGVideoNode *createNode(const QVideoSurfaceFormat &format) override;
};
diff --git a/tests/auto/integration/qmediaplayerbackend/tst_qmediaplayerbackend.cpp b/tests/auto/integration/qmediaplayerbackend/tst_qmediaplayerbackend.cpp
index 8d093d6db..7dc2b3d7c 100644
--- a/tests/auto/integration/qmediaplayerbackend/tst_qmediaplayerbackend.cpp
+++ b/tests/auto/integration/qmediaplayerbackend/tst_qmediaplayerbackend.cpp
@@ -106,7 +106,7 @@ public:
//video surface
[[nodiscard]] QList<QVideoFrame::PixelFormat> supportedPixelFormats(
- QAbstractVideoBuffer::HandleType handleType = QAbstractVideoBuffer::NoHandle) const override;
+ QVideoFrame::HandleType handleType = QVideoFrame::NoHandle) const override;
bool start(const QVideoSurfaceFormat &format) override;
void stop() override;
@@ -776,7 +776,7 @@ void tst_QMediaPlayerBackend::seekPauseSeek()
QCOMPARE(frame.height(), 120);
// create QImage for QVideoFrame to verify RGB pixel colors
- QVERIFY(frame.map(QAbstractVideoBuffer::ReadOnly));
+ QVERIFY(frame.map(QVideoFrame::ReadOnly));
QImage image(frame.bits(), frame.width(), frame.height(), QVideoFrame::imageFormatFromPixelFormat(frame.pixelFormat()));
QVERIFY(!image.isNull());
QVERIFY(qRed(image.pixel(0, 0)) >= 230); // conversion from YUV => RGB, that's why it's not 255
@@ -800,7 +800,7 @@ void tst_QMediaPlayerBackend::seekPauseSeek()
QCOMPARE(frame.width(), 160);
QCOMPARE(frame.height(), 120);
- QVERIFY(frame.map(QAbstractVideoBuffer::ReadOnly));
+ QVERIFY(frame.map(QVideoFrame::ReadOnly));
QImage image(frame.bits(), frame.width(), frame.height(), QVideoFrame::imageFormatFromPixelFormat(frame.pixelFormat()));
QVERIFY(!image.isNull());
QVERIFY(qRed(image.pixel(0, 0)) < 20);
@@ -1123,9 +1123,9 @@ TestVideoSurface::TestVideoSurface(bool storeFrames)
}
QList<QVideoFrame::PixelFormat> TestVideoSurface::supportedPixelFormats(
- QAbstractVideoBuffer::HandleType handleType) const
+ QVideoFrame::HandleType handleType) const
{
- if (handleType == QAbstractVideoBuffer::NoHandle) {
+ if (handleType == QVideoFrame::NoHandle) {
return m_supported;
}
diff --git a/tests/auto/unit/mockbackend/mockvideosurface.h b/tests/auto/unit/mockbackend/mockvideosurface.h
index d9cd4aec9..7676cc3fe 100644
--- a/tests/auto/unit/mockbackend/mockvideosurface.h
+++ b/tests/auto/unit/mockbackend/mockvideosurface.h
@@ -35,7 +35,7 @@ class MockVideoSurface : public QAbstractVideoSurface
{
public:
QList<QVideoFrame::PixelFormat> supportedPixelFormats(
- QAbstractVideoBuffer::HandleType = QAbstractVideoBuffer::NoHandle) const
+ QVideoFrame::HandleType = QVideoFrame::NoHandle) const
{
return QList<QVideoFrame::PixelFormat>();
}
diff --git a/tests/auto/unit/multimedia/qabstractvideobuffer/tst_qabstractvideobuffer.cpp b/tests/auto/unit/multimedia/qabstractvideobuffer/tst_qabstractvideobuffer.cpp
index e11fd6ac0..0fa4bfb31 100644
--- a/tests/auto/unit/multimedia/qabstractvideobuffer/tst_qabstractvideobuffer.cpp
+++ b/tests/auto/unit/multimedia/qabstractvideobuffer/tst_qabstractvideobuffer.cpp
@@ -35,7 +35,7 @@
// Adds an enum, and the stringized version
#define ADD_ENUM_TEST(x) \
QTest::newRow(#x) \
- << QAbstractVideoBuffer::x \
+ << QVideoFrame::x \
<< QString(QLatin1String(#x));
class tst_QAbstractVideoBuffer : public QObject
@@ -63,11 +63,11 @@ private slots:
class QtTestVideoBuffer : public QAbstractVideoBuffer
{
public:
- QtTestVideoBuffer(QAbstractVideoBuffer::HandleType type) : QAbstractVideoBuffer(type) {}
+ QtTestVideoBuffer(QVideoFrame::HandleType type) : QAbstractVideoBuffer(type) {}
- [[nodiscard]] MapMode mapMode() const override { return QAbstractVideoBuffer::ReadWrite; }
+ [[nodiscard]] QVideoFrame::MapMode mapMode() const override { return QVideoFrame::ReadWrite; }
- MapData map(MapMode) override { return {}; }
+ MapData map(QVideoFrame::MapMode) override { return {}; }
void unmap() override {}
};
@@ -97,7 +97,7 @@ void tst_QAbstractVideoBuffer::cleanup()
void tst_QAbstractVideoBuffer::handleType_data()
{
- QTest::addColumn<QAbstractVideoBuffer::HandleType>("type");
+ QTest::addColumn<QVideoFrame::HandleType>("type");
QTest::addColumn<QString>("stringized");
ADD_ENUM_TEST(NoHandle);
@@ -105,18 +105,11 @@ void tst_QAbstractVideoBuffer::handleType_data()
ADD_ENUM_TEST(XvShmImageHandle);
ADD_ENUM_TEST(QPixmapHandle);
ADD_ENUM_TEST(CoreImageHandle);
-
- // User handles are different
-
- QTest::newRow("user1")
- << QAbstractVideoBuffer::UserHandle << QString::fromLatin1("UserHandle(1000)");
- QTest::newRow("user2")
- << QAbstractVideoBuffer::HandleType(QAbstractVideoBuffer::UserHandle + 1) << QString::fromLatin1("UserHandle(1001)");
}
void tst_QAbstractVideoBuffer::handleType()
{
- QFETCH(QAbstractVideoBuffer::HandleType, type);
+ QFETCH(QVideoFrame::HandleType, type);
QFETCH(QString, stringized);
QtTestVideoBuffer buffer(type);
@@ -129,20 +122,20 @@ void tst_QAbstractVideoBuffer::handleType()
void tst_QAbstractVideoBuffer::handle()
{
- QtTestVideoBuffer buffer(QAbstractVideoBuffer::NoHandle);
+ QtTestVideoBuffer buffer(QVideoFrame::NoHandle);
QVERIFY(buffer.handle().isNull());
}
void tst_QAbstractVideoBuffer::mapMode()
{
- QtTestVideoBuffer maptest(QAbstractVideoBuffer::NoHandle);
- QVERIFY2(maptest.mapMode() == QAbstractVideoBuffer::ReadWrite, "ReadWrite Failed");
+ QtTestVideoBuffer maptest(QVideoFrame::NoHandle);
+ QVERIFY2(maptest.mapMode() == QVideoFrame::ReadWrite, "ReadWrite Failed");
}
void tst_QAbstractVideoBuffer::mapModeDebug_data()
{
- QTest::addColumn<QAbstractVideoBuffer::MapMode>("mapMode");
+ QTest::addColumn<QVideoFrame::MapMode>("mapMode");
QTest::addColumn<QString>("stringized");
ADD_ENUM_TEST(NotMapped);
@@ -153,7 +146,7 @@ void tst_QAbstractVideoBuffer::mapModeDebug_data()
void tst_QAbstractVideoBuffer::mapModeDebug()
{
- QFETCH(QAbstractVideoBuffer::MapMode, mapMode);
+ QFETCH(QVideoFrame::MapMode, mapMode);
QFETCH(QString, stringized);
QTest::ignoreMessage(QtDebugMsg, stringized.toLatin1().constData());
diff --git a/tests/auto/unit/multimedia/qabstractvideosurface/tst_qabstractvideosurface.cpp b/tests/auto/unit/multimedia/qabstractvideosurface/tst_qabstractvideosurface.cpp
index 86d22b1df..b0e6a6c11 100644
--- a/tests/auto/unit/multimedia/qabstractvideosurface/tst_qabstractvideosurface.cpp
+++ b/tests/auto/unit/multimedia/qabstractvideosurface/tst_qabstractvideosurface.cpp
@@ -58,7 +58,7 @@ private slots:
void supportedFormatsChanged();
};
-using SupportedFormatMap = QMultiMap<QAbstractVideoBuffer::HandleType, QVideoFrame::PixelFormat>;
+using SupportedFormatMap = QMultiMap<QVideoFrame::HandleType, QVideoFrame::PixelFormat>;
class QtTestVideoSurface : public QAbstractVideoSurface
{
@@ -69,7 +69,7 @@ public:
: QAbstractVideoSurface(parent), supportedFormats(formats) {}
[[nodiscard]] QList<QVideoFrame::PixelFormat> supportedPixelFormats(
- QAbstractVideoBuffer::HandleType handleType = QAbstractVideoBuffer::NoHandle) const override
+ QVideoFrame::HandleType handleType = QVideoFrame::NoHandle) const override
{
return supportedFormats.values(handleType);
}
@@ -84,7 +84,7 @@ public:
/* fun to generate supportedFormatsChanged signal */
QList<QVideoFrame::PixelFormat> supportedPixelFormatsChange(QList<QVideoFrame::PixelFormat> formats)
{
- supportedFormats.insert(QAbstractVideoBuffer::NoHandle, QVideoFrame::Format_RGB32);
+ supportedFormats.insert(QVideoFrame::NoHandle, QVideoFrame::Format_RGB32);
QList<QVideoFrame::PixelFormat> supportedFormats = supportedPixelFormats();
if (supportedFormats.count() != formats.count()) {
emit supportedFormatsChanged();
@@ -175,20 +175,20 @@ void tst_QAbstractVideoSurface::isFormatSupported_data()
<< QVideoSurfaceFormat(
QSize(800, 600),
QVideoFrame::Format_RGB32,
- QAbstractVideoBuffer::GLTextureHandle)
+ QVideoFrame::GLTextureHandle)
<< false;
QTest::newRow("no formats: rgb24 gl")
<< formats
<< QVideoSurfaceFormat(
QSize(800, 600),
QVideoFrame::Format_RGB24,
- QAbstractVideoBuffer::GLTextureHandle)
+ QVideoFrame::GLTextureHandle)
<< false;
- formats.insert(QAbstractVideoBuffer::NoHandle, QVideoFrame::Format_RGB32);
- formats.insert(QAbstractVideoBuffer::NoHandle, QVideoFrame::Format_RGB24);
- formats.insert(QAbstractVideoBuffer::NoHandle, QVideoFrame::Format_YUV444);
- formats.insert(QAbstractVideoBuffer::GLTextureHandle, QVideoFrame::Format_RGB32);
+ formats.insert(QVideoFrame::NoHandle, QVideoFrame::Format_RGB32);
+ formats.insert(QVideoFrame::NoHandle, QVideoFrame::Format_RGB24);
+ formats.insert(QVideoFrame::NoHandle, QVideoFrame::Format_YUV444);
+ formats.insert(QVideoFrame::GLTextureHandle, QVideoFrame::Format_RGB32);
QTest::newRow("supported: rgb32")
<< formats
@@ -207,25 +207,25 @@ void tst_QAbstractVideoSurface::isFormatSupported_data()
<< QVideoSurfaceFormat(
QSize(800, 600),
QVideoFrame::Format_RGB32,
- QAbstractVideoBuffer::GLTextureHandle)
+ QVideoFrame::GLTextureHandle)
<< true;
QTest::newRow("unsupported: rgb24 gl")
<< formats
<< QVideoSurfaceFormat(
QSize(800, 600),
QVideoFrame::Format_RGB24,
- QAbstractVideoBuffer::GLTextureHandle)
+ QVideoFrame::GLTextureHandle)
<< false;
QTest::newRow("unsupported: yv12 gl")
<< formats
<< QVideoSurfaceFormat(
QSize(800, 600),
QVideoFrame::Format_YV12,
- QAbstractVideoBuffer::GLTextureHandle)
+ QVideoFrame::GLTextureHandle)
<< false;
- formats.insert(QAbstractVideoBuffer::NoHandle, QVideoFrame::Format_YV12);
- formats.insert(QAbstractVideoBuffer::GLTextureHandle, QVideoFrame::Format_RGB24);
+ formats.insert(QVideoFrame::NoHandle, QVideoFrame::Format_YV12);
+ formats.insert(QVideoFrame::GLTextureHandle, QVideoFrame::Format_RGB24);
QTest::newRow("supported: yv12")
<< formats
@@ -236,7 +236,7 @@ void tst_QAbstractVideoSurface::isFormatSupported_data()
<< QVideoSurfaceFormat(
QSize(800, 600),
QVideoFrame::Format_RGB24,
- QAbstractVideoBuffer::GLTextureHandle)
+ QVideoFrame::GLTextureHandle)
<< true;
}
@@ -280,7 +280,7 @@ void tst_QAbstractVideoSurface::start_data()
QTest::newRow("rgb32 gl") << QVideoSurfaceFormat(
QSize(800, 600),
QVideoFrame::Format_RGB32,
- QAbstractVideoBuffer::GLTextureHandle);
+ QVideoFrame::GLTextureHandle);
}
void tst_QAbstractVideoSurface::start()
@@ -373,7 +373,7 @@ void tst_QAbstractVideoSurface::nativeResolution()
void tst_QAbstractVideoSurface::supportedFormatsChanged()
{
SupportedFormatMap formatMap;
- formatMap.insert(QAbstractVideoBuffer::NoHandle, QVideoFrame::Format_RGB24);
+ formatMap.insert(QVideoFrame::NoHandle, QVideoFrame::Format_RGB24);
QtTestVideoSurface surface(formatMap);
QSignalSpy spy(&surface, SIGNAL(supportedFormatsChanged()));
QList<QVideoFrame::PixelFormat> formats = surface.supportedPixelFormats();
diff --git a/tests/auto/unit/multimedia/qvideoframe/tst_qvideoframe.cpp b/tests/auto/unit/multimedia/qvideoframe/tst_qvideoframe.cpp
index 838af4457..376e93035 100644
--- a/tests/auto/unit/multimedia/qvideoframe/tst_qvideoframe.cpp
+++ b/tests/auto/unit/multimedia/qvideoframe/tst_qvideoframe.cpp
@@ -99,13 +99,13 @@ class QtTestDummyVideoBuffer : public QObject, public QAbstractVideoBuffer
Q_OBJECT
public:
QtTestDummyVideoBuffer()
- : QAbstractVideoBuffer(NoHandle) {}
- explicit QtTestDummyVideoBuffer(QAbstractVideoBuffer::HandleType type)
+ : QAbstractVideoBuffer(QVideoFrame::NoHandle) {}
+ explicit QtTestDummyVideoBuffer(QVideoFrame::HandleType type)
: QAbstractVideoBuffer(type) {}
- [[nodiscard]] MapMode mapMode() const override { return NotMapped; }
+ [[nodiscard]] QVideoFrame::MapMode mapMode() const override { return QVideoFrame::NotMapped; }
- MapData map(MapMode) override { return {}; }
+ MapData map(QVideoFrame::MapMode) override { return {}; }
void unmap() override {}
};
@@ -113,15 +113,15 @@ class QtTestVideoBuffer : public QAbstractVideoBuffer
{
public:
QtTestVideoBuffer()
- : QAbstractVideoBuffer(NoHandle)
+ : QAbstractVideoBuffer(QVideoFrame::NoHandle)
{}
- explicit QtTestVideoBuffer(QAbstractVideoBuffer::HandleType type)
+ explicit QtTestVideoBuffer(QVideoFrame::HandleType type)
: QAbstractVideoBuffer(type)
{}
- [[nodiscard]] MapMode mapMode() const override { return m_mapMode; }
+ [[nodiscard]] QVideoFrame::MapMode mapMode() const override { return m_mapMode; }
- MapData map(MapMode mode) override
+ MapData map(QVideoFrame::MapMode mode) override
{
m_mapMode = mode;
MapData mapData;
@@ -133,13 +133,13 @@ public:
}
return mapData;
}
- void unmap() override { m_mapMode = NotMapped; }
+ void unmap() override { m_mapMode = QVideoFrame::NotMapped; }
uchar *m_data[4];
int m_bytesPerLine[4];
int m_planeCount = 0;
int m_numBytes;
- MapMode m_mapMode = NotMapped;
+ QVideoFrame::MapMode m_mapMode = QVideoFrame::NotMapped;
};
tst_QVideoFrame::tst_QVideoFrame()
@@ -195,7 +195,7 @@ void tst_QVideoFrame::create()
QVideoFrame frame(bytes, size, bytesPerLine, pixelFormat);
QVERIFY(frame.isValid());
- QCOMPARE(frame.handleType(), QAbstractVideoBuffer::NoHandle);
+ QCOMPARE(frame.handleType(), QVideoFrame::NoHandle);
QCOMPARE(frame.handle(), QVariant());
QCOMPARE(frame.pixelFormat(), pixelFormat);
QCOMPARE(frame.size(), size);
@@ -234,7 +234,7 @@ void tst_QVideoFrame::createInvalid()
QVideoFrame frame(bytes, size, bytesPerLine, pixelFormat);
QVERIFY(!frame.isValid());
- QCOMPARE(frame.handleType(), QAbstractVideoBuffer::NoHandle);
+ QCOMPARE(frame.handleType(), QVideoFrame::NoHandle);
QCOMPARE(frame.handle(), QVariant());
QCOMPARE(frame.pixelFormat(), pixelFormat);
QCOMPARE(frame.size(), size);
@@ -246,27 +246,27 @@ void tst_QVideoFrame::createInvalid()
void tst_QVideoFrame::createFromBuffer_data()
{
- QTest::addColumn<QAbstractVideoBuffer::HandleType>("handleType");
+ QTest::addColumn<QVideoFrame::HandleType>("handleType");
QTest::addColumn<QSize>("size");
QTest::addColumn<QVideoFrame::PixelFormat>("pixelFormat");
QTest::newRow("64x64 ARGB32 no handle")
- << QAbstractVideoBuffer::NoHandle
+ << QVideoFrame::NoHandle
<< QSize(64, 64)
<< QVideoFrame::Format_ARGB32;
QTest::newRow("64x64 ARGB32 gl handle")
- << QAbstractVideoBuffer::GLTextureHandle
+ << QVideoFrame::GLTextureHandle
<< QSize(64, 64)
<< QVideoFrame::Format_ARGB32;
- QTest::newRow("64x64 ARGB32 user handle")
- << QAbstractVideoBuffer::UserHandle
+ QTest::newRow("64x64 ARGB32 pixmap handle")
+ << QVideoFrame::QPixmapHandle
<< QSize(64, 64)
<< QVideoFrame::Format_ARGB32;
}
void tst_QVideoFrame::createFromBuffer()
{
- QFETCH(QAbstractVideoBuffer::HandleType, handleType);
+ QFETCH(QVideoFrame::HandleType, handleType);
QFETCH(QSize, size);
QFETCH(QVideoFrame::PixelFormat, pixelFormat);
@@ -313,7 +313,7 @@ void tst_QVideoFrame::createFromImage()
QVideoFrame frame(image);
QVERIFY(frame.isValid());
- QCOMPARE(frame.handleType(), QAbstractVideoBuffer::NoHandle);
+ QCOMPARE(frame.handleType(), QVideoFrame::NoHandle);
QCOMPARE(frame.pixelFormat(), pixelFormat);
QCOMPARE(frame.size(), size);
QCOMPARE(frame.width(), size.width());
@@ -329,7 +329,7 @@ void tst_QVideoFrame::createFromIncompatibleImage()
QVideoFrame frame(image);
QVERIFY(!frame.isValid());
- QCOMPARE(frame.handleType(), QAbstractVideoBuffer::NoHandle);
+ QCOMPARE(frame.handleType(), QVideoFrame::NoHandle);
QCOMPARE(frame.pixelFormat(), QVideoFrame::Format_Invalid);
QCOMPARE(frame.size(), QSize(64, 64));
QCOMPARE(frame.width(), 64);
@@ -345,17 +345,17 @@ void tst_QVideoFrame::createNull()
QVideoFrame frame;
QVERIFY(!frame.isValid());
- QCOMPARE(frame.handleType(), QAbstractVideoBuffer::NoHandle);
+ QCOMPARE(frame.handleType(), QVideoFrame::NoHandle);
QCOMPARE(frame.pixelFormat(), QVideoFrame::Format_Invalid);
QCOMPARE(frame.size(), QSize());
QCOMPARE(frame.width(), -1);
QCOMPARE(frame.height(), -1);
QCOMPARE(frame.startTime(), qint64(-1));
QCOMPARE(frame.endTime(), qint64(-1));
- QCOMPARE(frame.mapMode(), QAbstractVideoBuffer::NotMapped);
- QVERIFY(!frame.map(QAbstractVideoBuffer::ReadOnly));
- QVERIFY(!frame.map(QAbstractVideoBuffer::ReadWrite));
- QVERIFY(!frame.map(QAbstractVideoBuffer::WriteOnly));
+ QCOMPARE(frame.mapMode(), QVideoFrame::NotMapped);
+ QVERIFY(!frame.map(QVideoFrame::ReadOnly));
+ QVERIFY(!frame.map(QVideoFrame::ReadWrite));
+ QVERIFY(!frame.map(QVideoFrame::WriteOnly));
QCOMPARE(frame.isMapped(), false);
frame.unmap(); // Shouldn't crash
QCOMPARE(frame.isReadable(), false);
@@ -366,17 +366,17 @@ void tst_QVideoFrame::createNull()
{
QVideoFrame frame(nullptr, QSize(1024,768), QVideoFrame::Format_ARGB32);
QVERIFY(!frame.isValid());
- QCOMPARE(frame.handleType(), QAbstractVideoBuffer::NoHandle);
+ QCOMPARE(frame.handleType(), QVideoFrame::NoHandle);
QCOMPARE(frame.pixelFormat(), QVideoFrame::Format_ARGB32);
QCOMPARE(frame.size(), QSize(1024, 768));
QCOMPARE(frame.width(), 1024);
QCOMPARE(frame.height(), 768);
QCOMPARE(frame.startTime(), qint64(-1));
QCOMPARE(frame.endTime(), qint64(-1));
- QCOMPARE(frame.mapMode(), QAbstractVideoBuffer::NotMapped);
- QVERIFY(!frame.map(QAbstractVideoBuffer::ReadOnly));
- QVERIFY(!frame.map(QAbstractVideoBuffer::ReadWrite));
- QVERIFY(!frame.map(QAbstractVideoBuffer::WriteOnly));
+ QCOMPARE(frame.mapMode(), QVideoFrame::NotMapped);
+ QVERIFY(!frame.map(QVideoFrame::ReadOnly));
+ QVERIFY(!frame.map(QVideoFrame::ReadWrite));
+ QVERIFY(!frame.map(QVideoFrame::WriteOnly));
QCOMPARE(frame.isMapped(), false);
frame.unmap(); // Shouldn't crash
QCOMPARE(frame.isReadable(), false);
@@ -397,38 +397,38 @@ void tst_QVideoFrame::destructor()
void tst_QVideoFrame::copy_data()
{
- QTest::addColumn<QAbstractVideoBuffer::HandleType>("handleType");
+ QTest::addColumn<QVideoFrame::HandleType>("handleType");
QTest::addColumn<QSize>("size");
QTest::addColumn<QVideoFrame::PixelFormat>("pixelFormat");
QTest::addColumn<qint64>("startTime");
QTest::addColumn<qint64>("endTime");
QTest::newRow("64x64 ARGB32")
- << QAbstractVideoBuffer::GLTextureHandle
+ << QVideoFrame::GLTextureHandle
<< QSize(64, 64)
<< QVideoFrame::Format_ARGB32
<< qint64(63641740)
<< qint64(63641954);
QTest::newRow("64x64 ARGB32")
- << QAbstractVideoBuffer::GLTextureHandle
+ << QVideoFrame::GLTextureHandle
<< QSize(64, 64)
<< QVideoFrame::Format_ARGB32
<< qint64(63641740)
<< qint64(63641954);
QTest::newRow("32x256 YUV420P")
- << QAbstractVideoBuffer::UserHandle
+ << QVideoFrame::NoHandle
<< QSize(32, 256)
<< QVideoFrame::Format_YUV420P
<< qint64(12345)
<< qint64(12389);
QTest::newRow("1052x756 ARGB32")
- << QAbstractVideoBuffer::NoHandle
+ << QVideoFrame::NoHandle
<< QSize(1052, 756)
<< QVideoFrame::Format_ARGB32
<< qint64(12345)
<< qint64(12389);
QTest::newRow("32x256 YUV420P")
- << QAbstractVideoBuffer::UserHandle
+ << QVideoFrame::NoHandle
<< QSize(32, 256)
<< QVideoFrame::Format_YUV420P
<< qint64(12345)
@@ -437,7 +437,7 @@ void tst_QVideoFrame::copy_data()
void tst_QVideoFrame::copy()
{
- QFETCH(QAbstractVideoBuffer::HandleType, handleType);
+ QFETCH(QVideoFrame::HandleType, handleType);
QFETCH(QSize, size);
QFETCH(QVideoFrame::PixelFormat, pixelFormat);
QFETCH(qint64, startTime);
@@ -504,20 +504,20 @@ void tst_QVideoFrame::copy()
void tst_QVideoFrame::assign_data()
{
- QTest::addColumn<QAbstractVideoBuffer::HandleType>("handleType");
+ QTest::addColumn<QVideoFrame::HandleType>("handleType");
QTest::addColumn<QSize>("size");
QTest::addColumn<QVideoFrame::PixelFormat>("pixelFormat");
QTest::addColumn<qint64>("startTime");
QTest::addColumn<qint64>("endTime");
QTest::newRow("64x64 ARGB32")
- << QAbstractVideoBuffer::GLTextureHandle
+ << QVideoFrame::GLTextureHandle
<< QSize(64, 64)
<< QVideoFrame::Format_ARGB32
<< qint64(63641740)
<< qint64(63641954);
QTest::newRow("32x256 YUV420P")
- << QAbstractVideoBuffer::UserHandle
+ << QVideoFrame::NoHandle
<< QSize(32, 256)
<< QVideoFrame::Format_YUV420P
<< qint64(12345)
@@ -526,7 +526,7 @@ void tst_QVideoFrame::assign_data()
void tst_QVideoFrame::assign()
{
- QFETCH(QAbstractVideoBuffer::HandleType, handleType);
+ QFETCH(QVideoFrame::HandleType, handleType);
QFETCH(QSize, size);
QFETCH(QVideoFrame::PixelFormat, pixelFormat);
QFETCH(qint64, startTime);
@@ -583,7 +583,7 @@ void tst_QVideoFrame::assign()
QVERIFY(buffer.isNull());
QVERIFY(!frame.isValid());
- QCOMPARE(frame.handleType(), QAbstractVideoBuffer::NoHandle);
+ QCOMPARE(frame.handleType(), QVideoFrame::NoHandle);
QCOMPARE(frame.pixelFormat(), QVideoFrame::Format_Invalid);
QCOMPARE(frame.size(), QSize());
QCOMPARE(frame.width(), -1);
@@ -598,28 +598,28 @@ void tst_QVideoFrame::map_data()
QTest::addColumn<int>("mappedBytes");
QTest::addColumn<int>("bytesPerLine");
QTest::addColumn<QVideoFrame::PixelFormat>("pixelFormat");
- QTest::addColumn<QAbstractVideoBuffer::MapMode>("mode");
+ QTest::addColumn<QVideoFrame::MapMode>("mode");
QTest::newRow("read-only")
<< QSize(64, 64)
<< 16384
<< 256
<< QVideoFrame::Format_ARGB32
- << QAbstractVideoBuffer::ReadOnly;
+ << QVideoFrame::ReadOnly;
QTest::newRow("write-only")
<< QSize(64, 64)
<< 16384
<< 256
<< QVideoFrame::Format_ARGB32
- << QAbstractVideoBuffer::WriteOnly;
+ << QVideoFrame::WriteOnly;
QTest::newRow("read-write")
<< QSize(64, 64)
<< 16384
<< 256
<< QVideoFrame::Format_ARGB32
- << QAbstractVideoBuffer::ReadWrite;
+ << QVideoFrame::ReadWrite;
}
void tst_QVideoFrame::map()
@@ -628,22 +628,22 @@ void tst_QVideoFrame::map()
QFETCH(int, mappedBytes);
QFETCH(int, bytesPerLine);
QFETCH(QVideoFrame::PixelFormat, pixelFormat);
- QFETCH(QAbstractVideoBuffer::MapMode, mode);
+ QFETCH(QVideoFrame::MapMode, mode);
QVideoFrame frame(mappedBytes, size, bytesPerLine, pixelFormat);
QVERIFY(!frame.bits());
QCOMPARE(frame.mappedBytes(), 0);
QCOMPARE(frame.bytesPerLine(), 0);
- QCOMPARE(frame.mapMode(), QAbstractVideoBuffer::NotMapped);
+ QCOMPARE(frame.mapMode(), QVideoFrame::NotMapped);
QVERIFY(frame.map(mode));
// Mapping multiple times is allowed in ReadOnly mode
- if (mode == QAbstractVideoBuffer::ReadOnly) {
+ if (mode == QVideoFrame::ReadOnly) {
const uchar *bits = frame.bits();
- QVERIFY(frame.map(QAbstractVideoBuffer::ReadOnly));
+ QVERIFY(frame.map(QVideoFrame::ReadOnly));
QVERIFY(frame.isMapped());
QCOMPARE(frame.bits(), bits);
@@ -653,12 +653,12 @@ void tst_QVideoFrame::map()
QCOMPARE(frame.bits(), bits);
//re-mapping in Write or ReadWrite modes should fail
- QVERIFY(!frame.map(QAbstractVideoBuffer::WriteOnly));
- QVERIFY(!frame.map(QAbstractVideoBuffer::ReadWrite));
+ QVERIFY(!frame.map(QVideoFrame::WriteOnly));
+ QVERIFY(!frame.map(QVideoFrame::ReadWrite));
} else {
// Mapping twice in ReadWrite or WriteOnly modes should fail, but leave it mapped (and the mode is ignored)
QVERIFY(!frame.map(mode));
- QVERIFY(!frame.map(QAbstractVideoBuffer::ReadOnly));
+ QVERIFY(!frame.map(QVideoFrame::ReadOnly));
}
QVERIFY(frame.bits());
@@ -671,36 +671,36 @@ void tst_QVideoFrame::map()
QVERIFY(!frame.bits());
QCOMPARE(frame.mappedBytes(), 0);
QCOMPARE(frame.bytesPerLine(), 0);
- QCOMPARE(frame.mapMode(), QAbstractVideoBuffer::NotMapped);
+ QCOMPARE(frame.mapMode(), QVideoFrame::NotMapped);
}
void tst_QVideoFrame::mapImage_data()
{
QTest::addColumn<QSize>("size");
QTest::addColumn<QImage::Format>("format");
- QTest::addColumn<QAbstractVideoBuffer::MapMode>("mode");
+ QTest::addColumn<QVideoFrame::MapMode>("mode");
QTest::newRow("read-only")
<< QSize(64, 64)
<< QImage::Format_ARGB32
- << QAbstractVideoBuffer::ReadOnly;
+ << QVideoFrame::ReadOnly;
QTest::newRow("write-only")
<< QSize(15, 106)
<< QImage::Format_RGB32
- << QAbstractVideoBuffer::WriteOnly;
+ << QVideoFrame::WriteOnly;
QTest::newRow("read-write")
<< QSize(23, 111)
<< QImage::Format_RGB16
- << QAbstractVideoBuffer::ReadWrite;
+ << QVideoFrame::ReadWrite;
}
void tst_QVideoFrame::mapImage()
{
QFETCH(QSize, size);
QFETCH(QImage::Format, format);
- QFETCH(QAbstractVideoBuffer::MapMode, mode);
+ QFETCH(QVideoFrame::MapMode, mode);
QImage image(size.width(), size.height(), format);
@@ -709,7 +709,7 @@ void tst_QVideoFrame::mapImage()
QVERIFY(!frame.bits());
QCOMPARE(frame.mappedBytes(), 0);
QCOMPARE(frame.bytesPerLine(), 0);
- QCOMPARE(frame.mapMode(), QAbstractVideoBuffer::NotMapped);
+ QCOMPARE(frame.mapMode(), QVideoFrame::NotMapped);
QVERIFY(frame.map(mode));
@@ -723,7 +723,7 @@ void tst_QVideoFrame::mapImage()
QVERIFY(!frame.bits());
QCOMPARE(frame.mappedBytes(), 0);
QCOMPARE(frame.bytesPerLine(), 0);
- QCOMPARE(frame.mapMode(), QAbstractVideoBuffer::NotMapped);
+ QCOMPARE(frame.mapMode(), QVideoFrame::NotMapped);
}
void tst_QVideoFrame::mapPlanes_data()
@@ -794,7 +794,7 @@ void tst_QVideoFrame::mapPlanes()
QCOMPARE(strides.count(), offsets.count() + 1);
- QCOMPARE(frame.map(QAbstractVideoBuffer::ReadOnly), true);
+ QCOMPARE(frame.map(QVideoFrame::ReadOnly), true);
QCOMPARE(frame.planeCount(), strides.count());
QVERIFY(strides.count() > 0);
@@ -829,7 +829,7 @@ void tst_QVideoFrame::imageDetach()
QVideoFrame frame(image);
- QVERIFY(frame.map(QAbstractVideoBuffer::ReadWrite));
+ QVERIFY(frame.map(QVideoFrame::ReadWrite));
QImage frameImage(frame.bits(), 8, 8, frame.bytesPerLine(), QImage::Format_RGB32);
@@ -1030,7 +1030,7 @@ do { \
QVERIFY(!frame.isMapped()); \
QCOMPARE(frame.mappedBytes(), 0); \
QCOMPARE(frame.bytesPerLine(), 0); \
- QCOMPARE(frame.mapMode(), QAbstractVideoBuffer::NotMapped); \
+ QCOMPARE(frame.mapMode(), QVideoFrame::NotMapped); \
} while (0)
void tst_QVideoFrame::isMapped()
@@ -1041,23 +1041,23 @@ void tst_QVideoFrame::isMapped()
TEST_UNMAPPED(frame);
TEST_UNMAPPED(constFrame);
- QVERIFY(frame.map(QAbstractVideoBuffer::ReadOnly));
- TEST_MAPPED(frame, QAbstractVideoBuffer::ReadOnly);
- TEST_MAPPED(constFrame, QAbstractVideoBuffer::ReadOnly);
+ QVERIFY(frame.map(QVideoFrame::ReadOnly));
+ TEST_MAPPED(frame, QVideoFrame::ReadOnly);
+ TEST_MAPPED(constFrame, QVideoFrame::ReadOnly);
frame.unmap();
TEST_UNMAPPED(frame);
TEST_UNMAPPED(constFrame);
- QVERIFY(frame.map(QAbstractVideoBuffer::WriteOnly));
- TEST_MAPPED(frame, QAbstractVideoBuffer::WriteOnly);
- TEST_MAPPED(constFrame, QAbstractVideoBuffer::WriteOnly);
+ QVERIFY(frame.map(QVideoFrame::WriteOnly));
+ TEST_MAPPED(frame, QVideoFrame::WriteOnly);
+ TEST_MAPPED(constFrame, QVideoFrame::WriteOnly);
frame.unmap();
TEST_UNMAPPED(frame);
TEST_UNMAPPED(constFrame);
- QVERIFY(frame.map(QAbstractVideoBuffer::ReadWrite));
- TEST_MAPPED(frame, QAbstractVideoBuffer::ReadWrite);
- TEST_MAPPED(constFrame, QAbstractVideoBuffer::ReadWrite);
+ QVERIFY(frame.map(QVideoFrame::ReadWrite));
+ TEST_MAPPED(frame, QVideoFrame::ReadWrite);
+ TEST_MAPPED(constFrame, QVideoFrame::ReadWrite);
frame.unmap();
TEST_UNMAPPED(frame);
TEST_UNMAPPED(constFrame);
@@ -1070,17 +1070,17 @@ void tst_QVideoFrame::isReadable()
QVERIFY(!frame.isMapped());
QVERIFY(!frame.isReadable());
- QVERIFY(frame.map(QAbstractVideoBuffer::ReadOnly));
+ QVERIFY(frame.map(QVideoFrame::ReadOnly));
QVERIFY(frame.isMapped());
QVERIFY(frame.isReadable());
frame.unmap();
- QVERIFY(frame.map(QAbstractVideoBuffer::WriteOnly));
+ QVERIFY(frame.map(QVideoFrame::WriteOnly));
QVERIFY(frame.isMapped());
QVERIFY(!frame.isReadable());
frame.unmap();
- QVERIFY(frame.map(QAbstractVideoBuffer::ReadWrite));
+ QVERIFY(frame.map(QVideoFrame::ReadWrite));
QVERIFY(frame.isMapped());
QVERIFY(frame.isReadable());
frame.unmap();
@@ -1093,17 +1093,17 @@ void tst_QVideoFrame::isWritable()
QVERIFY(!frame.isMapped());
QVERIFY(!frame.isWritable());
- QVERIFY(frame.map(QAbstractVideoBuffer::ReadOnly));
+ QVERIFY(frame.map(QVideoFrame::ReadOnly));
QVERIFY(frame.isMapped());
QVERIFY(!frame.isWritable());
frame.unmap();
- QVERIFY(frame.map(QAbstractVideoBuffer::WriteOnly));
+ QVERIFY(frame.map(QVideoFrame::WriteOnly));
QVERIFY(frame.isMapped());
QVERIFY(frame.isWritable());
frame.unmap();
- QVERIFY(frame.map(QAbstractVideoBuffer::ReadWrite));
+ QVERIFY(frame.map(QVideoFrame::ReadWrite));
QVERIFY(frame.isMapped());
QVERIFY(frame.isWritable());
frame.unmap();
@@ -1280,7 +1280,7 @@ void tst_QVideoFrame::emptyData()
QVideoFrame f(new QMemoryVideoBuffer(data, 600),
QSize(800, 600),
QVideoFrame::Format_ARGB32);
- QVERIFY(!f.map(QAbstractVideoBuffer::ReadOnly));
+ QVERIFY(!f.map(QVideoFrame::ReadOnly));
}
QTEST_MAIN(tst_QVideoFrame)
diff --git a/tests/auto/unit/multimedia/qvideosurfaceformat/tst_qvideosurfaceformat.cpp b/tests/auto/unit/multimedia/qvideosurfaceformat/tst_qvideosurfaceformat.cpp
index e3a9b3822..779f8433a 100644
--- a/tests/auto/unit/multimedia/qvideosurfaceformat/tst_qvideosurfaceformat.cpp
+++ b/tests/auto/unit/multimedia/qvideosurfaceformat/tst_qvideosurfaceformat.cpp
@@ -111,7 +111,7 @@ void tst_QVideoSurfaceFormat::constructNull()
QVideoSurfaceFormat format;
QVERIFY(!format.isValid());
- QCOMPARE(format.handleType(), QAbstractVideoBuffer::NoHandle);
+ QCOMPARE(format.handleType(), QVideoFrame::NoHandle);
QCOMPARE(format.pixelFormat(), QVideoFrame::Format_Invalid);
QCOMPARE(format.frameSize(), QSize());
QCOMPARE(format.frameWidth(), -1);
@@ -127,37 +127,37 @@ void tst_QVideoSurfaceFormat::construct_data()
{
QTest::addColumn<QSize>("frameSize");
QTest::addColumn<QVideoFrame::PixelFormat>("pixelFormat");
- QTest::addColumn<QAbstractVideoBuffer::HandleType>("handleType");
+ QTest::addColumn<QVideoFrame::HandleType>("handleType");
QTest::addColumn<bool>("valid");
QTest::newRow("32x32 rgb32 no handle")
<< QSize(32, 32)
<< QVideoFrame::Format_RGB32
- << QAbstractVideoBuffer::NoHandle
+ << QVideoFrame::NoHandle
<< true;
QTest::newRow("1024x768 YUV444 GL texture")
<< QSize(32, 32)
<< QVideoFrame::Format_YUV444
- << QAbstractVideoBuffer::GLTextureHandle
+ << QVideoFrame::GLTextureHandle
<< true;
QTest::newRow("32x32 invalid no handle")
<< QSize(32, 32)
<< QVideoFrame::Format_Invalid
- << QAbstractVideoBuffer::NoHandle
+ << QVideoFrame::NoHandle
<< false;
QTest::newRow("invalid size, rgb32 no handle")
<< QSize()
<< QVideoFrame::Format_RGB32
- << QAbstractVideoBuffer::NoHandle
+ << QVideoFrame::NoHandle
<< false;
QTest::newRow("0x0 rgb32 no handle")
<< QSize(0,0)
<< QVideoFrame::Format_RGB32
- << QAbstractVideoBuffer::NoHandle
+ << QVideoFrame::NoHandle
<< true;
}
@@ -165,7 +165,7 @@ void tst_QVideoSurfaceFormat::construct()
{
QFETCH(QSize, frameSize);
QFETCH(QVideoFrame::PixelFormat, pixelFormat);
- QFETCH(QAbstractVideoBuffer::HandleType, handleType);
+ QFETCH(QVideoFrame::HandleType, handleType);
QFETCH(bool, valid);
QRect viewport(QPoint(0, 0), frameSize);
@@ -173,7 +173,7 @@ void tst_QVideoSurfaceFormat::construct()
QVideoSurfaceFormat format(frameSize, pixelFormat, handleType);
QCOMPARE(format.handleType(), handleType);
- QCOMPARE(format.property("handleType").value<QAbstractVideoBuffer::HandleType>(), handleType);
+ QCOMPARE(format.property("handleType").value<QVideoFrame::HandleType>(), handleType);
QCOMPARE(format.pixelFormat(), pixelFormat);
QCOMPARE(format.property("pixelFormat").value<QVideoFrame::PixelFormat>(), pixelFormat);
QCOMPARE(format.frameSize(), frameSize);
@@ -583,13 +583,13 @@ void tst_QVideoSurfaceFormat::dynamicProperty()
void tst_QVideoSurfaceFormat::compare()
{
QVideoSurfaceFormat format1(
- QSize(16, 16), QVideoFrame::Format_RGB32, QAbstractVideoBuffer::GLTextureHandle);
+ QSize(16, 16), QVideoFrame::Format_RGB32, QVideoFrame::GLTextureHandle);
QVideoSurfaceFormat format2(
- QSize(16, 16), QVideoFrame::Format_RGB32, QAbstractVideoBuffer::GLTextureHandle);
+ QSize(16, 16), QVideoFrame::Format_RGB32, QVideoFrame::GLTextureHandle);
QVideoSurfaceFormat format3(
- QSize(32, 32), QVideoFrame::Format_YUV444, QAbstractVideoBuffer::GLTextureHandle);
+ QSize(32, 32), QVideoFrame::Format_YUV444, QVideoFrame::GLTextureHandle);
QVideoSurfaceFormat format4(
- QSize(16, 16), QVideoFrame::Format_RGB32, QAbstractVideoBuffer::UserHandle);
+ QSize(16, 16), QVideoFrame::Format_RGB32, QVideoFrame::NoHandle);
QCOMPARE(format1 == format2, true);
QCOMPARE(format1 != format2, false);
@@ -714,12 +714,12 @@ void tst_QVideoSurfaceFormat::compare()
void tst_QVideoSurfaceFormat::copy()
{
QVideoSurfaceFormat original(
- QSize(1024, 768), QVideoFrame::Format_ARGB32, QAbstractVideoBuffer::GLTextureHandle);
+ QSize(1024, 768), QVideoFrame::Format_ARGB32, QVideoFrame::GLTextureHandle);
original.setScanLineDirection(QVideoSurfaceFormat::BottomToTop);
QVideoSurfaceFormat copy(original);
- QCOMPARE(copy.handleType(), QAbstractVideoBuffer::GLTextureHandle);
+ QCOMPARE(copy.handleType(), QVideoFrame::GLTextureHandle);
QCOMPARE(copy.pixelFormat(), QVideoFrame::Format_ARGB32);
QCOMPARE(copy.frameSize(), QSize(1024, 768));
QCOMPARE(copy.scanLineDirection(), QVideoSurfaceFormat::BottomToTop);
@@ -740,15 +740,15 @@ void tst_QVideoSurfaceFormat::copy()
void tst_QVideoSurfaceFormat::assign()
{
QVideoSurfaceFormat copy(
- QSize(64, 64), QVideoFrame::Format_AYUV444, QAbstractVideoBuffer::UserHandle);
+ QSize(64, 64), QVideoFrame::Format_AYUV444, QVideoFrame::NoHandle);
QVideoSurfaceFormat original(
- QSize(1024, 768), QVideoFrame::Format_ARGB32, QAbstractVideoBuffer::GLTextureHandle);
+ QSize(1024, 768), QVideoFrame::Format_ARGB32, QVideoFrame::GLTextureHandle);
original.setScanLineDirection(QVideoSurfaceFormat::BottomToTop);
copy = original;
- QCOMPARE(copy.handleType(), QAbstractVideoBuffer::GLTextureHandle);
+ QCOMPARE(copy.handleType(), QVideoFrame::GLTextureHandle);
QCOMPARE(copy.pixelFormat(), QVideoFrame::Format_ARGB32);
QCOMPARE(copy.frameSize(), QSize(1024, 768));
QCOMPARE(copy.scanLineDirection(), QVideoSurfaceFormat::BottomToTop);
@@ -794,7 +794,7 @@ void tst_QVideoSurfaceFormat::copyAllParameters()
{
/* Create the instance and set all the parameters. */
QVideoSurfaceFormat original(
- QSize(1024, 768), QVideoFrame::Format_ARGB32, QAbstractVideoBuffer::GLTextureHandle);
+ QSize(1024, 768), QVideoFrame::Format_ARGB32, QVideoFrame::GLTextureHandle);
original.setScanLineDirection(QVideoSurfaceFormat::BottomToTop);
original.setViewport(QRect(0, 0, 1024, 1024));
@@ -806,7 +806,7 @@ void tst_QVideoSurfaceFormat::copyAllParameters()
have the same parameters. */
QVideoSurfaceFormat copy(original);
- QCOMPARE(copy.handleType(), QAbstractVideoBuffer::GLTextureHandle);
+ QCOMPARE(copy.handleType(), QVideoFrame::GLTextureHandle);
QCOMPARE(copy.pixelFormat(), QVideoFrame::Format_ARGB32);
QCOMPARE(copy.frameSize(), QSize(1024, 768));
QCOMPARE(copy.scanLineDirection(), QVideoSurfaceFormat::BottomToTop);
@@ -825,7 +825,7 @@ void tst_QVideoSurfaceFormat::assignAllParameters()
{
/* Create the instance and set all the parameters. */
QVideoSurfaceFormat copy(
- QSize(64, 64), QVideoFrame::Format_AYUV444, QAbstractVideoBuffer::UserHandle);
+ QSize(64, 64), QVideoFrame::Format_AYUV444, QVideoFrame::NoHandle);
copy.setScanLineDirection(QVideoSurfaceFormat::TopToBottom);
copy.setViewport(QRect(0, 0, 640, 320));
copy.setFrameRate(qreal(7.5));
@@ -834,7 +834,7 @@ void tst_QVideoSurfaceFormat::assignAllParameters()
/* Create the instance and set all the parameters. */
QVideoSurfaceFormat original(
- QSize(1024, 768), QVideoFrame::Format_ARGB32, QAbstractVideoBuffer::GLTextureHandle);
+ QSize(1024, 768), QVideoFrame::Format_ARGB32, QVideoFrame::GLTextureHandle);
original.setScanLineDirection(QVideoSurfaceFormat::BottomToTop);
original.setViewport(QRect(0, 0, 1024, 1024));
original.setFrameRate(qreal(15.0));
@@ -845,7 +845,7 @@ void tst_QVideoSurfaceFormat::assignAllParameters()
have the same parameters. */
copy = original;
- QCOMPARE(copy.handleType(), QAbstractVideoBuffer::GLTextureHandle);
+ QCOMPARE(copy.handleType(), QVideoFrame::GLTextureHandle);
QCOMPARE(copy.pixelFormat(), QVideoFrame::Format_ARGB32);
QCOMPARE(copy.frameSize(), QSize(1024, 768));
QCOMPARE(copy.scanLineDirection(), QVideoSurfaceFormat::BottomToTop);
@@ -863,10 +863,10 @@ void tst_QVideoSurfaceFormat::propertyEdgeCases()
{
// Test setting read only properties doesn't change anything
QVideoSurfaceFormat original(
- QSize(1024, 768), QVideoFrame::Format_ARGB32, QAbstractVideoBuffer::GLTextureHandle);
+ QSize(1024, 768), QVideoFrame::Format_ARGB32, QVideoFrame::GLTextureHandle);
- original.setProperty("handleType", QAbstractVideoBuffer::UserHandle);
- QCOMPARE(original.handleType(), QAbstractVideoBuffer::GLTextureHandle);
+ original.setProperty("handleType", QVideoFrame::NoHandle);
+ QCOMPARE(original.handleType(), QVideoFrame::GLTextureHandle);
original.setProperty("pixelFormat", QVideoFrame::Format_AYUV444);
QCOMPARE(original.pixelFormat(), QVideoFrame::Format_ARGB32);
diff --git a/tests/auto/unit/multimediawidgets/qgraphicsvideoitem/tst_qgraphicsvideoitem.cpp b/tests/auto/unit/multimediawidgets/qgraphicsvideoitem/tst_qgraphicsvideoitem.cpp
index 9f8558836..f7c5ae6a9 100644
--- a/tests/auto/unit/multimediawidgets/qgraphicsvideoitem/tst_qgraphicsvideoitem.cpp
+++ b/tests/auto/unit/multimediawidgets/qgraphicsvideoitem/tst_qgraphicsvideoitem.cpp
@@ -590,7 +590,7 @@ void tst_QGraphicsVideoItem::paint()
QVideoFrame frame(sizeof(rgb32ImageData), QSize(2, 2), 8, QVideoFrame::Format_RGB32);
- frame.map(QAbstractVideoBuffer::WriteOnly);
+ frame.map(QVideoFrame::WriteOnly);
memcpy(frame.bits(), rgb32ImageData, frame.mappedBytes());
frame.unmap();
@@ -633,7 +633,7 @@ void tst_QGraphicsVideoItem::paintSurface()
QVideoFrame frame(sizeof(rgb32ImageData), QSize(2, 2), 8, QVideoFrame::Format_RGB32);
- frame.map(QAbstractVideoBuffer::WriteOnly);
+ frame.map(QVideoFrame::WriteOnly);
memcpy(frame.bits(), rgb32ImageData, frame.mappedBytes());
frame.unmap();
diff --git a/tests/auto/unit/multimediawidgets/qpaintervideosurface/tst_qpaintervideosurface.cpp b/tests/auto/unit/multimediawidgets/qpaintervideosurface/tst_qpaintervideosurface.cpp
index 1715ef08a..944d40587 100644
--- a/tests/auto/unit/multimediawidgets/qpaintervideosurface/tst_qpaintervideosurface.cpp
+++ b/tests/auto/unit/multimediawidgets/qpaintervideosurface/tst_qpaintervideosurface.cpp
@@ -33,6 +33,7 @@
#include <QtWidgets/qapplication.h>
#include <qvideosurfaceformat.h>
+#include <qabstractvideobuffer.h>
#if QT_CONFIG(opengl)
#include <QOpenGLContext>
@@ -84,7 +85,7 @@ class QtTestGLVideoBuffer : public QAbstractVideoBuffer
{
public:
QtTestGLVideoBuffer()
- : QAbstractVideoBuffer(GLTextureHandle)
+ : QAbstractVideoBuffer(QVideoFrame::GLTextureHandle)
{
QOpenGLContext::currentContext()->functions()->glGenTextures(1, &m_textureId);
}
@@ -98,9 +99,9 @@ public:
[[nodiscard]] QVariant handle() const override { return m_textureId; }
- MapData map(MapMode) override { return {}; }
+ MapData map(QVideoFrame::MapMode) override { return {}; }
void unmap() override {}
- [[nodiscard]] MapMode mapMode() const override { return NotMapped; }
+ [[nodiscard]] QVideoFrame::MapMode mapMode() const override { return QVideoFrame::NotMapped; }
private:
GLuint m_textureId = 0;
@@ -112,12 +113,12 @@ class QtTestOpaqueVideoBuffer : public QAbstractVideoBuffer
{
public:
QtTestOpaqueVideoBuffer()
- : QAbstractVideoBuffer(UserHandle)
+ : QAbstractVideoBuffer(QVideoFrame::NoHandle)
{}
- MapData map(MapMode) override { return {}; }
+ MapData map(QVideoFrame::MapMode) override { return {}; }
void unmap() override {}
- [[nodiscard]] MapMode mapMode() const override { return NotMapped; }
+ [[nodiscard]] QVideoFrame::MapMode mapMode() const override { return QVideoFrame::NotMapped; }
};
void tst_QPainterVideoSurface::colors()
@@ -188,26 +189,26 @@ static const uchar yuvPlanarImageData[] =
void tst_QPainterVideoSurface::supportedFormat_data()
{
- QTest::addColumn<QAbstractVideoBuffer::HandleType>("handleType");
+ QTest::addColumn<QVideoFrame::HandleType>("handleType");
QTest::addColumn<QVideoFrame::PixelFormat>("pixelFormat");
QTest::addColumn<QSize>("frameSize");
QTest::addColumn<bool>("supportedPixelFormat");
QTest::addColumn<bool>("supportedFormat");
QTest::newRow("rgb32 640x480")
- << QAbstractVideoBuffer::NoHandle
+ << QVideoFrame::NoHandle
<< QVideoFrame::Format_RGB32
<< QSize(640, 480)
<< true
<< true;
QTest::newRow("rgb32 -640x480")
- << QAbstractVideoBuffer::NoHandle
+ << QVideoFrame::NoHandle
<< QVideoFrame::Format_RGB32
<< QSize(-640, 480)
<< true
<< false;
QTest::newRow("rgb24 1024x768")
- << QAbstractVideoBuffer::NoHandle
+ << QVideoFrame::NoHandle
<< QVideoFrame::Format_RGB24
<< QSize(1024, 768)
#if !defined(QT_OPENGL_ES)
@@ -218,7 +219,7 @@ void tst_QPainterVideoSurface::supportedFormat_data()
<< false;
#endif
QTest::newRow("rgb24 -1024x-768")
- << QAbstractVideoBuffer::NoHandle
+ << QVideoFrame::NoHandle
<< QVideoFrame::Format_RGB24
<< QSize(-1024, -768)
#if !defined(QT_OPENGL_ES)
@@ -228,98 +229,98 @@ void tst_QPainterVideoSurface::supportedFormat_data()
#endif
<< false;
QTest::newRow("rgb565 0x0")
- << QAbstractVideoBuffer::NoHandle
+ << QVideoFrame::NoHandle
<< QVideoFrame::Format_RGB565
<< QSize(0, 0)
<< true
<< false;
QTest::newRow("YUV420P 640x480")
- << QAbstractVideoBuffer::NoHandle
+ << QVideoFrame::NoHandle
<< QVideoFrame::Format_YUV420P
<< QSize(640, 480)
<< false
<< false;
QTest::newRow("YUV420P 640x-480")
- << QAbstractVideoBuffer::NoHandle
+ << QVideoFrame::NoHandle
<< QVideoFrame::Format_YUV420P
<< QSize(640, -480)
<< false
<< false;
QTest::newRow("Y8 640x480")
- << QAbstractVideoBuffer::NoHandle
+ << QVideoFrame::NoHandle
<< QVideoFrame::Format_Y8
<< QSize(640, 480)
<< false
<< false;
QTest::newRow("Texture: rgb32 640x480")
- << QAbstractVideoBuffer::GLTextureHandle
+ << QVideoFrame::GLTextureHandle
<< QVideoFrame::Format_RGB32
<< QSize(640, 480)
<< false
<< false;
QTest::newRow("Texture: rgb32 -640x480")
- << QAbstractVideoBuffer::GLTextureHandle
+ << QVideoFrame::GLTextureHandle
<< QVideoFrame::Format_RGB32
<< QSize(-640, 480)
<< false
<< false;
QTest::newRow("rgb565 32x32")
- << QAbstractVideoBuffer::NoHandle
+ << QVideoFrame::NoHandle
<< QVideoFrame::Format_RGB565
<< QSize(32, 32)
<< true
<< true;
QTest::newRow("rgb565 0x0")
- << QAbstractVideoBuffer::NoHandle
+ << QVideoFrame::NoHandle
<< QVideoFrame::Format_RGB565
<< QSize(0, 0)
<< true
<< false;
QTest::newRow("argb32 256x256")
- << QAbstractVideoBuffer::NoHandle
+ << QVideoFrame::NoHandle
<< QVideoFrame::Format_ARGB32
<< QSize(256, 256)
<< true
<< true;
QTest::newRow("Texture: rgb24 1024x768")
- << QAbstractVideoBuffer::GLTextureHandle
+ << QVideoFrame::GLTextureHandle
<< QVideoFrame::Format_RGB24
<< QSize(1024, 768)
<< false
<< false;
QTest::newRow("Texture: rgb24 -1024x-768")
- << QAbstractVideoBuffer::GLTextureHandle
+ << QVideoFrame::GLTextureHandle
<< QVideoFrame::Format_RGB24
<< QSize(-1024, -768)
<< false
<< false;
QTest::newRow("Texture: YUV420P 640x480")
- << QAbstractVideoBuffer::GLTextureHandle
+ << QVideoFrame::GLTextureHandle
<< QVideoFrame::Format_YUV420P
<< QSize(640, 480)
<< false
<< false;
QTest::newRow("Texture: YUV420P 640x-480")
- << QAbstractVideoBuffer::GLTextureHandle
+ << QVideoFrame::GLTextureHandle
<< QVideoFrame::Format_YUV420P
<< QSize(640, -480)
<< false
<< false;
QTest::newRow("User Buffer: rgb32 256x256")
- << QAbstractVideoBuffer::UserHandle
+ << QVideoFrame::NoHandle
<< QVideoFrame::Format_RGB32
<< QSize(256, 256)
<< false
<< false;
#if !defined(Q_OS_MAC)
QTest::newRow("Pixmap: rgb32 640x480")
- << QAbstractVideoBuffer::QPixmapHandle
+ << QVideoFrame::QPixmapHandle
<< QVideoFrame::Format_RGB32
<< QSize(640, 480)
<< true
<< true;
QTest::newRow("Pixmap: YUV420P 640x480")
- << QAbstractVideoBuffer::QPixmapHandle
+ << QVideoFrame::QPixmapHandle
<< QVideoFrame::Format_YUV420P
<< QSize(640, 480)
<< false
@@ -329,7 +330,7 @@ void tst_QPainterVideoSurface::supportedFormat_data()
void tst_QPainterVideoSurface::supportedFormat()
{
- QFETCH(QAbstractVideoBuffer::HandleType, handleType);
+ QFETCH(QVideoFrame::HandleType, handleType);
QFETCH(QVideoFrame::PixelFormat, pixelFormat);
QFETCH(QSize, frameSize);
QFETCH(bool, supportedPixelFormat);
@@ -455,7 +456,7 @@ void tst_QPainterVideoSurface::present()
QVideoFrame frameA(bytesA, frameSizeA, bytesPerLineA, pixelFormatA);
- frameA.map(QAbstractVideoBuffer::WriteOnly);
+ frameA.map(QVideoFrame::WriteOnly);
memcpy(frameA.bits(), frameDataA, frameA.mappedBytes());
frameA.unmap();
@@ -494,7 +495,7 @@ void tst_QPainterVideoSurface::present()
QVideoFrame frameB(bytesB, frameSizeB, bytesPerLineB, pixelFormatB);
- frameB.map(QAbstractVideoBuffer::WriteOnly);
+ frameB.map(QVideoFrame::WriteOnly);
memcpy(frameB.bits(), frameDataB, frameB.mappedBytes());
frameB.unmap();
@@ -720,7 +721,7 @@ void tst_QPainterVideoSurface::shaderTypeStarted()
void tst_QPainterVideoSurface::shaderSupportedFormat_data()
{
QTest::addColumn<QPainterVideoSurface::ShaderType>("shaderType");
- QTest::addColumn<QAbstractVideoBuffer::HandleType>("handleType");
+ QTest::addColumn<QVideoFrame::HandleType>("handleType");
QTest::addColumn<QVideoFrame::PixelFormat>("pixelFormat");
QTest::addColumn<QSize>("frameSize");
QTest::addColumn<bool>("supportedPixelFormat");
@@ -736,42 +737,42 @@ void tst_QPainterVideoSurface::shaderSupportedFormat_data()
for (const auto &type : types) {
QTest::newRow((type.second + "rgb32 640x480").constData())
<< type.first
- << QAbstractVideoBuffer::NoHandle
+ << QVideoFrame::NoHandle
<< QVideoFrame::Format_RGB32
<< QSize(640, 480)
<< true
<< true;
QTest::newRow((type.second + "rgb32 -640x480").constData())
<< type.first
- << QAbstractVideoBuffer::NoHandle
+ << QVideoFrame::NoHandle
<< QVideoFrame::Format_RGB32
<< QSize(-640, 480)
<< true
<< false;
QTest::newRow((type.second + "rgb565 32x32").constData())
<< type.first
- << QAbstractVideoBuffer::NoHandle
+ << QVideoFrame::NoHandle
<< QVideoFrame::Format_RGB565
<< QSize(32, 32)
<< true
<< true;
QTest::newRow((type.second + "rgb565 0x0").constData())
<< type.first
- << QAbstractVideoBuffer::NoHandle
+ << QVideoFrame::NoHandle
<< QVideoFrame::Format_RGB565
<< QSize(0, 0)
<< true
<< false;
QTest::newRow((type.second + "argb32 256x256").constData())
<< type.first
- << QAbstractVideoBuffer::NoHandle
+ << QVideoFrame::NoHandle
<< QVideoFrame::Format_ARGB32
<< QSize(256, 256)
<< true
<< true;
QTest::newRow((type.second + "rgb24 1024x768").constData())
<< type.first
- << QAbstractVideoBuffer::NoHandle
+ << QVideoFrame::NoHandle
<< QVideoFrame::Format_RGB24
<< QSize(1024, 768)
#if !defined(QT_OPENGL_ES)
@@ -783,7 +784,7 @@ void tst_QPainterVideoSurface::shaderSupportedFormat_data()
#endif
QTest::newRow((type.second + "rgb24 -1024x-768").constData())
<< type.first
- << QAbstractVideoBuffer::NoHandle
+ << QVideoFrame::NoHandle
<< QVideoFrame::Format_RGB24
<< QSize(-1024, -768)
#if !defined(QT_OPENGL_ES)
@@ -795,14 +796,14 @@ void tst_QPainterVideoSurface::shaderSupportedFormat_data()
#ifndef Q_OS_MAC
QTest::newRow((type.second + "YUV420P 640x480").constData())
<< type.first
- << QAbstractVideoBuffer::NoHandle
+ << QVideoFrame::NoHandle
<< QVideoFrame::Format_YUV420P
<< QSize(640, 480)
<< true
<< true;
QTest::newRow((type.second + "YUV420P 640x-480").constData())
<< type.first
- << QAbstractVideoBuffer::NoHandle
+ << QVideoFrame::NoHandle
<< QVideoFrame::Format_YUV420P
<< QSize(640, -480)
<< true
@@ -810,21 +811,21 @@ void tst_QPainterVideoSurface::shaderSupportedFormat_data()
#endif
QTest::newRow((type.second + "Y8 640x480").constData())
<< type.first
- << QAbstractVideoBuffer::NoHandle
+ << QVideoFrame::NoHandle
<< QVideoFrame::Format_Y8
<< QSize(640, 480)
<< false
<< false;
QTest::newRow((type.second + "Texture: rgb32 640x480").constData())
<< type.first
- << QAbstractVideoBuffer::GLTextureHandle
+ << QVideoFrame::GLTextureHandle
<< QVideoFrame::Format_RGB32
<< QSize(640, 480)
<< true
<< true;
QTest::newRow((type.second + "Texture: rgb32 -640x480").constData())
<< type.first
- << QAbstractVideoBuffer::GLTextureHandle
+ << QVideoFrame::GLTextureHandle
<< QVideoFrame::Format_RGB32
<< QSize(-640, 480)
<< true
@@ -832,14 +833,14 @@ void tst_QPainterVideoSurface::shaderSupportedFormat_data()
#ifndef Q_OS_MAC
QTest::newRow((type.second + "Texture: rgb565 32x32").constData())
<< type.first
- << QAbstractVideoBuffer::GLTextureHandle
+ << QVideoFrame::GLTextureHandle
<< QVideoFrame::Format_RGB565
<< QSize(32, 32)
<< false
<< false;
QTest::newRow((type.second + "Texture: rgb565 0x0").constData())
<< type.first
- << QAbstractVideoBuffer::GLTextureHandle
+ << QVideoFrame::GLTextureHandle
<< QVideoFrame::Format_RGB565
<< QSize(0, 0)
<< false
@@ -847,7 +848,7 @@ void tst_QPainterVideoSurface::shaderSupportedFormat_data()
#endif
QTest::newRow((type.second + "Texture argb32 256x256").constData())
<< type.first
- << QAbstractVideoBuffer::GLTextureHandle
+ << QVideoFrame::GLTextureHandle
<< QVideoFrame::Format_ARGB32
<< QSize(256, 256)
<< true
@@ -855,28 +856,28 @@ void tst_QPainterVideoSurface::shaderSupportedFormat_data()
#ifndef Q_OS_MAC
QTest::newRow((type.second + "Texture: rgb24 1024x768").constData())
<< type.first
- << QAbstractVideoBuffer::GLTextureHandle
+ << QVideoFrame::GLTextureHandle
<< QVideoFrame::Format_RGB24
<< QSize(1024, 768)
<< false
<< false;
QTest::newRow((type.second + "Texture: rgb24 -1024x-768").constData())
<< type.first
- << QAbstractVideoBuffer::GLTextureHandle
+ << QVideoFrame::GLTextureHandle
<< QVideoFrame::Format_RGB24
<< QSize(-1024, -768)
<< false
<< false;
QTest::newRow((type.second + "Texture: YUV420P 640x480").constData())
<< type.first
- << QAbstractVideoBuffer::GLTextureHandle
+ << QVideoFrame::GLTextureHandle
<< QVideoFrame::Format_YUV420P
<< QSize(640, 480)
<< false
<< false;
QTest::newRow((type.second + "Texture: YUV420P 640x-480").constData())
<< type.first
- << QAbstractVideoBuffer::GLTextureHandle
+ << QVideoFrame::GLTextureHandle
<< QVideoFrame::Format_YUV420P
<< QSize(640, -480)
<< false
@@ -884,7 +885,7 @@ void tst_QPainterVideoSurface::shaderSupportedFormat_data()
#endif
QTest::newRow(type.second + "User Buffer: rgb32 256x256")
<< type.first
- << QAbstractVideoBuffer::UserHandle
+ << QVideoFrame::NoHandle
<< QVideoFrame::Format_RGB32
<< QSize(256, 256)
<< false
@@ -895,7 +896,7 @@ void tst_QPainterVideoSurface::shaderSupportedFormat_data()
void tst_QPainterVideoSurface::shaderSupportedFormat()
{
QFETCH(QPainterVideoSurface::ShaderType, shaderType);
- QFETCH(QAbstractVideoBuffer::HandleType, handleType);
+ QFETCH(QVideoFrame::HandleType, handleType);
QFETCH(QVideoFrame::PixelFormat, pixelFormat);
QFETCH(QSize, frameSize);
QFETCH(bool, supportedPixelFormat);
@@ -1065,7 +1066,7 @@ void tst_QPainterVideoSurface::shaderPresent()
QVideoFrame frameA(bytesA, frameSizeA, bytesPerLineA, pixelFormatA);
- frameA.map(QAbstractVideoBuffer::WriteOnly);
+ frameA.map(QVideoFrame::WriteOnly);
memcpy(frameA.bits(), frameDataA, frameA.mappedBytes());
frameA.unmap();
@@ -1106,7 +1107,7 @@ void tst_QPainterVideoSurface::shaderPresent()
QVideoFrame frameB(bytesB, frameSizeB, bytesPerLineB, pixelFormatB);
- frameB.map(QAbstractVideoBuffer::WriteOnly);
+ frameB.map(QVideoFrame::WriteOnly);
memcpy(frameB.bits(), frameDataB, frameB.mappedBytes());
frameB.unmap();
@@ -1231,7 +1232,7 @@ void tst_QPainterVideoSurface::shaderPresentGLFrame()
QSKIP("Shader type couldn't be set");
QVideoSurfaceFormat format(
- QSize(2, 2), QVideoFrame::Format_RGB32, QAbstractVideoBuffer::GLTextureHandle);
+ QSize(2, 2), QVideoFrame::Format_RGB32, QVideoFrame::GLTextureHandle);
QVERIFY(surface.start(format));
QCOMPARE(surface.isActive(), true);
diff --git a/tests/auto/unit/multimediawidgets/qvideowidget/tst_qvideowidget.cpp b/tests/auto/unit/multimediawidgets/qvideowidget/tst_qvideowidget.cpp
index ab4557f24..f2d1a249b 100644
--- a/tests/auto/unit/multimediawidgets/qvideowidget/tst_qvideowidget.cpp
+++ b/tests/auto/unit/multimediawidgets/qvideowidget/tst_qvideowidget.cpp
@@ -676,7 +676,7 @@ void tst_QVideoWidget::paintRendererControl()
QVideoFrame frame(sizeof(rgb32ImageData), QSize(2, 2), 8, QVideoFrame::Format_RGB32);
- frame.map(QAbstractVideoBuffer::WriteOnly);
+ frame.map(QVideoFrame::WriteOnly);
memcpy(frame.bits(), rgb32ImageData, frame.mappedBytes());
frame.unmap();
@@ -706,7 +706,7 @@ void tst_QVideoWidget::paintSurface()
QCOMPARE(surface->isActive(), true);
QVideoFrame frame(sizeof(rgb32ImageData), QSize(2, 2), 8, QVideoFrame::Format_RGB32);
- frame.map(QAbstractVideoBuffer::WriteOnly);
+ frame.map(QVideoFrame::WriteOnly);
memcpy(frame.bits(), rgb32ImageData, frame.mappedBytes());
frame.unmap();
diff --git a/tests/auto/unit/qml/qdeclarativeaudio/tst_qdeclarativeaudio.cpp b/tests/auto/unit/qml/qdeclarativeaudio/tst_qdeclarativeaudio.cpp
index f456e302d..20e597077 100644
--- a/tests/auto/unit/qml/qdeclarativeaudio/tst_qdeclarativeaudio.cpp
+++ b/tests/auto/unit/qml/qdeclarativeaudio/tst_qdeclarativeaudio.cpp
@@ -916,7 +916,7 @@ int tst_QDeclarativeAudio::keyToValue(const QMetaEnum &enumeration, const char *
struct Surface : QAbstractVideoSurface
{
Surface(QObject *parent = nullptr) : QAbstractVideoSurface(parent) { }
- [[nodiscard]] QList<QVideoFrame::PixelFormat> supportedPixelFormats(QAbstractVideoBuffer::HandleType) const override
+ [[nodiscard]] QList<QVideoFrame::PixelFormat> supportedPixelFormats(QVideoFrame::HandleType) const override
{
return QList<QVideoFrame::PixelFormat>() << QVideoFrame::Format_RGB32;
}