[vlc-commits] qt: move vout window report functions to the Video surface provider

Pierre Lamot git at videolan.org
Tue May 19 16:52:46 CEST 2020


vlc | branch: master | Pierre Lamot <pierre at videolabs.io> | Tue Mar 24 09:52:50 2020 +0100| [66e86e159eb18b151a5deab0c07775477c3dd197] | committer: Pierre Lamot

qt: move vout window report functions to the Video surface provider

  QVoutWindow functionalities will be superseded by the compositor

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=66e86e159eb18b151a5deab0c07775477c3dd197
---

 modules/gui/qt/Makefile.am                         |  15 +--
 modules/gui/qt/maininterface/main_interface.cpp    |  32 +++--
 modules/gui/qt/maininterface/main_interface.hpp    |  19 +--
 .../{voutwindow => maininterface}/videosurface.cpp | 141 +++++++++++++++++----
 .../{voutwindow => maininterface}/videosurface.hpp |  43 ++++---
 modules/gui/qt/voutwindow/qvoutwindow.cpp          |  98 --------------
 modules/gui/qt/voutwindow/qvoutwindow.hpp          |  42 ------
 modules/gui/qt/voutwindow/qvoutwindowdummy.cpp     |  53 --------
 modules/gui/qt/voutwindow/qvoutwindowdummy.hpp     |  53 --------
 9 files changed, 182 insertions(+), 314 deletions(-)

diff --git a/modules/gui/qt/Makefile.am b/modules/gui/qt/Makefile.am
index 5cdaebf086..c5b3dbaabe 100644
--- a/modules/gui/qt/Makefile.am
+++ b/modules/gui/qt/Makefile.am
@@ -114,7 +114,10 @@ libqt_plugin_la_SOURCES = \
 	gui/qt/dialogs/sout/sout_widgets.hpp \
 	gui/qt/dialogs/toolbar/toolbareditor.cpp gui/qt/dialogs/toolbar/toolbareditor.hpp \
 	gui/qt/dialogs/vlm/vlm.cpp gui/qt/dialogs/vlm/vlm.hpp \
-	gui/qt/maininterface/main_interface.cpp gui/qt/maininterface/main_interface.hpp \
+	gui/qt/maininterface/main_interface.cpp \
+	gui/qt/maininterface/main_interface.hpp \
+	gui/qt/maininterface/videosurface.cpp \
+	gui/qt/maininterface/videosurface.hpp \
 	gui/qt/medialibrary/medialib.cpp \
 	gui/qt/medialibrary/medialib.hpp \
 	gui/qt/medialibrary/mlalbum.cpp \
@@ -197,12 +200,6 @@ libqt_plugin_la_SOURCES = \
 	gui/qt/util/variables.cpp gui/qt/util/variables.hpp \
 	gui/qt/util/vlctick.cpp \
 	gui/qt/util/vlctick.hpp \
-	gui/qt/voutwindow/qvoutwindow.cpp \
-	gui/qt/voutwindow/qvoutwindow.hpp \
-	gui/qt/voutwindow/qvoutwindowdummy.cpp \
-	gui/qt/voutwindow/qvoutwindowdummy.hpp \
-	gui/qt/voutwindow/videosurface.cpp \
-	gui/qt/voutwindow/videosurface.hpp \
 	gui/qt/widgets/native/animators.cpp \
 	gui/qt/widgets/native/animators.hpp \
 	gui/qt/widgets/native/customwidgets.cpp gui/qt/widgets/native/customwidgets.hpp \
@@ -270,6 +267,7 @@ nodist_libqt_plugin_la_SOURCES = \
 	gui/qt/dialogs/sout/sout_widgets.moc.cpp \
 	gui/qt/dialogs/toolbar/toolbareditor.moc.cpp \
 	gui/qt/maininterface/main_interface.moc.cpp \
+	gui/qt/maininterface/videosurface.moc.cpp \
 	gui/qt/medialibrary/medialib.moc.cpp \
 	gui/qt/medialibrary/mlalbum.moc.cpp \
 	gui/qt/medialibrary/mlalbummodel.moc.cpp \
