[vlc-devel] [RFC 45/82] qt: provide dummy video renderer
Pierre Lamot
pierre at videolabs.io
Fri Feb 1 14:01:49 CET 2019
---
modules/gui/qt/Makefile.am | 3 ++
.../video_renderer/videorendererdummy.cpp | 48 +++++++++++++++++
.../video_renderer/videorendererdummy.hpp | 51 +++++++++++++++++++
3 files changed, 102 insertions(+)
create mode 100644 modules/gui/qt/components/video_renderer/videorendererdummy.cpp
create mode 100644 modules/gui/qt/components/video_renderer/videorendererdummy.hpp
diff --git a/modules/gui/qt/Makefile.am b/modules/gui/qt/Makefile.am
index c061c8a2bd..4fef55cfad 100644
--- a/modules/gui/qt/Makefile.am
+++ b/modules/gui/qt/Makefile.am
@@ -102,6 +102,8 @@ libqt_plugin_la_SOURCES = \
gui/qt/components/video_renderer/videosurface.hpp \
gui/qt/components/video_renderer/videorenderer.cpp \
gui/qt/components/video_renderer/videorenderer.hpp \
+ gui/qt/components/video_renderer/videorendererdummy.cpp \
+ gui/qt/components/video_renderer/videorendererdummy.hpp \
gui/qt/components/custom_menus.cpp \
gui/qt/components/custom_menus.hpp \
gui/qt/components/epg/EPGChannels.cpp \
@@ -222,6 +224,7 @@ nodist_libqt_plugin_la_SOURCES = \
gui/qt/components/custom_menus.moc.cpp \
gui/qt/components/video_renderer/videosurface.moc.cpp \
gui/qt/components/video_renderer/videorenderer.moc.cpp \
+ gui/qt/components/video_renderer/videorendererdummy.moc.cpp \
gui/qt/components/epg/EPGChannels.moc.cpp \
gui/qt/components/epg/EPGProgram.moc.cpp \
gui/qt/components/epg/EPGRuler.moc.cpp \
diff --git a/modules/gui/qt/components/video_renderer/videorendererdummy.cpp b/modules/gui/qt/components/video_renderer/videorendererdummy.cpp
new file mode 100644
index 0000000000..0860b77c3a
--- /dev/null
+++ b/modules/gui/qt/components/video_renderer/videorendererdummy.cpp
@@ -0,0 +1,48 @@
+/*****************************************************************************
+ * 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 "videorendererdummy.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;
+}
+
+VideoRendererDummy::VideoRendererDummy(MainInterface* p_mi, QObject* parent)
+ : VideoRenderer(parent)
+ , m_surfaceProvider(new VideoSurfaceProviderDummy(this))
+{
+}
+
+VideoSurfaceProvider*VideoRendererDummy::getVideoSurfaceProvider()
+{
+ return m_surfaceProvider;
+}
diff --git a/modules/gui/qt/components/video_renderer/videorendererdummy.hpp b/modules/gui/qt/components/video_renderer/videorendererdummy.hpp
new file mode 100644
index 0000000000..a711269350
--- /dev/null
+++ b/modules/gui/qt/components/video_renderer/videorendererdummy.hpp
@@ -0,0 +1,51 @@
+/*****************************************************************************
+ * 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 "videorenderer.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 VideoRendererDummy : public VideoRenderer
+{
+ Q_OBJECT
+public:
+ VideoRendererDummy(MainInterface* p_mi, QObject *parent = nullptr);
+
+ VideoSurfaceProvider* getVideoSurfaceProvider() override;
+
+private:
+ VideoSurfaceProviderDummy* m_surfaceProvider = nullptr;
+};
+
+#endif // VIDEORENDERERDUMMY_HPP
--
2.19.1
More information about the vlc-devel
mailing list