diff options
author | Lars Knoll <lars.knoll@qt.io> | 2021-03-18 14:42:35 +0100 |
---|---|---|
committer | Lars Knoll <lars.knoll@qt.io> | 2021-04-06 08:08:40 +0000 |
commit | f67cea4dd9c2ba44c85267962655235c6143a966 (patch) | |
tree | 4590d90f6f37e21a37cdd05c8e5d55193365b67e /src/imports | |
parent | 782711418999c8e1f5914e805124ba7014687f93 (diff) |
Fix QML video rendering
Use the new QVideoSink class to get the video frames.
Fix some APIs, so that we correctly connect VideoOutput and
MediaPlayer.
Change-Id: I65a0d045988c46a917f70dfb922c1bbdb32f6511
Reviewed-by: Doris Verria <doris.verria@qt.io>
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
Diffstat (limited to 'src/imports')
-rw-r--r-- | src/imports/multimedia/qdeclarativeaudio.cpp | 15 |
1 files changed, 9 insertions, 6 deletions
diff --git a/src/imports/multimedia/qdeclarativeaudio.cpp b/src/imports/multimedia/qdeclarativeaudio.cpp index 268d9070b..b84ae0e35 100644 --- a/src/imports/multimedia/qdeclarativeaudio.cpp +++ b/src/imports/multimedia/qdeclarativeaudio.cpp @@ -43,6 +43,7 @@ #include <private/qplatformmediaplayer_p.h> #include <private/qdeclarativevideooutput_p.h> +#include <qvideosink.h> #include "qdeclarativemediametadata_p.h" @@ -140,17 +141,18 @@ void QDeclarativeAudio::setVideoOutput(const QVariant &v) if (m_videoOutput == v) return; - QAbstractVideoSurface *surface = nullptr; + QVideoSink *sink = nullptr; auto vo = v.value<QDeclarativeVideoOutput *>(); if (vo) - surface = vo->videoSurface(); + sink = vo->videoSink(); else - surface = v.value<QAbstractVideoSurface *>(); + sink = v.value<QVideoSink *>(); // If only one object has been passed. - if (surface) { - m_player->setVideoOutput(surface); + if (sink) { + m_player->setVideoOutput(sink); } else { +#if 0 QList<QAbstractVideoSurface *> surfaces; // Check if it is an array. auto arr = v.value<QJSValue>(); @@ -161,7 +163,7 @@ void QDeclarativeAudio::setVideoOutput(const QVariant &v) if (v.isQObject()) { auto obj = v.toQObject(); vo = qobject_cast<QDeclarativeVideoOutput *>(obj); - surface = vo ? vo->videoSurface() : qobject_cast<QAbstractVideoSurface *>(obj); + surface = vo ? vo->videoSink() : qobject_cast<QAbstractVideoSurface *>(obj); if (surface) surfaces.append(surface); } @@ -169,6 +171,7 @@ void QDeclarativeAudio::setVideoOutput(const QVariant &v) } m_player->setVideoOutput(surfaces); +#endif } m_videoOutput = v; |