From 5a15455133dd760146e90125b6ec2d070a1cf846 Mon Sep 17 00:00:00 2001 From: Lars Knoll Date: Mon, 12 Apr 2021 14:41:32 +0200 Subject: Remove the graphicsType enum from QVideoSink This is redundant, as we can determine the type from whether we have a native window id or an RHI handle set on the sink. Change-Id: I7795e2f1d504fb7df107d1a402ae55adff33d05b Reviewed-by: Doris Verria Reviewed-by: Lars Knoll --- src/imports/multimedia/qmldir | 1 - src/multimedia/platform/darwin/avfvideosink.mm | 10 ---------- src/multimedia/platform/darwin/avfvideosink_p.h | 7 +------ .../darwin/mediaplayer/avfvideorenderercontrol.mm | 3 --- .../gstreamer/common/qgstreamervideosink.cpp | 22 ++-------------------- .../gstreamer/common/qgstreamervideosink_p.h | 4 ---- src/multimedia/platform/qplatformvideosink_p.h | 4 ---- src/multimedia/video/qvideosink.cpp | 11 ----------- src/multimedia/video/qvideosink.h | 10 ---------- 9 files changed, 3 insertions(+), 69 deletions(-) (limited to 'src') diff --git a/src/imports/multimedia/qmldir b/src/imports/multimedia/qmldir index 48cdb0c8c..3444aaa06 100644 --- a/src/imports/multimedia/qmldir +++ b/src/imports/multimedia/qmldir @@ -5,4 +5,3 @@ typeinfo plugins.qmltypes prefer :/qt-project.org/imports/QtMultimedia/ typeinfo plugins.qmltypes Video 5.0 Video.qml - diff --git a/src/multimedia/platform/darwin/avfvideosink.mm b/src/multimedia/platform/darwin/avfvideosink.mm index f28ff98c4..c7488f8b5 100644 --- a/src/multimedia/platform/darwin/avfvideosink.mm +++ b/src/multimedia/platform/darwin/avfvideosink.mm @@ -61,16 +61,6 @@ AVFVideoSink::~AVFVideoSink() { } -bool AVFVideoSink::setGraphicsType(QVideoSink::GraphicsType type) -{ - if (type == m_graphicsType) - return true; - m_graphicsType = type; - if (m_interface) - m_interface->reconfigure(); - return true; -} - WId AVFVideoSink::winId() const { return m_winId; diff --git a/src/multimedia/platform/darwin/avfvideosink_p.h b/src/multimedia/platform/darwin/avfvideosink_p.h index c8228d3b6..220769ffc 100644 --- a/src/multimedia/platform/darwin/avfvideosink_p.h +++ b/src/multimedia/platform/darwin/avfvideosink_p.h @@ -78,9 +78,6 @@ public: // QPlatformVideoSink interface public: - QVideoSink::GraphicsType graphicsType() const override { return m_graphicsType; } - bool setGraphicsType(QVideoSink::GraphicsType type) override; - WId winId() const; void setWinId(WId id) override; @@ -110,7 +107,6 @@ public: private: AVFVideoSinkInterface *m_interface = nullptr; - QVideoSink::GraphicsType m_graphicsType = QVideoSink::Memory; WId m_winId = 0; QRhi *m_rhi = nullptr; NativeView *m_nativeView = nullptr; @@ -143,7 +139,7 @@ public: bool shouldRenderToWindow() { - return m_layer && nativeView() && (graphicsType() == QVideoSink::NativeWindow || isFullScreen()); + return m_layer && nativeView(); // ### || isFullScreen()); } bool rendersToWindow() const { return m_rendersToWindow; } @@ -154,7 +150,6 @@ protected: NativeView *nativeView() const { return m_sink->nativeView(); } QRect displayRect() { return m_sink->displayRect(); } Qt::AspectRatioMode aspectRatioMode() const { return m_sink->aspectRatioMode(); } - QVideoSink::GraphicsType graphicsType() const { return m_sink->graphicsType(); } bool isFullScreen() const { return m_sink->isFullScreen(); } QSize nativeSize() const { return m_sink->nativeSize(); } diff --git a/src/multimedia/platform/darwin/mediaplayer/avfvideorenderercontrol.mm b/src/multimedia/platform/darwin/mediaplayer/avfvideorenderercontrol.mm index 87248fa6e..10e4f1bab 100644 --- a/src/multimedia/platform/darwin/mediaplayer/avfvideorenderercontrol.mm +++ b/src/multimedia/platform/darwin/mediaplayer/avfvideorenderercontrol.mm @@ -103,9 +103,6 @@ void AVFVideoRendererControl::updateVideoFrame(const CVTimeStamp &ts) { Q_UNUSED(ts); - auto type = graphicsType(); - Q_ASSERT(type != QVideoSink::NativeWindow); - if (!m_sink) return; diff --git a/src/multimedia/platform/gstreamer/common/qgstreamervideosink.cpp b/src/multimedia/platform/gstreamer/common/qgstreamervideosink.cpp index c56363f72..8939c4dcf 100644 --- a/src/multimedia/platform/gstreamer/common/qgstreamervideosink.cpp +++ b/src/multimedia/platform/gstreamer/common/qgstreamervideosink.cpp @@ -61,27 +61,9 @@ QGstreamerVideoSink::~QGstreamerVideoSink() delete m_videoRenderer; } -QVideoSink::GraphicsType QGstreamerVideoSink::graphicsType() const -{ - return m_graphicsType; -} - -bool QGstreamerVideoSink::setGraphicsType(QVideoSink::GraphicsType type) -{ - if (type == QVideoSink::NativeWindow) - createOverlay(); - else if (type == QVideoSink::Memory) - createRenderer(); - else - return false; - m_graphicsType = type; - emit sinkChanged(); - return true; -} - QGstElement QGstreamerVideoSink::gstSink() { - if (m_fullScreen || m_graphicsType == QVideoSink::NativeWindow) + if (m_fullScreen || m_windowId) return m_videoOverlay->videoSink(); return m_videoRenderer->gstVideoSink(); } @@ -150,7 +132,7 @@ void QGstreamerVideoSink::setFullScreen(bool fullScreen) if (fullScreen == m_fullScreen) return; m_fullScreen = fullScreen; - if (m_graphicsType != QVideoSink::NativeWindow) + if (!m_windowId) emit sinkChanged(); } diff --git a/src/multimedia/platform/gstreamer/common/qgstreamervideosink_p.h b/src/multimedia/platform/gstreamer/common/qgstreamervideosink_p.h index 9293a6c6b..fe6e79a7e 100644 --- a/src/multimedia/platform/gstreamer/common/qgstreamervideosink_p.h +++ b/src/multimedia/platform/gstreamer/common/qgstreamervideosink_p.h @@ -72,9 +72,6 @@ public: explicit QGstreamerVideoSink(QVideoSink *parent = 0); ~QGstreamerVideoSink(); - QVideoSink::GraphicsType graphicsType() const override; - bool setGraphicsType(QVideoSink::GraphicsType type) override; - void setWinId(WId id) override; void setRhi(QRhi *rhi) override; @@ -106,7 +103,6 @@ private: void createRenderer(); QGstreamerVideoOverlay *m_videoOverlay = nullptr; QGstreamerVideoRenderer *m_videoRenderer = nullptr; - QVideoSink::GraphicsType m_graphicsType = QVideoSink::Memory; WId m_windowId = 0; QRhi *m_rhi = nullptr; QRect m_displayRect; diff --git a/src/multimedia/platform/qplatformvideosink_p.h b/src/multimedia/platform/qplatformvideosink_p.h index 2e43e0f71..4e9862491 100644 --- a/src/multimedia/platform/qplatformvideosink_p.h +++ b/src/multimedia/platform/qplatformvideosink_p.h @@ -57,10 +57,6 @@ class Q_MULTIMEDIA_EXPORT QPlatformVideoSink : public QObject Q_OBJECT public: - - virtual QVideoSink::GraphicsType graphicsType() const { return QVideoSink::NativeWindow; } - virtual bool setGraphicsType(QVideoSink::GraphicsType /*type*/) { return false; } - virtual void setWinId(WId id) = 0; virtual void setRhi(QRhi */*rhi*/) {} diff --git a/src/multimedia/video/qvideosink.cpp b/src/multimedia/video/qvideosink.cpp index 7cd786651..7e2adb6b5 100644 --- a/src/multimedia/video/qvideosink.cpp +++ b/src/multimedia/video/qvideosink.cpp @@ -64,7 +64,6 @@ public: } QVideoSink *q_ptr = nullptr; QPlatformVideoSink *videoSink = nullptr; - QVideoSink::GraphicsType type = QVideoSink::Memory; bool fullScreen = false; WId window = 0; QRhi *rhi = nullptr; @@ -121,16 +120,6 @@ QVideoSink::~QVideoSink() delete d; } -QVideoSink::GraphicsType QVideoSink::graphicsType() const -{ - return d->videoSink->graphicsType(); -} - -void QVideoSink::setGraphicsType(QVideoSink::GraphicsType type) -{ - d->videoSink->setGraphicsType(type); -} - /*! Returns the native window id that the sink is currently rendering to. */ diff --git a/src/multimedia/video/qvideosink.h b/src/multimedia/video/qvideosink.h index 34b2f7bf9..6eda1686c 100644 --- a/src/multimedia/video/qvideosink.h +++ b/src/multimedia/video/qvideosink.h @@ -58,19 +58,9 @@ class Q_MULTIMEDIA_EXPORT QVideoSink : public QObject { Q_OBJECT public: - enum GraphicsType - { - Memory, - NativeWindow, - RhiTexture - }; - QVideoSink(QObject *parent = nullptr); ~QVideoSink(); - GraphicsType graphicsType() const; - void setGraphicsType(GraphicsType type); - // setter sets graphics type to NativeWindow WId nativeWindowId() const; void setNativeWindowId(WId id); -- cgit v1.2.3