summaryrefslogtreecommitdiffstats
path: root/examples/multimedia/video
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 /examples/multimedia/video
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>
Diffstat (limited to 'examples/multimedia/video')
-rw-r--r--examples/multimedia/video/qmlvideofilter_opencl/main.cpp12
-rw-r--r--examples/multimedia/video/qmlvideofilter_opencl/rgbframehelper.h6
2 files changed, 9 insertions, 9 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();