diff options
Diffstat (limited to 'src/plugins/multimedia/qnx/mediaplayer/qqnxmediaplayer.cpp')
-rw-r--r-- | src/plugins/multimedia/qnx/mediaplayer/qqnxmediaplayer.cpp | 45 |
1 files changed, 19 insertions, 26 deletions
diff --git a/src/plugins/multimedia/qnx/mediaplayer/qqnxmediaplayer.cpp b/src/plugins/multimedia/qnx/mediaplayer/qqnxmediaplayer.cpp index 1c28c3b14..14b190836 100644 --- a/src/plugins/multimedia/qnx/mediaplayer/qqnxmediaplayer.cpp +++ b/src/plugins/multimedia/qnx/mediaplayer/qqnxmediaplayer.cpp @@ -7,7 +7,8 @@ #include "qqnxmediaeventthread_p.h" #include "qqnxwindowgrabber_p.h" -#include <private/qabstractvideobuffer_p.h> +#include <private/qhwvideobuffer_p.h> +#include <private/qvideoframe_p.h> #include <QtCore/qabstracteventdispatcher.h> #include <QtCore/qcoreapplication.h> @@ -62,24 +63,19 @@ static std::tuple<int, int, bool> parseBufferLevel(const QString &value) return { level, capacity, true }; } -class QnxTextureBuffer : public QAbstractVideoBuffer +class QnxTextureBuffer : public QHwVideoBuffer { public: QnxTextureBuffer(QQnxWindowGrabber *QQnxWindowGrabber) - : QAbstractVideoBuffer(QVideoFrame::RhiTextureHandle) + : QHwVideoBuffer(QVideoFrame::RhiTextureHandle) { m_windowGrabber = QQnxWindowGrabber; m_handle = 0; } - QVideoFrame::MapMode mapMode() const override - { - return QVideoFrame::ReadWrite; - } - void unmap() override {} - MapData map(QVideoFrame::MapMode /*mode*/) override + MapData map(QtVideo::MapMode /*mode*/) override { return {}; } @@ -102,19 +98,13 @@ private: class QnxRasterBuffer : public QAbstractVideoBuffer { public: - QnxRasterBuffer(QQnxWindowGrabber *windowGrabber) - : QAbstractVideoBuffer(QVideoFrame::NoHandle) - { - m_windowGrabber = windowGrabber; - } + QnxRasterBuffer(QQnxWindowGrabber *windowGrabber) { m_windowGrabber = windowGrabber; } - QVideoFrame::MapMode mapMode() const override + MapData map(QtVideo::MapMode mode) override { - return QVideoFrame::ReadOnly; - } + if (mode != QtVideo::MapMode::ReadOnly) + return {}; - MapData map(QVideoFrame::MapMode /*mode*/) override - { if (buffer.data) { qWarning("QnxRasterBuffer: need to unmap before mapping"); return {}; @@ -123,10 +113,10 @@ public: buffer = m_windowGrabber->getNextBuffer(); return { - .nPlanes = 1, + .planeCount = 1, .bytesPerLine = { buffer.stride }, .data = { buffer.data }, - .size = { buffer.width * buffer.height * buffer.pixelSize } + .dataSize = { buffer.width * buffer.height * buffer.pixelSize } }; } @@ -135,6 +125,8 @@ public: buffer = {}; } + QVideoFrameFormat format() const override { return {}; } + private: QQnxWindowGrabber *m_windowGrabber; QQnxWindowGrabber::BufferView buffer; @@ -517,12 +509,13 @@ void QQnxMediaPlayer::updateScene(const QSize &size) if (!m_platformVideoSink) return; - auto *buffer = m_windowGrabber->isEglImageSupported() - ? static_cast<QAbstractVideoBuffer*>(new QnxTextureBuffer(m_windowGrabber)) - : static_cast<QAbstractVideoBuffer*>(new QnxRasterBuffer(m_windowGrabber)); + QVideoFrameFormat format(size, QVideoFrameFormat::Format_BGRX8888); - const QVideoFrame actualFrame(buffer, - QVideoFrameFormat(size, QVideoFrameFormat::Format_BGRX8888)); + const QVideoFrame actualFrame = m_windowGrabber->isEglImageSupported() + ? QVideoFramePrivate::createFrame(std::make_unique<QnxTextureBuffer>(m_windowGrabber), + std::move(format)) + : QVideoFramePrivate::createFrame(std::make_unique<QnxRasterBuffer>(m_windowGrabber), + std::move(format)); m_platformVideoSink->setVideoFrame(actualFrame); } |