[vlc-commits] wdummy: add dummy video window provider

Rémi Denis-Courmont git at videolan.org
Sun May 20 19:52:02 CEST 2018


vlc | branch: master | Rémi Denis-Courmont <remi at remlab.net> | Thu May 17 20:29:29 2018 +0300| [c3ea303a119e733247aa5bcaf92b6b403fc6cd58] | committer: Rémi Denis-Courmont

wdummy: add dummy video window provider

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

 include/vlc_vout_display.h       |  3 +-
 include/vlc_vout_window.h        |  1 +
 modules/MODULES_LIST             |  1 +
 modules/video_output/Makefile.am |  2 ++
 modules/video_output/wdummy.c    | 72 ++++++++++++++++++++++++++++++++++++++++
 5 files changed, 78 insertions(+), 1 deletion(-)

diff --git a/include/vlc_vout_display.h b/include/vlc_vout_display.h
index 7023057233..48bf23fab9 100644
--- a/include/vlc_vout_display.h
+++ b/include/vlc_vout_display.h
@@ -391,7 +391,8 @@ static inline void vout_display_DeleteWindow(vout_display_t *vd)
 
 static inline bool vout_display_IsWindowed(vout_display_t *vd)
 {
-    return vd->cfg->window != NULL;
+    return vd->cfg->window != NULL
+        && vd->cfg->window->type != VOUT_WINDOW_TYPE_DUMMY;
 }
 
 /**
diff --git a/include/vlc_vout_window.h b/include/vlc_vout_window.h
index d4644c3a43..ff3b2db581 100644
--- a/include/vlc_vout_window.h
+++ b/include/vlc_vout_window.h
@@ -53,6 +53,7 @@ enum vout_window_type {
     VOUT_WINDOW_TYPE_NSOBJECT /**< MacOS X view */,
     VOUT_WINDOW_TYPE_ANDROID_NATIVE /**< Android native window */,
     VOUT_WINDOW_TYPE_WAYLAND /**< Wayland surface */,
+    VOUT_WINDOW_TYPE_DUMMY /**< Dummy window (not an actual window) */
 };
 
 /**
diff --git a/modules/MODULES_LIST b/modules/MODULES_LIST
index 04ac47df06..8293bb8dae 100644
--- a/modules/MODULES_LIST
+++ b/modules/MODULES_LIST
@@ -454,6 +454,7 @@ $Id$
  * wav: Wav demuxer
  * wave: Wave video effect
  * waveout: simple audio output module for Windows
+ * wdummy: dummy window provider
  * webvtt: WEBVTT subtitles decoder, encoder and demuxer
  * wgl: WGL extension for OpenGL
  * win_hotkeys: module to catch hotkeys when application doesn't have the focus
diff --git a/modules/video_output/Makefile.am b/modules/video_output/Makefile.am
index 7db8960336..e8eeb91fdf 100644
--- a/modules/video_output/Makefile.am
+++ b/modules/video_output/Makefile.am
@@ -448,10 +448,12 @@ libflaschen_plugin_la_LIBADD = $(SOCKET_LIBS)
 
 libvdummy_plugin_la_SOURCES = video_output/vdummy.c
 libvmem_plugin_la_SOURCES = video_output/vmem.c
+libwdummy_plugin_la_SOURCES = video_output/wdummy.c
 libyuv_plugin_la_SOURCES = video_output/yuv.c
 
 vout_LTLIBRARIES += \
 	libflaschen_plugin.la \
 	libvdummy_plugin.la \
 	libvmem_plugin.la \
+	libwdummy_plugin.la \
 	libyuv_plugin.la
diff --git a/modules/video_output/wdummy.c b/modules/video_output/wdummy.c
new file mode 100644
index 0000000000..90e4571259
--- /dev/null
+++ b/modules/video_output/wdummy.c
@@ -0,0 +1,72 @@
+/**
+ * @file wdummy.c
+ * @brief Dummy video window provider for legacy video plugins
+ */
+/*****************************************************************************
+ * Copyright © 2009, 2018 Rémi Denis-Courmont
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as published by
+ * the Free Software Foundation; either version 2.1 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 Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser 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.
+ *****************************************************************************/
+
+#ifdef HAVE_CONFIG_H
+# include <config.h>
+#endif
+
+#include <stdarg.h>
+
+#include <vlc_common.h>
+#include <vlc_plugin.h>
+#include <vlc_vout_window.h>
+
+static int Control(vout_window_t *wnd, int query, va_list ap)
+{
+    switch (query)
+    {
+        case VOUT_WINDOW_SET_SIZE:
+        {
+            unsigned width = va_arg(ap, unsigned);
+            unsigned height = va_arg(ap, unsigned);
+
+            vout_window_ReportSize(wnd, width, height);
+            return VLC_SUCCESS;
+        }
+
+        case VOUT_WINDOW_SET_STATE:
+        case VOUT_WINDOW_SET_FULLSCREEN:
+            /* These controls deserve a proper window provider. Move along. */
+            return VLC_EGENERIC;
+
+        default:
+            msg_Warn(wnd, "unsupported control query %d", query);
+            return VLC_EGENERIC;
+    }
+}
+
+static int Open(vout_window_t *wnd, const vout_window_cfg_t *cfg)
+{
+    wnd->type = VOUT_WINDOW_TYPE_DUMMY;
+    wnd->control = Control;
+    vout_window_ReportSize(wnd, cfg->width, cfg->height);
+    return VLC_SUCCESS;
+}
+
+vlc_module_begin()
+    set_shortname(N_("Dummy window"))
+    set_description(N_("Dummy window"))
+    set_category(CAT_VIDEO)
+    set_subcategory(SUBCAT_VIDEO_VOUT)
+    set_capability("vout window", 1)
+    set_callbacks(Open, NULL)
+vlc_module_end()



More information about the vlc-commits mailing list