@@ -312,9 +310,6 @@ nodist_libqt_plugin_la_SOURCES = \
 	gui/qt/util/varchoicemodel.moc.cpp \
 	gui/qt/util/variables.moc.cpp \
 	gui/qt/util/vlctick.moc.cpp \
-	gui/qt/voutwindow/qvoutwindow.moc.cpp \
-	gui/qt/voutwindow/qvoutwindowdummy.moc.cpp \
-	gui/qt/voutwindow/videosurface.moc.cpp \
 	gui/qt/widgets/native/animators.moc.cpp \
 	gui/qt/widgets/native/customwidgets.moc.cpp \
 	gui/qt/widgets/native/interface_widgets.moc.cpp \
diff --git a/modules/gui/qt/maininterface/main_interface.cpp b/modules/gui/qt/maininterface/main_interface.cpp
index 50fc7b963e..4b226e9bd5 100644
--- a/modules/gui/qt/maininterface/main_interface.cpp
+++ b/modules/gui/qt/maininterface/main_interface.cpp
@@ -64,14 +64,14 @@
 #include "dialogs/dialogs/dialogmodel.hpp"
 #include "player/playercontrolbarmodel.hpp"
 
-#include "voutwindow/qvoutwindowdummy.hpp"
-
 #include "util/qml_main_context.hpp"
 
 #include "util/qmleventfilter.hpp"
 #include "util/i18n.hpp"
 #include "util/systempalette.hpp"
 
+#include "videosurface.hpp"
+
 #include "menus/menus.hpp"                            // Menu creation
 
 #include <QCloseEvent>
@@ -201,9 +201,6 @@ MainInterface::MainInterface( intf_thread_t *_p_intf ) : QVLCMW( _p_intf ),
     b_hasWayland = platformName.startsWith(QLatin1String("wayland"), Qt::CaseInsensitive);
 #endif
 
-    // TODO: handle Wayland/X11/Win32 windows
-    m_videoRenderer.reset(new QVoutWindowDummy(this));
-
     /**************************
      *  UI and Widgets design
      **************************/
@@ -648,6 +645,7 @@ void MainInterface::resizeVideo( vout_window_t *p_wnd,
     emit p_mi->askVideoToResize( i_width, i_height );
 }
 
+
 void MainInterface::requestVideoWindowed( struct vout_window_t *wnd )
 {
    MainInterface *p_mi = (MainInterface *)wnd->sys;
@@ -694,9 +692,27 @@ QQuickWindow*MainInterface::getRootQuickWindow()
     return rootObject->window();
 }
 
+
+bool MainInterface::hasEmbededVideo() const
+{
+    return m_videoSurfaceProvider && m_videoSurfaceProvider->hasVideo();
+}
+
+void MainInterface::setVideoSurfaceProvider(VideoSurfaceProvider* videoSurfaceProvider)
+{
+    if (m_videoSurfaceProvider)
+        disconnect(m_videoSurfaceProvider, &VideoSurfaceProvider::hasVideoChanged, this, &MainInterface::hasEmbededVideoChanged);
+    m_videoSurfaceProvider = videoSurfaceProvider;
+    if (m_videoSurfaceProvider)
+        connect(m_videoSurfaceProvider, &VideoSurfaceProvider::hasVideoChanged,
+                this, &MainInterface::hasEmbededVideoChanged,
+                Qt::QueuedConnection);
+    emit hasEmbededVideoChanged(m_videoSurfaceProvider && m_videoSurfaceProvider->hasVideo());
+}
+
 VideoSurfaceProvider* MainInterface::getVideoSurfaceProvider() const
 {
-    return m_videoRenderer->getVideoSurfaceProvider();
+    return m_videoSurfaceProvider;
 }
 
 const Qt::Key MainInterface::kc[10] =
@@ -1084,8 +1100,8 @@ void MainInterface::closeEvent( QCloseEvent *e )
     PlaylistControllerModel* playlistController = p_intf->p_sys->p_mainPlaylistController;
     PlayerController* playerController = p_intf->p_sys->p_mainPlayerController;
 
