diff options
author | Lars Knoll <lars.knoll@qt.io> | 2021-03-24 21:37:55 +0100 |
---|---|---|
committer | Lars Knoll <lars.knoll@qt.io> | 2021-04-07 12:24:44 +0000 |
commit | 9e90ac3ce400df30217de98f0eb4e08f75e06cdf (patch) | |
tree | df5844843df9785c69d970e2976a8762b1f165ef /src/multimedia/video | |
parent | 3769db3e753bcb4bb8cd76d71a1ab148cb3fccbb (diff) |
More work to enable HW decoding for Qt Quick
Request GL textures from the pipeline for now. Some initial code
to also use the texture upload meta functionality in gstreamer,
but that will require some more work so we don't make the GL
context current in the wrong thread.
The gstreamer VAAPI elements on AMD hardware (or in general...)
seem to have some bugs. Converting a VASurface to a GL texture
using the texture upload meta doesn't create an ARGB texture as
promised, but does write some YUV data into the texture. And
trying to map a SW buffer received from the VAAPI decoders fails.
Change-Id: I9b629eb84f3f32adc23ae2e2fd1cd3e42e6afbc0
Reviewed-by: Doris Verria <doris.verria@qt.io>
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
Diffstat (limited to 'src/multimedia/video')
-rw-r--r-- | src/multimedia/video/qabstractvideobuffer.cpp | 14 | ||||
-rw-r--r-- | src/multimedia/video/qabstractvideobuffer_p.h | 5 | ||||
-rw-r--r-- | src/multimedia/video/qvideoframe.cpp | 16 | ||||
-rw-r--r-- | src/multimedia/video/qvideoframe.h | 2 | ||||
-rw-r--r-- | src/multimedia/video/qvideosink.cpp | 3 |
5 files changed, 15 insertions, 25 deletions
diff --git a/src/multimedia/video/qabstractvideobuffer.cpp b/src/multimedia/video/qabstractvideobuffer.cpp index bfb97a8fd..db43beb81 100644 --- a/src/multimedia/video/qabstractvideobuffer.cpp +++ b/src/multimedia/video/qabstractvideobuffer.cpp @@ -104,8 +104,9 @@ QT_BEGIN_NAMESPACE /*! Constructs an abstract video buffer of the given \a type. */ -QAbstractVideoBuffer::QAbstractVideoBuffer(QVideoFrame::HandleType type) - : m_type(type) +QAbstractVideoBuffer::QAbstractVideoBuffer(QVideoFrame::HandleType type, QRhi *rhi) + : m_type(type), + rhi(rhi) { } @@ -173,17 +174,12 @@ QVideoFrame::HandleType QAbstractVideoBuffer::handleType() const \sa map() */ -/*! - Returns a type specific handle to the data buffer. +/*! \fn quint64 QAbstractVideoBuffer::textureHandle(QRhi *rhi, int plane) const - The type of the handle is given by handleType() function. + Returns a texture handle to the data buffer. \sa handleType() */ -QVariant QAbstractVideoBuffer::handle() const -{ - return QVariant(); -} /*! \fn int QAbstractPlanarVideoBuffer::map(MapMode mode, int *numBytes, int bytesPerLine[4], uchar *data[4]) diff --git a/src/multimedia/video/qabstractvideobuffer_p.h b/src/multimedia/video/qabstractvideobuffer_p.h index e3a0fb86c..a82f13723 100644 --- a/src/multimedia/video/qabstractvideobuffer_p.h +++ b/src/multimedia/video/qabstractvideobuffer_p.h @@ -60,11 +60,12 @@ QT_BEGIN_NAMESPACE class QVariant; +class QRhi; class Q_MULTIMEDIA_EXPORT QAbstractVideoBuffer { public: - QAbstractVideoBuffer(QVideoFrame::HandleType type); + QAbstractVideoBuffer(QVideoFrame::HandleType type, QRhi *rhi = nullptr); virtual ~QAbstractVideoBuffer(); QVideoFrame::HandleType handleType() const; @@ -81,11 +82,11 @@ public: virtual MapData map(QVideoFrame::MapMode mode) = 0; virtual void unmap() = 0; - virtual QVariant handle() const; virtual quint64 textureHandle(int /*plane*/) const { return 0; } protected: QVideoFrame::HandleType m_type; + QRhi *rhi = nullptr; private: Q_DISABLE_COPY(QAbstractVideoBuffer) diff --git a/src/multimedia/video/qvideoframe.cpp b/src/multimedia/video/qvideoframe.cpp index 375f19930..2fa5f9f88 100644 --- a/src/multimedia/video/qvideoframe.cpp +++ b/src/multimedia/video/qvideoframe.cpp @@ -808,21 +808,13 @@ int QVideoFrame::planeCount() const return d->format.nPlanes(); } -quint64 QVideoFrame::textureHandle(int plane) -{ - return d->buffer->textureHandle(plane); -} - /*! - Returns a type specific handle to a video frame's buffer. - - For an OpenGL texture this would be the texture ID. - - \sa QAbstractVideoBuffer::handle() + \internal + Returns a texture id to the video frame's buffers. */ -QVariant QVideoFrame::handle() const +quint64 QVideoFrame::textureHandle(int plane) { - return d->buffer != nullptr ? d->buffer->handle() : QVariant(); + return d->buffer->textureHandle(plane); } /*! diff --git a/src/multimedia/video/qvideoframe.h b/src/multimedia/video/qvideoframe.h index 5e90b6ca1..ea01ccb92 100644 --- a/src/multimedia/video/qvideoframe.h +++ b/src/multimedia/video/qvideoframe.h @@ -115,8 +115,6 @@ public: quint64 textureHandle(int plane); - QVariant handle() const; - qint64 startTime() const; void setStartTime(qint64 time); diff --git a/src/multimedia/video/qvideosink.cpp b/src/multimedia/video/qvideosink.cpp index f5112b173..b996392b4 100644 --- a/src/multimedia/video/qvideosink.cpp +++ b/src/multimedia/video/qvideosink.cpp @@ -126,7 +126,10 @@ QRhi *QVideoSink::rhi() const void QVideoSink::setRhi(QRhi *rhi) { + if (d->rhi == rhi) + return; d->rhi = rhi; + d->videoSink->setRhi(rhi); } void QVideoSink::setFullScreen(bool fullscreen) |