[vlc-devel] [PATCH 1/4] video_output: add a wextern window which doesn't let the core resize it

Steve Lhomme robux4 at ycbcr.xyz
Fri May 24 16:31:43 CEST 2019


Instead the display module can call vout_window_ReportSize() on its behalf.
---
 modules/video_output/Makefile.am |  2 ++
 modules/video_output/wextern.c   | 60 ++++++++++++++++++++++++++++++++
 2 files changed, 62 insertions(+)
 create mode 100644 modules/video_output/wextern.c

diff --git a/modules/video_output/Makefile.am b/modules/video_output/Makefile.am
index d9a2488ad4..7983d3637b 100644
--- a/modules/video_output/Makefile.am
+++ b/modules/video_output/Makefile.am
@@ -477,6 +477,7 @@ libvdummy_plugin_la_SOURCES = video_output/vdummy.c
 libvideo_splitter_plugin_la_SOURCES = video_output/splitter.c
 libvmem_plugin_la_SOURCES = video_output/vmem.c
 libwdummy_plugin_la_SOURCES = video_output/wdummy.c
+libwextern_plugin_la_SOURCES = video_output/wextern.c
 libyuv_plugin_la_SOURCES = video_output/yuv.c
 libvgl_plugin_la_SOURCES = video_output/vgl.c
 
@@ -486,5 +487,6 @@ vout_LTLIBRARIES += \
 	libvideo_splitter_plugin.la \
 	libvmem_plugin.la \
 	libwdummy_plugin.la \
+	libwextern_plugin.la \
 	libvgl_plugin.la \
 	libyuv_plugin.la
diff --git a/modules/video_output/wextern.c b/modules/video_output/wextern.c
new file mode 100644
index 0000000000..da085f65f4
--- /dev/null
+++ b/modules/video_output/wextern.c
@@ -0,0 +1,60 @@
+/**
+ * @file wextern.c
+ * @brief Dummy video window provider where the size is handled externally
+ */
+/*****************************************************************************
+ * Copyright © 2019 VideoLabs, VideoLAN and VideoLAN Authors
+ *
+ * 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 Enable(vout_window_t *wnd, const vout_window_cfg_t *cfg)
+{
+    vout_window_ReportSize(wnd, cfg->width, cfg->height);
+    return VLC_SUCCESS;
+}
+
+static const struct vout_window_operations ops = {
+    .enable = Enable,
+    // .resize: don't let the core resize us on zoom/crop/ar changes
+    //          the display module should do the ReportSize for us
+};
+
+static int Open(vout_window_t *wnd)
+{
+    wnd->type = VOUT_WINDOW_TYPE_DUMMY;
+    wnd->ops = &ops;
+    return VLC_SUCCESS;
+}
+
+vlc_module_begin()
+    set_shortname(N_("Callback window"))
+    set_description(N_("External callback window"))
+    set_category(CAT_VIDEO)
+    set_subcategory(SUBCAT_VIDEO_VOUT)
+    set_capability("vout window", 0)
+    set_callbacks(Open, NULL)
+    add_shortcut("dummy")
+vlc_module_end()
-- 
2.17.1



More information about the vlc-devel mailing list