-    if (m_videoRenderer)
-        m_videoRenderer->windowClosed();
+    if (m_videoSurfaceProvider)
+        m_videoSurfaceProvider->onWindowClosed();
     //We need to make sure that noting is playing anymore otherwise the vout will be closed
     //after the main interface, and it requires (at least with OpenGL) that the OpenGL context
     //from the main window is still valid.
diff --git a/modules/gui/qt/maininterface/main_interface.hpp b/modules/gui/qt/maininterface/main_interface.hpp
index 9333d9918d..a339b36c37 100644
--- a/modules/gui/qt/maininterface/main_interface.hpp
+++ b/modules/gui/qt/maininterface/main_interface.hpp
@@ -28,7 +28,6 @@
 
 #include "widgets/native/qvlcframe.hpp"
 #include "player/player_controller.hpp"
-#include "voutwindow/qvoutwindow.hpp"
 
 #include <QSystemTrayIcon>
 #include <QStackedWidget>
@@ -57,7 +56,7 @@ class QScreen;
 class QTimer;
 class StandardPLPanel;
 struct vout_window_t;
-struct vout_window_cfg_t;
+class VideoSurfaceProvider;
 
 class MainInterface : public QVLCMW
 {
@@ -95,11 +94,6 @@ private:
     static void requestVideoFullScreen( struct vout_window_t *, const char * );
 
 public:
-    QQmlContext* getRootCtx() { return mediacenterView->rootContext(); }
-    QQuickWindow* getRootQuickWindow();
-    QQmlEngine* getEngine(){ return mediacenterView->engine(); }
-    VideoSurfaceProvider* getVideoSurfaceProvider() const;
-
     /* Getters */
     QSystemTrayIcon *getSysTray() { return sysTray; }
     QMenu *getSysTrayMenu() { return systrayMenu; }
@@ -121,9 +115,14 @@ public:
     bool isPlaylistVisible() { return playlistVisible; }
     bool isInterfaceAlwaysOnTop() { return b_interfaceOnTop; }
     bool hasEmbededVideo() { return m_hasEmbededVideo; }
+
     inline bool isShowRemainingTime() const  { return m_showRemainingTime; }
     QList<QQmlError> qmlErrors() const;
 
+    bool hasEmbededVideo() const;
+    VideoSurfaceProvider* getVideoSurfaceProvider() const;
+    void setVideoSurfaceProvider(VideoSurfaceProvider* videoSurfaceProvider);;
+
 protected:
     void dropEventPlay( QDropEvent* event, bool b_play );
     void changeEvent( QEvent * ) Q_DECL_OVERRIDE;
@@ -148,6 +147,10 @@ protected:
     void setInterfaceFullScreen( bool );
     void computeMinimumSize();
 
+    bool m_hasEmbededVideo = false;
+    VideoSurfaceProvider* m_videoSurfaceProvider = nullptr;
+    bool m_showRemainingTime = false;
+
     /* */
     QSettings           *settings;
     QSystemTrayIcon     *sysTray;
@@ -156,8 +159,6 @@ protected:
     QString              input_name;
     QVBoxLayout         *mainLayout;
 
-    std::unique_ptr<QVoutWindow> m_videoRenderer;
-
     QQuickWidget        *mediacenterView;
     QWidget             *mediacenterWrapper;
 
diff --git a/modules/gui/qt/voutwindow/videosurface.cpp b/modules/gui/qt/maininterface/videosurface.cpp
similarity index 58%
rename from modules/gui/qt/voutwindow/videosurface.cpp
rename to modules/gui/qt/maininterface/videosurface.cpp
index 8e559041b4..18f2f296fb 100644
--- a/modules/gui/qt/voutwindow/videosurface.cpp
+++ b/modules/gui/qt/maininterface/videosurface.cpp
@@ -17,13 +17,101 @@
  *****************************************************************************/
 #include "videosurface.hpp"
 #include "maininterface/main_interface.hpp"
-
+#include "widgets/native/customwidgets.hpp" //for qtEventToVLCKey
+#include <QSGRectangleNode>
 
 VideoSurfaceProvider::VideoSurfaceProvider(QObject* parent)
     : QObject(parent)
 {
 }
 
+bool VideoSurfaceProvider::hasVideo()
+{
+    QMutexLocker lock(&m_voutlock);
+    return m_voutWindow != nullptr;
+}
+
+void VideoSurfaceProvider::enable(vout_window_t* voutWindow)
+{
+    assert(voutWindow);
+    {
+        QMutexLocker lock(&m_voutlock);
+        m_voutWindow = voutWindow;
+    }
+    emit hasVideoChanged(true);
+}
+
+void VideoSurfaceProvider::disable()
+{
+    {
+        QMutexLocker lock(&m_voutlock);
+        m_voutWindow = nullptr;
+    }
+    emit hasVideoChanged(false);
+}
+
+void VideoSurfaceProvider::onWindowClosed()
+{
+    QMutexLocker lock(&m_voutlock);
+    if (m_voutWindow)
+        vout_window_ReportClose(m_voutWindow);
+}
+
+void VideoSurfaceProvider::onMousePressed(int vlcButton)
+{
+    QMutexLocker lock(&m_voutlock);
+    if (m_voutWindow)
+        vout_window_ReportMousePressed(m_voutWindow, vlcButton);
+}
+
+void VideoSurfaceProvider::onMouseReleased(int vlcButton)
+{
+    QMutexLocker lock(&m_voutlock);
+    if (m_voutWindow)
+        vout_window_ReportMouseReleased(m_voutWindow, vlcButton);
+}
+
+void VideoSurfaceProvider::onMouseDoubleClick(int vlcButton)
+{
+    QMutexLocker lock(&m_voutlock);
+    if (m_voutWindow)
+        vout_window_ReportMouseDoubleClick(m_voutWindow, vlcButton);
+}
+
+void VideoSurfaceProvider::onMouseMoved(float x, float y)
+{
+    QMutexLocker lock(&m_voutlock);
+    if (m_voutWindow)
+        vout_window_ReportMouseMoved(m_voutWindow, x, y);
+}
+
+void VideoSurfaceProvider::onMouseWheeled(const QPointF& pos, int delta, Qt::MouseButtons buttons,  Qt::KeyboardModifiers modifiers, Qt::Orientation orient)
+{
+    QWheelEvent event(pos, delta, buttons, modifiers, orient);
+    int vlckey = qtWheelEventToVLCKey(&event);
+    QMutexLocker lock(&m_voutlock);
+    if (m_voutWindow)
+        vout_window_ReportKeyPress(m_voutWindow, vlckey);
+}
+
+void VideoSurfaceProvider::onKeyPressed(int key, Qt::KeyboardModifiers modifiers)
+{
+    QKeyEvent event(QEvent::KeyPress, key, modifiers);
+    int vlckey = qtEventToVLCKey(&event);
+    QMutexLocker lock(&m_voutlock);
+    if (m_voutWindow)
+        vout_window_ReportKeyPress(m_voutWindow, vlckey);
+
+}
+
+void VideoSurfaceProvider::onSurfaceSizeChanged(QSizeF size)
+{
+    QMutexLocker lock(&m_voutlock);
+    if (m_voutWindow)
+        vout_window_ReportSize(m_voutWindow, size.width(), size.height());
+}
+
+
 VideoSurface::VideoSurface(QQuickItem* parent)
     : QQuickItem(parent)
 {
@@ -129,6 +217,12 @@ void VideoSurface::keyPressEvent(QKeyEvent* event)
     event->ignore();
 }
 
+void VideoSurface::geometryChanged(const QRectF& newGeometry, const QRectF& oldGeometry)
+{
+    QQuickItem::geometryChanged(newGeometry, oldGeometry);
+    onSurfaceSizeChanged();
+}
+
 #if QT_CONFIG(wheelevent)
 void VideoSurface::wheelEvent(QWheelEvent *event)
 {
@@ -147,43 +241,40 @@ void VideoSurface::setCursorShape(Qt::CursorShape shape)
     setCursor(shape);
 }
 
-QSGNode*VideoSurface::updatePaintNode(QSGNode* node, QQuickItem::UpdatePaintNodeData* nodeData)
+QSGNode*VideoSurface::updatePaintNode(QSGNode* oldNode, QQuickItem::UpdatePaintNodeData*)
 {
+    QSGRectangleNode* node = static_cast<QSGRectangleNode*>(oldNode);
+
+    if (!node)
+    {
+        node = this->window()->createRectangleNode();
+        node->setColor(Qt::transparent);
+    }
+    node->setRect(this->boundingRect());
+
     if (m_provider == nullptr)
     {
         if (m_mainCtx == nullptr)
-            return nullptr;
+            return node;
         m_provider =  m_mainCtx->getMainInterface()->getVideoSurfaceProvider();
         if (!m_provider)
-            return nullptr;
+            return node;
 
         //forward signal to the provider
-        connect(this, &VideoSurface::mouseMoved, m_provider, &VideoSurfaceProvider::mouseMoved);
-        connect(this, &VideoSurface::mousePressed, m_provider, &VideoSurfaceProvider::mousePressed);
-        connect(this, &VideoSurface::mouseDblClicked, m_provider, &VideoSurfaceProvider::mouseDblClicked);
-        connect(this, &VideoSurface::mouseReleased, m_provider, &VideoSurfaceProvider::mouseReleased);
-        connect(this, &VideoSurface::mouseWheeled, m_provider, &VideoSurfaceProvider::mouseWheeled);
-        connect(this, &VideoSurface::keyPressed, m_provider, &VideoSurfaceProvider::keyPressed);
-        connect(this, &VideoSurface::surfaceSizeChanged, m_provider, &VideoSurfaceProvider::surfaceSizeChanged);
+        connect(this, &VideoSurface::mouseMoved, m_provider, &VideoSurfaceProvider::onMouseMoved);
+        connect(this, &VideoSurface::mousePressed, m_provider, &VideoSurfaceProvider::onMousePressed);
+        connect(this, &VideoSurface::mouseDblClicked, m_provider, &VideoSurfaceProvider::onMouseDoubleClick);
+        connect(this, &VideoSurface::mouseReleased, m_provider, &VideoSurfaceProvider::onMouseReleased);
+        connect(this, &VideoSurface::mouseWheeled, m_provider, &VideoSurfaceProvider::onMouseWheeled);
+        connect(this, &VideoSurface::keyPressed, m_provider, &VideoSurfaceProvider::onKeyPressed);
+        connect(this, &VideoSurface::surfaceSizeChanged, m_provider, &VideoSurfaceProvider::onSurfaceSizeChanged);
 
-        connect(m_provider, &VideoSurfaceProvider::update, this, &VideoSurface::update);
-        connect(m_provider, &VideoSurfaceProvider::sourceSizeChanged, this, &VideoSurface::onSourceSizeChanged);
-
-        onSurfaceSizeChanged();
-    }
-    return m_provider->updatePaintNode(this, node, nodeData);
-}
-
-void VideoSurface::onSourceSizeChanged(QSize newSize)
-{
-    if (newSize != m_sourceSize) {
-        m_sourceSize = newSize;
-        emit sourceSizeChanged(m_sourceSize);
         onSurfaceSizeChanged();
     }
+    return node;
 }
 
 void VideoSurface::onSurfaceSizeChanged()
 {
-    emit surfaceSizeChanged(size());
+    emit surfaceSizeChanged(size() * this->window()->effectiveDevicePixelRatio());
 }
diff --git a/modules/gui/qt/voutwindow/videosurface.hpp b/modules/gui/qt/maininterface/videosurface.hpp
similarity index 78%
rename from modules/gui/qt/voutwindow/videosurface.hpp
rename to modules/gui/qt/maininterface/videosurface.hpp
index 47d5828a80..8ac5e612c4 100644
--- a/modules/gui/qt/voutwindow/videosurface.hpp
+++ b/modules/gui/qt/maininterface/videosurface.hpp
@@ -20,31 +20,41 @@
 
 #include <QtQuick/QQuickItem>
 #include <QCursor>
+#include <QMutex>
 #include <util/qml_main_context.hpp>
 #include "qt.hpp"
+#include "vlc_vout_window.h"
 
 class VideoSurfaceProvider : public QObject
 {
     Q_OBJECT
 public:
-    VideoSurfaceProvider(QObject* parent);
+    VideoSurfaceProvider(QObject* parent = nullptr);
     virtual ~VideoSurfaceProvider() {}
-    virtual QSGNode* updatePaintNode(QQuickItem* item, QSGNode* oldNode, QQuickItem::UpdatePaintNodeData*) = 0;
 
-signals:
-    void ctxChanged(QmlMainContext*);
-    void sourceSizeChanged(QSize);
+    bool hasVideo();
 
-    void surfaceSizeChanged(QSizeF);
+    void enable(vout_window_t* voutWindow);
+    void disable();
 
-    void mousePressed( int vlcButton );
-    void mouseReleased( int vlcButton );
-    void mouseDblClicked( int vlcButton );
-    void mouseMoved( float x, float y );
-    void keyPressed(int key, Qt::KeyboardModifiers modifier);
-    void mouseWheeled(const QPointF& pos, int delta, Qt::MouseButtons buttons,  Qt::KeyboardModifiers modifiers, Qt::Orientation orient);
 
-    void update();
+signals:
+    void ctxChanged(QmlMainContext*);
+    bool hasVideoChanged(bool);
+
+public slots:
+    void onWindowClosed();
+    void onMousePressed( int vlcButton );
+    void onMouseReleased( int vlcButton );
+    void onMouseDoubleClick( int vlcButton );
+    void onMouseMoved( float x, float y );
+    void onMouseWheeled(const QPointF &pos, int delta, Qt::MouseButtons buttons, Qt::KeyboardModifiers modifiers, Qt::Orientation orient);
+    void onKeyPressed(int key, Qt::KeyboardModifiers modifiers);
+    void onSurfaceSizeChanged(QSizeF size);
+
+protected:
+    QMutex m_voutlock;
+    vout_window_t* m_voutWindow = nullptr;
 };
 
 
@@ -76,6 +86,9 @@ protected:
     virtual void wheelEvent(QWheelEvent *event) override;
 #endif
 
+    virtual void geometryChanged(const QRectF &newGeometry,
+                                 const QRectF &oldGeometry) override;
+
     Qt::CursorShape getCursorShape() const;
     void setCursorShape(Qt::CursorShape);
 
@@ -93,11 +106,9 @@ signals:
     void keyPressed(int key, Qt::KeyboardModifiers modifier);
     void mouseWheeled(const QPointF& pos, int delta, Qt::MouseButtons buttons,  Qt::KeyboardModifiers modifiers, Qt::Orientation orient);
 
-private slots:
-    void onSourceSizeChanged(QSize);
+private:
     void onSurfaceSizeChanged();
 
-private:
     QmlMainContext* m_mainCtx = nullptr;
 
     bool m_sourceSizeChanged = false;
diff --git a/modules/gui/qt/voutwindow/qvoutwindow.cpp b/modules/gui/qt/voutwindow/qvoutwindow.cpp
deleted file mode 100644
index 4b93508f61..0000000000
--- a/modules/gui/qt/voutwindow/qvoutwindow.cpp
+++ /dev/null
@@ -1,98 +0,0 @@
-#include "qvoutwindow.hpp"
-#include "widgets/native/customwidgets.hpp" //for qtEventToVLCKey
-
-QVoutWindow::QVoutWindow(QObject* parent)
-    : QObject(parent)
-{
-}
-
-QVoutWindow::~QVoutWindow()
-{
-}
-
-bool QVoutWindow::setupVoutWindow(vout_window_t* window)
-{
-    QMutexLocker lock(&m_voutlock);
-    m_voutWindow = window;
-    m_hasVideo = false;
-    return true;
-}
-
-void QVoutWindow::enableVideo(unsigned /*width*/, unsigned /*height*/, bool /*fullscreen*/)
-{
-    QMutexLocker lock(&m_voutlock);
-    if (m_voutWindow) {
-        m_hasVideo = true;
-        if (m_surfaceSize.isValid())
-            vout_window_ReportSize(m_voutWindow, m_surfaceSize.width(), m_surfaceSize.height());
-    }
-}
-
-void QVoutWindow::disableVideo()
-{
-    QMutexLocker lock(&m_voutlock);
-    if (m_voutWindow)
-        m_hasVideo = false;
-}
-
-void QVoutWindow::windowClosed()
-{
-    QMutexLocker lock(&m_voutlock);
-    if (m_voutWindow)
-        vout_window_ReportClose(m_voutWindow);
-}
-
-void QVoutWindow::onMousePressed(int vlcButton)
-{
-    QMutexLocker lock(&m_voutlock);
-    if (m_hasVideo)
-        vout_window_ReportMousePressed(m_voutWindow, vlcButton);
-}
-
-void QVoutWindow::onMouseReleased(int vlcButton)
-{
-    QMutexLocker lock(&m_voutlock);
-    if (m_hasVideo)
-        vout_window_ReportMouseReleased(m_voutWindow, vlcButton);
-}
-
-void QVoutWindow::onMouseDoubleClick(int vlcButton)
-{
-    QMutexLocker lock(&m_voutlock);
-    if (m_hasVideo)
-        vout_window_ReportMouseDoubleClick(m_voutWindow, vlcButton);
-}
-
-void QVoutWindow::onMouseMoved(float x, float y)
-{
-    QMutexLocker lock(&m_voutlock);
-    if (m_hasVideo)
-        vout_window_ReportMouseMoved(m_voutWindow, x, y);
-}
-
-void QVoutWindow::onMouseWheeled(const QPointF& pos, int delta, Qt::MouseButtons buttons,  Qt::KeyboardModifiers modifiers, Qt::Orientation orient)
-{
-    QWheelEvent event(pos, delta, buttons, modifiers, orient);
-    int vlckey = qtWheelEventToVLCKey(&event);
-    QMutexLocker lock(&m_voutlock);
-    if (m_hasVideo)
-        vout_window_ReportKeyPress(m_voutWindow, vlckey);
-}
-
-void QVoutWindow::onKeyPressed(int key, Qt::KeyboardModifiers modifiers)
-{
-    QKeyEvent event(QEvent::KeyPress, key, modifiers);
-    int vlckey = qtEventToVLCKey(&event);
-    QMutexLocker lock(&m_voutlock);
-    if (m_hasVideo)
-        vout_window_ReportKeyPress(m_voutWindow, vlckey);
-
-}
-
-void QVoutWindow::onSurfaceSizeChanged(QSizeF size)
-{
-    m_surfaceSize = size;
-    QMutexLocker lock(&m_voutlock);
-    if (m_hasVideo)
-        vout_window_ReportSize(m_voutWindow, size.width(), size.height());
-}
diff --git a/modules/gui/qt/voutwindow/qvoutwindow.hpp b/modules/gui/qt/voutwindow/qvoutwindow.hpp
deleted file mode 100644
index fb25502c8c..0000000000
--- a/modules/gui/qt/voutwindow/qvoutwindow.hpp
+++ /dev/null
@@ -1,42 +0,0 @@
-#ifndef VIDEORENDERER_HPP
-#define VIDEORENDERER_HPP
-
-#include <QObject>
-#include <QMutex>
-#include "qt.hpp"
-#include "vlc_vout_window.h"
-#include "videosurface.hpp"
-
-class QVoutWindow : public QObject
-{
-    Q_OBJECT
-public:
-    QVoutWindow(QObject* parent = nullptr);
-    virtual ~QVoutWindow();
-
-    virtual bool setupVoutWindow(vout_window_t* window);
-    virtual void enableVideo(unsigned width, unsigned height, bool fullscreen);
-    virtual void disableVideo();
-    virtual void windowClosed();
-
-    virtual VideoSurfaceProvider* getVideoSurfaceProvider() = 0;
-
-public slots:
-    void onMousePressed( int vlcButton );
-    void onMouseReleased( int vlcButton );
-    void onMouseDoubleClick( int vlcButton );
-    void onMouseMoved( float x, float y );
-    void onMouseWheeled(const QPointF &pos, int delta, Qt::MouseButtons buttons, Qt::KeyboardModifiers modifiers, Qt::Orientation orient);
-    void onKeyPressed(int key, Qt::KeyboardModifiers modifiers);
-    void onSurfaceSizeChanged(QSizeF size);
-
-protected:
-    QMutex m_voutlock;
-    vout_window_t* m_voutWindow = nullptr;
-    bool m_hasVideo = false;
-
-    QSizeF m_surfaceSize;
-
-};
-
-#endif // VIDEORENDERER_HPP
diff --git a/modules/gui/qt/voutwindow/qvoutwindowdummy.cpp b/modules/gui/qt/voutwindow/qvoutwindowdummy.cpp
deleted file mode 100644
index bf4b168435..0000000000
--- a/modules/gui/qt/voutwindow/qvoutwindowdummy.cpp
+++ /dev/null
@@ -1,53 +0,0 @@
-/*****************************************************************************
- * Copyright (C) 2019 VLC authors and VideoLAN
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
- *****************************************************************************/
-#include "qvoutwindowdummy.hpp"
-#include <QtQuick/QQuickWindow>
-
-VideoSurfaceProviderDummy::VideoSurfaceProviderDummy(QObject* parent)
-    : VideoSurfaceProvider(parent)
-{
-}
-
-QSGNode*VideoSurfaceProviderDummy::updatePaintNode(QQuickItem* item, QSGNode* oldNode, QQuickItem::UpdatePaintNodeData*)
-{
-    QSGRectangleNode* node = static_cast<QSGRectangleNode*>(oldNode);
-
-    if (!node)
-    {
-        node = item->window()->createRectangleNode();
-        node->setColor(Qt::black);
-    }
-    node->setRect(item->boundingRect());
-    return node;
-}
-
-QVoutWindowDummy::QVoutWindowDummy(MainInterface*, QObject* parent)
-    : QVoutWindow(parent)
-    , m_surfaceProvider(new VideoSurfaceProviderDummy(this))
-{
-}
-
-VideoSurfaceProvider*QVoutWindowDummy::getVideoSurfaceProvider()
-{
-    return m_surfaceProvider;
-}
-
-bool QVoutWindowDummy::setupVoutWindow(vout_window_t*)
-{
-    return false;
-}
diff --git a/modules/gui/qt/voutwindow/qvoutwindowdummy.hpp b/modules/gui/qt/voutwindow/qvoutwindowdummy.hpp
deleted file mode 100644
index 7a8a395719..0000000000
--- a/modules/gui/qt/voutwindow/qvoutwindowdummy.hpp
+++ /dev/null
@@ -1,53 +0,0 @@
-/*****************************************************************************
- * Copyright (C) 2019 VLC authors and VideoLAN
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
- *****************************************************************************/
-
-#ifndef VIDEORENDERERDUMMY_HPP
-#define VIDEORENDERERDUMMY_HPP
-
-#include "qvoutwindow.hpp"
-#include "videosurface.hpp"
-#include <QtQuick/QSGRectangleNode>
-
-/*
- * Video surface renderer and provider that won't perform anything
- */
-
-class VideoSurfaceProviderDummy : public VideoSurfaceProvider
-{
-    Q_OBJECT
-public:
-
-    VideoSurfaceProviderDummy(QObject* parent = nullptr);
-    QSGNode* updatePaintNode(QQuickItem* item, QSGNode* oldNode, QQuickItem::UpdatePaintNodeData*) override;
-};
-
-class QVoutWindowDummy : public QVoutWindow
-{
-    Q_OBJECT
-public:
-    QVoutWindowDummy(MainInterface* p_mi,  QObject *parent = nullptr);
-
-    VideoSurfaceProvider* getVideoSurfaceProvider() override;
-
-    bool setupVoutWindow(vout_window_t* voutWindow) override;
-
-private:
-    VideoSurfaceProviderDummy* m_surfaceProvider = nullptr;
-};
-
-#endif // VIDEORENDERERDUMMY_HPP



More information about the vlc-commits mailing list