[vlc-devel] [PATCH 07/38] video_output: split vout_Request to have a function to enable the vout window

Thomas Guillem thomas at gllm.fr
Wed Oct 2 08:46:41 CEST 2019



On Tue, Oct 1, 2019, at 13:12, Steve Lhomme wrote:
> ---
>  src/video_output/video_output.c | 23 ++++++++++++++++++-----
>  1 file changed, 18 insertions(+), 5 deletions(-)
> 
> diff --git a/src/video_output/video_output.c b/src/video_output/video_output.c
> index bd4741a164d..131fda74225 100644
> --- a/src/video_output/video_output.c
> +++ b/src/video_output/video_output.c
> @@ -1905,7 +1905,7 @@ vout_thread_t *vout_Hold(vout_thread_t *vout)
>      return vout;
>  }
>  
> -int vout_Request(const vout_configuration_t *cfg, input_thread_t 
> *input)
> +static int VoutEnsureEnabledWindow(const vout_configuration_t *cfg)

Nitpick: I would prefer VoutEnableWindow because this is still the main goal of this function.

>  {
>      vout_thread_t *vout = cfg->vout;
>      vout_thread_sys_t *sys = vout->p;
> @@ -1913,7 +1913,6 @@ int vout_Request(const vout_configuration_t *cfg, 
> input_thread_t *input)
>      assert(!sys->dummy);
>      assert(vout != NULL);
>      assert(cfg->fmt != NULL);
> -    assert(cfg->clock != NULL);
>  
>      if (!VoutCheckFormat(cfg->fmt))
>          return -1;
> @@ -1958,19 +1957,33 @@ int vout_Request(const vout_configuration_t 
> *cfg, input_thread_t *input)
>  
>          if (vout_window_Enable(sys->display_cfg.window, &wcfg)) {
>              vlc_mutex_unlock(&sys->window_lock);
> -            goto error;
> +            msg_Err(vout, "window enabling failed");
> +            video_format_Clean(&sys->original);
> +            return -1;
>          }
>          sys->window_enabled = true;
>      } else
>          vout_UpdateWindowSizeLocked(vout);
> +    vlc_mutex_unlock(&sys->window_lock);
> +
> +    return 0;
> +}
> +
> +int vout_Request(const vout_configuration_t *cfg, input_thread_t *input)
> +{
> +    vout_thread_t *vout = cfg->vout;
> +    vout_thread_sys_t *sys = vout->p;
> +
> +    assert(cfg->clock != NULL);
> +
> +    if (VoutEnsureEnabledWindow(cfg) != 0)
> +        return -1;
>  
>      sys->delay = 0;
>      sys->rate = 1.f;
>      sys->clock = cfg->clock;
>      sys->delay = 0;
>  
> -    vlc_mutex_unlock(&sys->window_lock);
> -
>      if (vout_Start(vout, cfg))
>      {
>          vlc_mutex_lock(&sys->window_lock);
> -- 
> 2.17.1
> 
> _______________________________________________
> vlc-devel mailing list
> To unsubscribe or modify your subscription options:
> https://mailman.videolan.org/listinfo/vlc-devel


More information about the vlc-devel mailing list