<html><head></head><body>It's OK to call concurrently *if* you don't care about the size. But if you don't, then why bother with this patch to begin with??<br><br><div class="gmail_quote">Le 7 mai 2019 11:35:10 GMT+03:00, Steve Lhomme <robux4@ycbcr.xyz> a écrit :<blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;">
<pre class="k9mail"><br><br>On 2019-05-06 16:39, Rémi Denis-Courmont wrote:<br><blockquote class="gmail_quote" style="margin: 0pt 0pt 1ex 0.8ex; border-left: 1px solid #729fcf; padding-left: 1ex;">Le maanantaina 6. toukokuuta 2019, 16.01.36 EEST Steve Lhomme a écrit :<br><blockquote class="gmail_quote" style="margin: 0pt 0pt 1ex 0.8ex; border-left: 1px solid #ad7fa8; padding-left: 1ex;"> The libvlc_video_set_rendering_size() set the width/height and the<br> host_window module receives the change and tell the display module about<br> the new size to render into.<hr>   lib/media_player.c                 |   2 +-<br>   modules/video_output/Makefile.am   |   2 +<br>   modules/video_output/host_window.c | 105 +++++++++++++++++++++++++++++<br>   3 files changed, 108 insertions(+), 1 deletion(-)<br>   create mode 100644 modules/video_output/host_window.c<br><br> diff --git a/lib/media_player.c b/lib/media_player.c<br> index 64d8a873fb..3e05d52fd9 100644<br> --- a/lib/media_player.c<br> +++ b/lib/media_player.c<br> @@ -1214,7 +1214,7 @@ int libvlc_video_surface_set_callbacks(<br> libvlc_media_player_t *mp, libvlc_video_surface_start_rendering_cb<br> makeCurrent_cb, void* opaque )<br>   {<br> -    var_SetString( mp, "window", "wdummy");<br> +    var_SetString( mp, "window", "host_window");<br><br>       if ( engine == libvlc_video_rendering_direct3d11 )<br>       {<br> diff --git a/modules/video_output/Makefile.am<br> b/modules/video_output/Makefile.am index ff3648e7cb..65913a3818 100644<br> --- a/modules/video_output/Makefile.am<br> +++ b/modules/video_output/Makefile.am<br> @@ -465,6 +465,7 @@ vout_LTLIBRARIES += $(LTLIBcaca)<br>   libflaschen_plugin_la_SOURCES = video_output/flaschen.c<br>   libflaschen_plugin_la_LIBADD = $(SOCKET_LIBS)<br><br> +libhost_window_plugin_la_SOURCES = video_output/host_window.c<br>   libvdummy_plugin_la_SOURCES = video_output/vdummy.c<br>   libvideo_splitter_plugin_la_SOURCES = video_output/splitter.c<br>   libvmem_plugin_la_SOURCES = video_output/vmem.c<br> @@ -474,6 +475,7 @@ libvgl_plugin_la_SOURCES = video_output/vgl.c<br><br>   vout_LTLIBRARIES += \<br>       libflaschen_plugin.la \<br> +     libhost_window_plugin.la \<br>    libvdummy_plugin.la \<br>         libvideo_splitter_plugin.la \<br>         libvmem_plugin.la \<br> diff --git a/modules/video_output/host_window.c<br> b/modules/video_output/host_window.c new file mode 100644<br> index 0000000000..48a72e90c4<br> --- /dev/null<br> +++ b/modules/video_output/host_window.c<br> @@ -0,0 +1,105 @@<br> +/**<br> + * @file host_window.c<br> + * @brief Video window provider that can be resized externally<br> + */<br> +/**************************************************************************<br> *** + * Copyright (C) 2019 VLC authors and VideoLAN<br> + *<br> + * This program is free software; you can redistribute it and/or modify it<br> + * under the terms of the GNU Lesser General Public License as published by<br> + * the Free Software Foundation; either version 2.1 of the License, or + *<br> (at your option) any later version.<br> + *<br> + * This program is distributed in the hope that it will be useful,<br> + * but WITHOUT ANY WARRANTY; without even the implied warranty of<br> + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the<br> + * GNU Lesser General Public License for more details.<br> + *<br> + * You should have received a copy of the GNU Lesser General Public License<br> + * along with this program; if not, write to the Free Software Foundation,<br> + * Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA. +<br> ***************************************************************************<br> **/ +<br> +#ifdef HAVE_CONFIG_H<br> +# include <config.h><br> +#endif<br> +<br> +#include <vlc_common.h><br> +#include <vlc_plugin.h><br> +#include <vlc_vout_window.h><br> +<br> +static int Open( vout_window_t * );<br> +<br> +vlc_module_begin()<br> +    set_shortname(N_("Host window"))<br> +    set_description(N_("Host window"))<br> +    set_category(CAT_VIDEO)<br> +    set_subcategory(SUBCAT_VIDEO_VOUT)<br> +    set_capability("vout window", 0)<br> +    set_callbacks(Open, NULL)<br> +vlc_module_end()<br> +<br> +struct window_sys_t<br> +{<br> +    vlc_object_t *dimension_src;<br> +};<br> +<br> +static int Enable(vout_window_t *wnd, const vout_window_cfg_t *cfg)<br> +{<br> +    vout_window_ReportSize(wnd, cfg->width, cfg->height);<br> +    return VLC_SUCCESS;<br> +}<br> +<br> +static void Resize(vout_window_t *window, unsigned width, unsigned height)<br> +{<br> +    vout_window_ReportSize(window, width, height);<br> +}<br> +<br> +static int WindowSize( vlc_object_t *obj, char const *name,<br> +                        vlc_value_t oldvalue, vlc_value_t newvalue, void<br> *p_wnd ) +{<br> +    VLC_UNUSED(name);<br> +    VLC_UNUSED(oldvalue);<br> +    VLC_UNUSED(newvalue);<br> +<br> +    vout_window_t *wnd = p_wnd;<br> +    int width  = var_GetInteger(obj, "width");<br> +    int height = var_GetInteger(obj, "height");<br> +    vout_window_ReportSize( wnd, width, height);<br></blockquote>This races against Resize callback. Events are not reentrant - it wouldn't<br>make sense.<br></blockquote><br>Actually I don't understand the issue. Resize and WindowSize are indeed <br>called by different threads but the doc of vout_window_ReportSize() says:<br><br>"Thisfunctionisthread-safe.Incaseofconcurrentcall,itisundefinedwhichoneistakenintoaccount(butatleastoneis)."<br><br>So it sounds like it's OK to call it from different threads. If not I <br>can always add a lock but I'd like to understand.<hr>vlc-devel mailing list<br>To unsubscribe or modify your subscription options:<br><a href="https://mailman.videolan.org/listinfo/vlc-devel">https://mailman.videolan.org/listinfo/vlc-devel</a></pre></blockquote></div><br>-- <br>Envoyé de mon appareil Android avec Courriel K-9 Mail. Veuillez excuser ma brièveté.</body></html>