summaryrefslogtreecommitdiffstats
path: root/src/multimedia/video/qvideoframe.cpp
diff options
context:
space:
mode:
authorPiotr Srebrny <piotr.srebrny@qt.io>2022-03-23 12:33:59 +0100
committerPiotr Srebrny <piotr.srebrny@qt.io>2022-03-24 14:15:15 +0100
commit0f93554536655e8841d137a330f7048e747d0989 (patch)
tree3fdb9c77f229b51a57eef4ab0306ceb76562727f /src/multimedia/video/qvideoframe.cpp
parent71ff0feb8b6fee4182c90ff94be56c9b73e1c615 (diff)
Provide QRhiTexture from QVideoFrame on windows backend
This patch implements a converion of OpenGL and D3D11 texture handles to QRhiTexture in when creating the QVideoFrame on the Windows backend. Additional, the patch explicitly states that the only supported fromats are RGB8. D3D9 can use also RGB5 and RGB10A2. However, the RHI side does not support RGB5. RGB10A2 could be added if required. Change-Id: I4fa46988e7402926c99159ca5fbd597f1821eab0 Reviewed-by: Lars Knoll <lars.knoll@qt.io>
Diffstat (limited to 'src/multimedia/video/qvideoframe.cpp')
-rw-r--r--src/multimedia/video/qvideoframe.cpp7
1 files changed, 5 insertions, 2 deletions
diff --git a/src/multimedia/video/qvideoframe.cpp b/src/multimedia/video/qvideoframe.cpp
index b639bafae..6ad601c5e 100644
--- a/src/multimedia/video/qvideoframe.cpp
+++ b/src/multimedia/video/qvideoframe.cpp
@@ -655,9 +655,12 @@ quint64 QVideoFrame::textureHandle(int plane) const
\internal
Returns a QRhiTexture of the video frame
*/
-std::unique_ptr<QRhiTexture> QVideoFrame::rhiTexture(int /* plane */) const
+std::unique_ptr<QRhiTexture> QVideoFrame::rhiTexture(int plane) const
{
- return {};
+ if (!d || !d->buffer)
+ return {};
+ d->buffer->mapTextures();
+ return d->buffer->texture(plane);
}
/*!