summaryrefslogtreecommitdiffstats
path: root/src/multimedia/video/qvideosurfaceformat.cpp
diff options
context:
space:
mode:
authorLars Knoll <lars.knoll@qt.io>2021-03-24 13:05:41 +0100
committerLars Knoll <lars.knoll@qt.io>2021-04-06 08:20:31 +0000
commit3c4be415b55e0ea67eb17b30cc50f9f3e64a775d (patch)
tree92ea2d1bcb74d338f1e978854fac091a388312b9 /src/multimedia/video/qvideosurfaceformat.cpp
parent80c24e91131362d33555465ca4675a2cb009add4 (diff)
Start adding infrastructure to retrieve video frames as texture
We're using RHI here, as that's what we need for Qt Quick anyway. You can now set a QRhi object on QVideoSink. This can then be used internally to create textures of the required format instead of memory buffers. QVideoSurfaceFormat will now tell you how many planes are required for the format, and you can retrieve the textures for each plane from QVideoFrame. Change-Id: I86430db60a8f1aba07ec3b38e22b977cdaefaa0a Reviewed-by: Doris Verria <doris.verria@qt.io> Reviewed-by: Lars Knoll <lars.knoll@qt.io>
Diffstat (limited to 'src/multimedia/video/qvideosurfaceformat.cpp')
-rw-r--r--src/multimedia/video/qvideosurfaceformat.cpp46
1 files changed, 46 insertions, 0 deletions
diff --git a/src/multimedia/video/qvideosurfaceformat.cpp b/src/multimedia/video/qvideosurfaceformat.cpp
index 3ba143079..ad83aa954 100644
--- a/src/multimedia/video/qvideosurfaceformat.cpp
+++ b/src/multimedia/video/qvideosurfaceformat.cpp
@@ -251,6 +251,52 @@ int QVideoSurfaceFormat::frameHeight() const
return d->frameSize.height();
}
+int QVideoSurfaceFormat::nPlanes() const
+{
+ switch (d->pixelFormat) {
+ case Format_Invalid:
+ case Format_ARGB32:
+ case Format_ARGB32_Premultiplied:
+ case Format_RGB32:
+ case Format_RGB24:
+ case Format_RGB565:
+ case Format_RGB555:
+ case Format_ARGB8565_Premultiplied:
+ case Format_BGRA32:
+ case Format_BGRA32_Premultiplied:
+ case Format_ABGR32:
+ case Format_BGR32:
+ case Format_BGR24:
+ case Format_BGR565:
+ case Format_BGR555:
+ case Format_BGRA5658_Premultiplied:
+ case Format_AYUV444:
+ case Format_AYUV444_Premultiplied:
+ case Format_YUV444:
+ case Format_UYVY:
+ case Format_YUYV:
+ case Format_Y8:
+ case Format_Y16:
+ case Format_Jpeg:
+ return 1;
+ case Format_NV12:
+ case Format_NV21:
+ case Format_IMC2:
+ case Format_IMC4:
+ case Format_P010LE:
+ case Format_P010BE:
+ case Format_P016LE:
+ case Format_P016BE:
+ return 2;
+ case Format_YUV420P:
+ case Format_YUV422P:
+ case Format_YV12:
+ case Format_IMC1:
+ case Format_IMC3:
+ return 3;
+ }
+}
+
/*!
Sets the size of frames in a video stream to \a size.