<html><head></head><body>Hi,<br><br>Creating a decoder device is unfortunately potentially both slow and memory-intensive. It must be avoided when not actually necessary, so this patch does not seem acceptable.<br><br><div class="gmail_quote">Le 5 juillet 2019 17:19:40 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">The decoder device ("dec-dev") won't change during the lifetime of the window<br>enabled state.<hr> include/vlc_vout_display.h | 4 +++-<br> modules/video_output/splitter.c | 7 ++++---<br> src/video_output/display.c | 13 +------------<br> src/video_output/video_output.c | 9 +++++++++<br> src/video_output/vout_internal.h | 4 ++++<br> src/video_output/vout_wrapper.c | 4 ++--<br> 6 files changed, 23 insertions(+), 18 deletions(-)<br><br>diff --git a/include/vlc_vout_display.h b/include/vlc_vout_display.h<br>index aa00003c8e..8ede049dc7 100644<br>--- a/include/vlc_vout_display.h<br>+++ b/include/vlc_vout_display.h<br>@@ -305,7 +305,9 @@ struct vout_display_t {<br> */<br> VLC_API<br> vout_display_t *vout_display_New(vlc_object_t *, const video_format_t *,<br>- const vout_display_cfg_t *, const char *module,<br>+ const vout_display_cfg_t *,<br>+ vlc_video_context *video_context,<br>+ const char *module,<br> const vout_display_owner_t *);<br> <br> /**<br>diff --git a/modules/video_output/splitter.c b/modules/video_output/splitter.c<br>index de7396788d..8d79794852 100644<br>--- a/modules/video_output/splitter.c<br>+++ b/modules/video_output/splitter.c<br>@@ -228,12 +228,13 @@ static vout_window_t *video_splitter_CreateWindow(vlc_object_t *obj,<br> static vout_display_t *vlc_vidsplit_CreateDisplay(vlc_object_t *obj,<br> const video_format_t *restrict source,<br> const vout_display_cfg_t *restrict cfg,<br>+ vlc_video_context *vctx,<br> const char *name)<br> {<br> vout_display_owner_t owner = {<br> .event = vlc_vidsplit_display_Event,<br> };<br>- return vout_display_New(obj, source, cfg, name, &owner);<br>+ return vout_display_New(obj, source, cfg, vctx, name, &owner);<br> }<br> <br> static int vlc_vidsplit_Open(vout_display_t *vd,<br>@@ -306,7 +307,7 @@ static int vlc_vidsplit_Open(vout_display_t *vd,<br> }<br> <br> vdcfg.window = part->window;<br>- display = vlc_vidsplit_CreateDisplay(obj, &output->fmt, &vdcfg,<br>+ display = vlc_vidsplit_CreateDisplay(obj, &output->fmt, &vdcfg, ctx,<br> modname);<br> if (display == NULL) {<br> vout_window_Disable(part->window);<br>@@ -326,7 +327,7 @@ static int vlc_vidsplit_Open(vout_display_t *vd,<br> vd->prepare = vlc_vidsplit_Prepare;<br> vd->display = vlc_vidsplit_Display;<br> vd->control = vlc_vidsplit_Control;<br>- (void) cfg; (void) fmtp; (void) ctx;<br>+ (void) cfg; (void) fmtp;<br> return VLC_SUCCESS;<br> }<br> <br>diff --git a/src/video_output/display.c b/src/video_output/display.c<br>index 2173bb084e..d37972a9a7 100644<br>--- a/src/video_output/display.c<br>+++ b/src/video_output/display.c<br>@@ -293,9 +293,6 @@ typedef struct {<br> atomic_bool reset_pictures;<br> #endif<br> picture_pool_t *pool;<br>-<br>- /* temporary: must come from decoder module */<br>- vlc_video_context video_context;<br> } vout_display_priv_t;<br> <br> static const struct filter_video_callbacks vout_display_filter_cbs = {<br>@@ -740,6 +737,7 @@ void vout_SetDisplayViewpoint(vout_display_t *vd,<br> vout_display_t *vout_display_New(vlc_object_t *parent,<br> const video_format_t *source,<br> const vout_display_cfg_t *cfg,<br>+ vlc_video_context *video_context,<br> const char *module,<br> const vout_display_owner_t *owner)<br> {<br>@@ -777,10 +775,6 @@ vout_display_t *vout_display_New(vlc_object_t *parent,<br> vd->sys = NULL;<br> vd->owner = *owner;<br> <br>- osys->video_context.device = vlc_decoder_device_Create(osys->cfg.window);<br>- vlc_video_context *video_context = osys->video_context.device ?<br>- &osys->video_context : NULL;<br>-<br> vd->module = vlc_module_load(vd, "vout display", module,<br> module && *module != '\0',<br> vout_display_start, vd, &osys->cfg,<br>@@ -811,8 +805,6 @@ vout_display_t *vout_display_New(vlc_object_t *parent,<br> return vd;<br> error:<br> video_format_Clean(&vd->source);<br>- if (osys->video_context.device)<br>- vlc_decoder_device_Release(osys->video_context.device);<br> vlc_object_delete(vd);<br> return NULL;<br> }<br>@@ -832,9 +824,6 @@ void vout_display_Delete(vout_display_t *vd)<br> vlc_objres_clear(VLC_OBJECT(vd));<br> }<br> <br>- if (osys->video_context.device)<br>- vlc_decoder_device_Release(osys->video_context.device);<br>-<br> video_format_Clean(&vd->source);<br> video_format_Clean(&vd->fmt);<br> vlc_object_delete(vd);<br>diff --git a/src/video_output/video_output.c b/src/video_output/video_output.c<br>index 490d1fa97e..687fb2b932 100644<br>--- a/src/video_output/video_output.c<br>+++ b/src/video_output/video_output.c<br>@@ -49,6 +49,7 @@<br> #include <vlc_vout_osd.h><br> #include <vlc_image.h><br> #include <vlc_plugin.h><br>+#include <vlc_codec.h><br> <br> #include <libvlc.h><br> #include "vout_internal.h"<br>@@ -1681,6 +1682,8 @@ void vout_Stop(vout_thread_t *vout)<br> vout_StopDisplay(vout);<br> <br> vlc_mutex_lock(&sys->window_lock);<br>+ vlc_decoder_device_Release(sys->dec_device);<br>+ sys->dec_device = NULL;<br> if (sys->window_enabled) {<br> vout_window_Disable(sys->display_cfg.window);<br> sys->window_enabled = false;<br>@@ -1914,6 +1917,10 @@ int vout_Request(const vout_configuration_t *cfg, input_thread_t *input)<br> goto error;<br> }<br> sys->window_enabled = true;<br>+<br>+ sys->dec_device = vlc_decoder_device_Create(sys->display_cfg.window);<br>+ /* temporary until it comes from the decoder/filters */<br>+ sys->video_context.device = sys->dec_device;<br> } else<br> vout_UpdateWindowSizeLocked(vout);<br> <br>@@ -1929,6 +1936,8 @@ int vout_Request(const vout_configuration_t *cfg, input_thread_t *input)<br> vlc_mutex_lock(&sys->window_lock);<br> vout_window_Disable(sys->display_cfg.window);<br> sys->window_enabled = false;<br>+ vlc_decoder_device_Release(sys->dec_device);<br>+ sys->dec_device = NULL;<br> vlc_mutex_unlock(&sys->window_lock);<br> goto error;<br> }<br>diff --git a/src/video_output/vout_internal.h b/src/video_output/vout_internal.h<br>index 3c5a7e2688..5a60a2926c 100644<br>--- a/src/video_output/vout_internal.h<br>+++ b/src/video_output/vout_internal.h<br>@@ -179,6 +179,10 @@ struct vout_thread_sys_t<br> vout_display_t *display;<br> vlc_mutex_t display_lock;<br> <br>+ vlc_decoder_device *dec_device;<br>+ /* temporary: must come from decoder module */<br>+ vlc_video_context video_context;<br>+<br> picture_pool_t *private_pool;<br> picture_pool_t *display_pool;<br> picture_pool_t *decoder_pool;<br>diff --git a/src/video_output/vout_wrapper.c b/src/video_output/vout_wrapper.c<br>index 61046f2be0..e24f6ec793 100644<br>--- a/src/video_output/vout_wrapper.c<br>+++ b/src/video_output/vout_wrapper.c<br>@@ -82,8 +82,8 @@ vout_display_t *vout_OpenWrapper(vout_thread_t *vout,<br> else<br> modlist = "splitter,none";<br> <br>- vd = vout_display_New(VLC_OBJECT(vout), &sys->original, cfg, modlist,<br>- &owner);<br>+ vd = vout_display_New(VLC_OBJECT(vout), &sys->original, cfg,<br>+ &sys->video_context, modlist, &owner);<br> free(modlistbuf);<br> <br> if (vd == NULL)</pre></blockquote></div><br>-- <br>Envoyé de mon appareil Android avec Courriel K-9 Mail. Veuillez excuser ma brièveté.</body></html>