summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorLars Knoll <lars.knoll@qt.io>2021-03-22 20:22:22 +0100
committerLars Knoll <lars.knoll@qt.io>2021-04-06 08:10:44 +0000
commitbf3497a954aa978f60ad687637c36438cfd7d300 (patch)
treebe503b0a27aa42baea3dfdc0cd6407ac5832e5f3 /src
parentcb43c7110b6df863c57fed53772c1584d5d7355c (diff)
Clean up most QAbstractVideoSurface usages
The class is scheduled to be removed, once all it's usages are gone. QVideoSink is the replacement going forward. Change-Id: Idc0a4133496839bf9f95aa9bcf7d6d37cacd549b Reviewed-by: Doris Verria <doris.verria@qt.io> Reviewed-by: Lars Knoll <lars.knoll@qt.io>
Diffstat (limited to 'src')
-rw-r--r--src/imports/multimedia/multimedia.cpp2
-rw-r--r--src/imports/multimedia/qdeclarativeaudio.cpp15
-rw-r--r--src/multimedia/platform/gstreamer/common/qgstreamermediaplayer.cpp5
-rw-r--r--src/multimedia/platform/gstreamer/common/qgstreamermediaplayer_p.h1
-rw-r--r--src/multimedia/platform/gstreamer/common/qgstreamervideooutput.cpp26
-rw-r--r--src/multimedia/platform/gstreamer/common/qgstreamervideooutput_p.h4
-rw-r--r--src/multimedia/platform/gstreamer/mediacapture/qgstreamermediacapture.cpp5
-rw-r--r--src/multimedia/platform/gstreamer/mediacapture/qgstreamermediacapture_p.h1
-rw-r--r--src/multimedia/platform/qplatformmediacapture_p.h2
-rw-r--r--src/multimedia/platform/qplatformmediaplayer_p.h1
-rw-r--r--src/multimedia/playback/qmediaplayer.cpp64
-rw-r--r--src/multimedia/playback/qmediaplayer.h4
-rw-r--r--src/multimedia/recording/qmediacapturesession.cpp28
-rw-r--r--src/multimedia/recording/qmediacapturesession.h2
-rw-r--r--src/multimedia/video/qvideoframe.cpp3
-rw-r--r--src/multimedia/video/qvideosink.h2
-rw-r--r--src/multimediawidgets/qvideowidget.h1
17 files changed, 24 insertions, 142 deletions
diff --git a/src/imports/multimedia/multimedia.cpp b/src/imports/multimedia/multimedia.cpp
index b2bad8e8f..663c24645 100644
--- a/src/imports/multimedia/multimedia.cpp
+++ b/src/imports/multimedia/multimedia.cpp
@@ -57,7 +57,6 @@
#include "qdeclarativecamerafocus_p.h"
#include "qdeclarativecameraimageprocessing_p.h"
#include "qdeclarativetorch_p.h"
-#include <QAbstractVideoSurface>
QML_DECLARE_TYPE(QSoundEffect)
@@ -158,7 +157,6 @@ public:
// 5.15 types
qmlRegisterType<QDeclarativeAudio, 15>(uri, 5, 15, "MediaPlayer");
qmlRegisterType<QDeclarativeVideoOutput, 15>(uri, 5, 15, "VideoOutput");
- qmlRegisterAnonymousType<QAbstractVideoSurface>(uri, 5);
// The minor version used to be the current Qt 5 minor. For compatibility it is the last
// Qt 5 release.
diff --git a/src/imports/multimedia/qdeclarativeaudio.cpp b/src/imports/multimedia/qdeclarativeaudio.cpp
index b84ae0e35..998ca5f2b 100644
--- a/src/imports/multimedia/qdeclarativeaudio.cpp
+++ b/src/imports/multimedia/qdeclarativeaudio.cpp
@@ -47,7 +47,6 @@
#include "qdeclarativemediametadata_p.h"
-#include <QAbstractVideoSurface>
#include <QTimerEvent>
#include <QtQml/qqmlengine.h>
@@ -124,7 +123,7 @@ QDeclarativeAudio::~QDeclarativeAudio()
\qmlproperty url QtMultimedia::MediaPlayer::videoOutput
This property holds the target video output.
- Accepts one or an array of QAbstractVideoSurface or VideoOutput elements.
+ Accepts one or an array of VideoOutput elements.
\snippet multimedia-snippets/multiple-videooutputs.qml complete
@@ -152,8 +151,7 @@ void QDeclarativeAudio::setVideoOutput(const QVariant &v)
if (sink) {
m_player->setVideoOutput(sink);
} else {
-#if 0
- QList<QAbstractVideoSurface *> surfaces;
+ QList<QVideoSink *> sinks;
// Check if it is an array.
auto arr = v.value<QJSValue>();
if (!arr.isNull()) {
@@ -163,15 +161,14 @@ void QDeclarativeAudio::setVideoOutput(const QVariant &v)
if (v.isQObject()) {
auto obj = v.toQObject();
vo = qobject_cast<QDeclarativeVideoOutput *>(obj);
- surface = vo ? vo->videoSink() : qobject_cast<QAbstractVideoSurface *>(obj);
- if (surface)
- surfaces.append(surface);
+ sink = vo ? vo->videoSink() : qobject_cast<QVideoSink *>(obj);
+ if (sink)
+ sinks.append(sink);
}
}
}
- m_player->setVideoOutput(surfaces);
-#endif
+ m_player->setVideoOutput(sinks);
}
m_videoOutput = v;
diff --git a/src/multimedia/platform/gstreamer/common/qgstreamermediaplayer.cpp b/src/multimedia/platform/gstreamer/common/qgstreamermediaplayer.cpp
index c6acef681..5f5464505 100644
--- a/src/multimedia/platform/gstreamer/common/qgstreamermediaplayer.cpp
+++ b/src/multimedia/platform/gstreamer/common/qgstreamermediaplayer.cpp
@@ -721,11 +721,6 @@ void QGstreamerMediaPlayer::parseStreamsAndMetadata()
emit metaDataChanged();
}
-void QGstreamerMediaPlayer::setVideoSurface(QAbstractVideoSurface *surface)
-{
- gstVideoOutput->setVideoSurface(surface);
-}
-
int QGstreamerMediaPlayer::trackCount(QPlatformMediaPlayer::TrackType type)
{
return m_streams[type].count();
diff --git a/src/multimedia/platform/gstreamer/common/qgstreamermediaplayer_p.h b/src/multimedia/platform/gstreamer/common/qgstreamermediaplayer_p.h
index 60ca03bd4..fac04ec21 100644
--- a/src/multimedia/platform/gstreamer/common/qgstreamermediaplayer_p.h
+++ b/src/multimedia/platform/gstreamer/common/qgstreamermediaplayer_p.h
@@ -108,7 +108,6 @@ public:
QMediaMetaData metaData() const override;
void setVideoSink(QVideoSink *sink) override;
- void setVideoSurface(QAbstractVideoSurface *surface) override;
int trackCount(TrackType) override;
QMediaMetaData trackMetaData(TrackType /*type*/, int /*streamNumber*/) override;
diff --git a/src/multimedia/platform/gstreamer/common/qgstreamervideooutput.cpp b/src/multimedia/platform/gstreamer/common/qgstreamervideooutput.cpp
index 141125dad..ef059c8b7 100644
--- a/src/multimedia/platform/gstreamer/common/qgstreamervideooutput.cpp
+++ b/src/multimedia/platform/gstreamer/common/qgstreamervideooutput.cpp
@@ -66,32 +66,6 @@ QGstreamerVideoOutput::~QGstreamerVideoOutput()
{
}
-static QGstElement getSink(QGstreamerVideoRenderer *output)
-{
- QGstElement newSink;
- if (output && output->isReady())
- newSink = output->videoSink();
-
- if (newSink.isNull())
- newSink = QGstElement("fakesink", "fakevideosink");
-
- return newSink;
-}
-
-void QGstreamerVideoOutput::setVideoSurface(QAbstractVideoSurface *surface)
-{
- if (!m_videoOutput) {
- m_videoOutput = new QGstreamerVideoRenderer;
- qCDebug(qLcMediaVideoOutput) << Q_FUNC_INFO;
- connect(m_videoOutput, SIGNAL(sinkChanged()), this, SLOT(sinkChanged()));
- }
-
- m_videoOutput->setSurface(surface);
-
- QGstElement gstSink = getSink(m_videoOutput);
- updateVideoSink(gstSink);
-}
-
void QGstreamerVideoOutput::setVideoSink(QVideoSink *sink)
{
auto *videoSink = static_cast<QGstreamerVideoSink *>(sink->platformVideoSink());
diff --git a/src/multimedia/platform/gstreamer/common/qgstreamervideooutput_p.h b/src/multimedia/platform/gstreamer/common/qgstreamervideooutput_p.h
index fc7e35eff..8f4946e1f 100644
--- a/src/multimedia/platform/gstreamer/common/qgstreamervideooutput_p.h
+++ b/src/multimedia/platform/gstreamer/common/qgstreamervideooutput_p.h
@@ -60,7 +60,6 @@
QT_BEGIN_NAMESPACE
class QGstreamerVideoRenderer;
-class QAbstractVideoSurface;
class QVideoSink;
class QGstreamerVideoSink;
@@ -72,7 +71,6 @@ public:
QGstreamerVideoOutput(QObject *parent = 0);
~QGstreamerVideoOutput();
- void setVideoSurface(QAbstractVideoSurface *surface);
void setVideoSink(QVideoSink *sink);
void setPipeline(const QGstPipeline &pipeline) { gstPipeline = pipeline; }
@@ -89,9 +87,7 @@ public slots:
private:
void prepareVideoOutputChange(const QGstPad &pad);
- QAbstractVideoSurface *m_videoSurface = nullptr;
QVideoSink *m_videoSink = nullptr;
- QGstreamerVideoRenderer *m_videoOutput = nullptr;
QGstreamerVideoSink *m_videoWindow = nullptr;
// Gst elements
diff --git a/src/multimedia/platform/gstreamer/mediacapture/qgstreamermediacapture.cpp b/src/multimedia/platform/gstreamer/mediacapture/qgstreamermediacapture.cpp
index c7301c3e4..edfb12eba 100644
--- a/src/multimedia/platform/gstreamer/mediacapture/qgstreamermediacapture.cpp
+++ b/src/multimedia/platform/gstreamer/mediacapture/qgstreamermediacapture.cpp
@@ -144,11 +144,6 @@ void QGstreamerMediaCapture::setVolume(qreal volume)
gstAudioOutput->setVolume(volume);
}
-void QGstreamerMediaCapture::setVideoPreview(QAbstractVideoSurface *surface)
-{
- gstVideoOutput->setVideoSurface(surface);
-}
-
void QGstreamerMediaCapture::setVideoPreview(QVideoSink *sink)
{
gstVideoOutput->setVideoSink(sink);
diff --git a/src/multimedia/platform/gstreamer/mediacapture/qgstreamermediacapture_p.h b/src/multimedia/platform/gstreamer/mediacapture/qgstreamermediacapture_p.h
index 62dc451c8..fbac1ac99 100644
--- a/src/multimedia/platform/gstreamer/mediacapture/qgstreamermediacapture_p.h
+++ b/src/multimedia/platform/gstreamer/mediacapture/qgstreamermediacapture_p.h
@@ -85,7 +85,6 @@ public:
QAudioDeviceInfo audioInput() const override;
bool setAudioInput(const QAudioDeviceInfo &id) override;
- void setVideoPreview(QAbstractVideoSurface *surface) override;
void setVideoPreview(QVideoSink *sink) override;
QAudioDeviceInfo audioPreview() const override;
bool setAudioPreview(const QAudioDeviceInfo &info) override;
diff --git a/src/multimedia/platform/qplatformmediacapture_p.h b/src/multimedia/platform/qplatformmediacapture_p.h
index 776a81367..39cfa3b90 100644
--- a/src/multimedia/platform/qplatformmediacapture_p.h
+++ b/src/multimedia/platform/qplatformmediacapture_p.h
@@ -59,7 +59,6 @@ class QPlatformCameraImageCapture;
class QPlatformMediaEncoder;
class QAudioDeviceInfo;
class QCameraInfo;
-class QAbstractVideoSurface;
class QVideoSink;
class Q_MULTIMEDIA_EXPORT QPlatformMediaCaptureSession : public QObject
@@ -81,7 +80,6 @@ public:
virtual QAudioDeviceInfo audioInput() const = 0;
virtual bool setAudioInput(const QAudioDeviceInfo &id) = 0;
- virtual void setVideoPreview(QAbstractVideoSurface *) {} // ### Remove me!
virtual void setVideoPreview(QVideoSink */*sink*/) {}
virtual QAudioDeviceInfo audioPreview() const;
virtual bool setAudioPreview(const QAudioDeviceInfo &) { return true; }
diff --git a/src/multimedia/platform/qplatformmediaplayer_p.h b/src/multimedia/platform/qplatformmediaplayer_p.h
index dc28acd1a..14babf462 100644
--- a/src/multimedia/platform/qplatformmediaplayer_p.h
+++ b/src/multimedia/platform/qplatformmediaplayer_p.h
@@ -61,6 +61,7 @@
QT_BEGIN_NAMESPACE
class QMediaStreamsControl;
+class QAbstractVideoSurface;
class Q_MULTIMEDIA_EXPORT QPlatformMediaPlayer
{
diff --git a/src/multimedia/playback/qmediaplayer.cpp b/src/multimedia/playback/qmediaplayer.cpp
index 5917b083e..084cf9f47 100644
--- a/src/multimedia/playback/qmediaplayer.cpp
+++ b/src/multimedia/playback/qmediaplayer.cpp
@@ -586,27 +586,6 @@ void QMediaPlayer::setPlaybackRate(qreal rate)
It does not wait for the media to finish loading and does not check for errors. Listen for
the mediaStatusChanged() and error() signals to be notified when the media is loaded and
when an error occurs during loading.
-
- Since Qt 5.12.2, the url scheme \c gst-pipeline provides custom pipelines
- for the GStreamer backend.
-
- \snippet multimedia-snippets/media.cpp Pipeline
-
- If QAbstractVideoSurface is used as the video output,
- \c qtvideosink can be used as a video sink element directly in the pipeline.
- After that the surface will receive the video frames in QAbstractVideoSurface::present().
-
- \snippet multimedia-snippets/media.cpp Pipeline Surface
-
- If QVideoWidget is used as the video output
- and the pipeline contains a video sink element named \c qtvideosink,
- current QVideoWidget will be used to render the video.
-
- \snippet multimedia-snippets/media.cpp Pipeline Widget
-
- If the pipeline contains appsrc element, it will be used to push data from \a stream.
-
- \snippet multimedia-snippets/media.cpp Pipeline appsrc
*/
void QMediaPlayer::setMedia(const QUrl &media, QIODevice *stream)
@@ -715,32 +694,9 @@ void QMediaPlayer::setVideoOutput(QObject *output)
{
auto *mo = output->metaObject();
QVideoSink *sink = nullptr;
- if (!output || mo->invokeMethod(output, "videoSink", Q_RETURN_ARG(QVideoSink *, sink))) {
- setVideoOutput(sink);
- return;
- }
- QAbstractVideoSurface *surface = nullptr;
- if (output && !mo->invokeMethod(output, "videoSurface", Q_RETURN_ARG(QAbstractVideoSurface *, surface))) {
- qWarning() << "QMediaPlayer::setVideoOutput: Object" << output->metaObject()->className() << "does not have a videoSurface()";
- return;
- }
- setVideoOutput(surface);
-}
-
-/*!
- Sets a video \a surface as the video output of a media player.
-
- If a video output has already been set on the media player the new surface
- will replace it.
-*/
-void QMediaPlayer::setVideoOutput(QAbstractVideoSurface *surface)
-{
- Q_D(QMediaPlayer);
-
- if (!d->control)
- return;
-
- d->control->setVideoSurface(surface);
+ if (output)
+ mo->invokeMethod(output, "videoSink", Q_RETURN_ARG(QVideoSink *, sink));
+ setVideoOutput(sink);
}
void QMediaPlayer::setVideoOutput(QVideoSink *sink)
@@ -755,19 +711,17 @@ void QMediaPlayer::setVideoOutput(QVideoSink *sink)
/*!
\since 5.15
- Sets multiple video surfaces as the video output of a media player.
- This allows the media player to render video frames on different surfaces.
-
- All video surfaces must support at least one shared \c QVideoFrame::PixelFormat.
+ Sets multiple video sinks as the video output of a media player.
+ This allows the media player to render video frames on several outputs.
If a video output has already been set on the media player the new surfaces
will replace it.
-
- \sa QAbstractVideoSurface::supportedPixelFormats
*/
-void QMediaPlayer::setVideoOutput(const QList<QAbstractVideoSurface *> &surfaces)
+void QMediaPlayer::setVideoOutput(const QList<QVideoSink *> &sinks)
{
- setVideoOutput(!surfaces.empty() ? new QVideoSurfaces(surfaces, this) : nullptr);
+ // ### IMPLEMENT ME
+ Q_UNUSED(sinks);
+// setVideoOutput(!surfaces.empty() ? new QVideoSurfaces(surfaces, this) : nullptr);
}
/*! \reimp */
diff --git a/src/multimedia/playback/qmediaplayer.h b/src/multimedia/playback/qmediaplayer.h
index c52bea22f..9ad29a7a9 100644
--- a/src/multimedia/playback/qmediaplayer.h
+++ b/src/multimedia/playback/qmediaplayer.h
@@ -48,7 +48,6 @@
QT_BEGIN_NAMESPACE
class QVideoSink;
-class QAbstractVideoSurface;
class QAudioDeviceInfo;
class QMediaMetaData;
@@ -136,8 +135,7 @@ public:
void setActiveSubtitleTrack(int index);
void setVideoOutput(QObject *);
- void setVideoOutput(QAbstractVideoSurface *surface);
- void setVideoOutput(const QList<QAbstractVideoSurface *> &surfaces);
+ void setVideoOutput(const QList<QVideoSink *> &sinks);
void setVideoOutput(QVideoSink *sink);
QUrl media() const;
diff --git a/src/multimedia/recording/qmediacapturesession.cpp b/src/multimedia/recording/qmediacapturesession.cpp
index 5bb0aa2bc..f2e2c34f7 100644
--- a/src/multimedia/recording/qmediacapturesession.cpp
+++ b/src/multimedia/recording/qmediacapturesession.cpp
@@ -201,8 +201,8 @@ void QMediaCaptureSession::setEncoder(QMediaEncoder *recorder)
/*!
Sets a QObject based video preview for the capture session.
- A QObject based preview is expected to have an invokable videoSurface()
- method that returns a QAbstractVideoSurface.
+ A QObject based preview is expected to have an invokable videoSink()
+ method that returns a QVideoSink.
The previously set preview is detached.
*/
@@ -210,16 +210,9 @@ void QMediaCaptureSession::setVideoPreview(QObject *preview)
{
auto *mo = preview->metaObject();
QVideoSink *sink = nullptr;
- if (!preview || mo->invokeMethod(preview, "videoSink", Q_RETURN_ARG(QVideoSink *, sink))) {
- setVideoPreview(sink);
- return;
- }
- QAbstractVideoSurface *surface = nullptr;
- if (preview && !mo->invokeMethod(preview, "videoSurface", Q_RETURN_ARG(QAbstractVideoSurface *, surface))) {
- qWarning() << "QCamera::setViewFinder: Object" << preview->metaObject()->className() << "does not have a videoSurface()";
- return;
- }
- setVideoPreview(surface);
+ if (preview)
+ mo->invokeMethod(preview, "videoSink", Q_RETURN_ARG(QVideoSink *, sink));
+ setVideoPreview(sink);
}
void QMediaCaptureSession::setVideoPreview(QVideoSink *preview)
@@ -227,17 +220,6 @@ void QMediaCaptureSession::setVideoPreview(QVideoSink *preview)
d_ptr->captureSession->setVideoPreview(preview);
}
-/*!
- Sets a video \a surface as the preview for the capture session.
-
- If a preview has already been set on the session, the new surface
- will replace it.
-*/
-void QMediaCaptureSession::setVideoPreview(QAbstractVideoSurface *preview)
-{
- d_ptr->captureSession->setVideoPreview(preview);
-}
-
QPlatformMediaCaptureSession *QMediaCaptureSession::platformSession() const
{
return d_ptr->captureSession;
diff --git a/src/multimedia/recording/qmediacapturesession.h b/src/multimedia/recording/qmediacapturesession.h
index 41772dce1..db6e41115 100644
--- a/src/multimedia/recording/qmediacapturesession.h
+++ b/src/multimedia/recording/qmediacapturesession.h
@@ -51,7 +51,6 @@ class QCameraInfo;
class QCameraImageCapture; // ### rename to QMediaImageCapture
class QMediaEncoder;
class QPlatformMediaCaptureSession;
-class QAbstractVideoSurface;
class QVideoSink;
class QMediaCaptureSessionPrivate;
@@ -89,7 +88,6 @@ public:
void setVideoPreview(QObject *preview);
void setVideoPreview(QVideoSink *preview);
- void setVideoPreview(QAbstractVideoSurface *preview);
QPlatformMediaCaptureSession *platformSession() const;
diff --git a/src/multimedia/video/qvideoframe.cpp b/src/multimedia/video/qvideoframe.cpp
index 2f72a4e11..6f57ffed6 100644
--- a/src/multimedia/video/qvideoframe.cpp
+++ b/src/multimedia/video/qvideoframe.cpp
@@ -150,8 +150,7 @@ private:
texture handle).
A video frame can also have timestamp information associated with it. These timestamps can be
- used by an implementation of \l QAbstractVideoSurface to determine when to start and stop
- displaying the frame, but not all surfaces might respect this setting.
+ used to determine when to start and stop displaying the frame.
The video pixel data in a QVideoFrame is encapsulated in a QAbstractVideoBuffer. A QVideoFrame
may be constructed from any buffer type by subclassing the QAbstractVideoBuffer class.
diff --git a/src/multimedia/video/qvideosink.h b/src/multimedia/video/qvideosink.h
index 62f21fba7..ec89c425d 100644
--- a/src/multimedia/video/qvideosink.h
+++ b/src/multimedia/video/qvideosink.h
@@ -68,7 +68,7 @@ public:
Vulkan
};
- QVideoSink(QObject *parent);
+ QVideoSink(QObject *parent = nullptr);
~QVideoSink();
GraphicsType graphicsType() const;
diff --git a/src/multimediawidgets/qvideowidget.h b/src/multimediawidgets/qvideowidget.h
index 632163119..88c1af15d 100644
--- a/src/multimediawidgets/qvideowidget.h
+++ b/src/multimediawidgets/qvideowidget.h
@@ -46,7 +46,6 @@
QT_BEGIN_NAMESPACE
-class QAbstractVideoSurface;
class QVideoSink;
class QVideoWidgetPrivate;