[vlc-commits] qt: provide a dummy compositor
Pierre Lamot
git at videolan.org
Tue May 19 16:52:48 CEST 2020
vlc | branch: master | Pierre Lamot <pierre at videolabs.io> | Tue Mar 24 09:52:50 2020 +0100| [3444c79f6e9177a0c3d2b1d3e5aa703aa45e5ddc] | committer: Pierre Lamot
qt: provide a dummy compositor
> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=3444c79f6e9177a0c3d2b1d3e5aa703aa45e5ddc
---
modules/gui/qt/Makefile.am | 3 ++
modules/gui/qt/maininterface/compositor.cpp | 3 +-
modules/gui/qt/maininterface/compositor_dummy.cpp | 61 +++++++++++++++++++++++
modules/gui/qt/maininterface/compositor_dummy.hpp | 53 ++++++++++++++++++++
4 files changed, 119 insertions(+), 1 deletion(-)
diff --git a/modules/gui/qt/Makefile.am b/modules/gui/qt/Makefile.am
index 5ea867f418..e2886bec50 100644
--- a/modules/gui/qt/Makefile.am
+++ b/modules/gui/qt/Makefile.am
@@ -116,6 +116,8 @@ libqt_plugin_la_SOURCES = \
gui/qt/dialogs/vlm/vlm.cpp gui/qt/dialogs/vlm/vlm.hpp \
gui/qt/maininterface/compositor.hpp \
gui/qt/maininterface/compositor.cpp \
+ gui/qt/maininterface/compositor_dummy.hpp \
+ gui/qt/maininterface/compositor_dummy.cpp \
gui/qt/maininterface/main_interface.cpp \
gui/qt/maininterface/main_interface.hpp \
gui/qt/maininterface/videosurface.cpp \
@@ -268,6 +270,7 @@ nodist_libqt_plugin_la_SOURCES = \
gui/qt/dialogs/sout/sout.moc.cpp \
gui/qt/dialogs/sout/sout_widgets.moc.cpp \
gui/qt/dialogs/toolbar/toolbareditor.moc.cpp \
+ gui/qt/maininterface/compositor_dummy.moc.cpp \
gui/qt/maininterface/main_interface.moc.cpp \
gui/qt/maininterface/videosurface.moc.cpp \
gui/qt/medialibrary/medialib.moc.cpp \
diff --git a/modules/gui/qt/maininterface/compositor.cpp b/modules/gui/qt/maininterface/compositor.cpp
index 96edd2d9b7..67dccc59b6 100644
--- a/modules/gui/qt/maininterface/compositor.cpp
+++ b/modules/gui/qt/maininterface/compositor.cpp
@@ -17,12 +17,13 @@
*****************************************************************************/
#include "compositor.hpp"
+#include "compositor_dummy.hpp"
namespace vlc {
Compositor* Compositor::createCompositor(intf_thread_t *p_intf)
{
- return nullptr;
+ return new CompositorDummy(p_intf);
}
}
diff --git a/modules/gui/qt/maininterface/compositor_dummy.cpp b/modules/gui/qt/maininterface/compositor_dummy.cpp
new file mode 100644
index 0000000000..16012e1c34
--- /dev/null
+++ b/modules/gui/qt/maininterface/compositor_dummy.cpp
@@ -0,0 +1,61 @@
+/*****************************************************************************
+ * Copyright (C) 2020 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 "compositor_dummy.hpp"
+
+#include "maininterface/main_interface.hpp"
+#include "maininterface/mainui.hpp"
+
+namespace vlc {
+
+CompositorDummy::CompositorDummy(intf_thread_t *p_intf, QObject* parent)
+ : QObject(parent)
+ , m_intf(p_intf)
+{
+}
+
+MainInterface* CompositorDummy::makeMainInterface()
+{
+ m_rootWindow = new MainInterface(m_intf);
+ m_rootWindow->show();
+ QQuickWidget* centralWidget = new QQuickWidget(m_rootWindow);
+ centralWidget->setResizeMode(QQuickWidget::SizeRootObjectToView);
+
+ MainUI* m_ui = new MainUI(m_intf, m_rootWindow, this);
+ m_ui->setup(centralWidget->engine());
+ centralWidget->setContent(QUrl(), m_ui->getComponent(), m_ui->createRootItem());
+
+ m_rootWindow->setCentralWidget(centralWidget);
+ return m_rootWindow;
+}
+
+void CompositorDummy::destroyMainInterface()
+{
+ if (m_rootWindow)
+ {
+ delete m_rootWindow;
+ m_rootWindow = nullptr;
+ }
+}
+
+bool CompositorDummy::setupVoutWindow(vout_window_t*)
+{
+ //dummy compositor doesn't handle window intergration
+ return false;
+}
+
+}
diff --git a/modules/gui/qt/maininterface/compositor_dummy.hpp b/modules/gui/qt/maininterface/compositor_dummy.hpp
new file mode 100644
index 0000000000..bcaa9672a0
--- /dev/null
+++ b/modules/gui/qt/maininterface/compositor_dummy.hpp
@@ -0,0 +1,53 @@
+/*****************************************************************************
+ * Copyright (C) 2020 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 VLC_COMPOSITOR_DUMMY
+#define VLC_COMPOSITOR_DUMMY
+
+
+#ifdef HAVE_CONFIG_H
+# include "config.h"
+#endif
+
+#include "compositor.hpp"
+
+class MainInterface;
+
+namespace vlc {
+
+class CompositorDummy : public QObject, public Compositor
+{
+ Q_OBJECT
+public:
+ CompositorDummy(intf_thread_t *p_intf, QObject* parent = nullptr);
+ ~CompositorDummy() = default;
+
+ MainInterface *makeMainInterface() override;
+ virtual void destroyMainInterface() override;
+
+ bool setupVoutWindow(vout_window_t *p_wnd) override;
+
+private:
+
+ intf_thread_t *m_intf;
+
+ MainInterface* m_rootWindow;
+};
+
+}
+
+#endif // VLC_COMPOSITOR_DUMMY
More information about the vlc-commits
mailing list