[vlc-devel] [PATCH 02/13] resource: allow to create a vout without config

Thomas Guillem thomas at gllm.fr
Tue Apr 16 16:25:03 CEST 2019


Please ignore this patch set. I will send a new one.

On Mon, Apr 15, 2019, at 15:51, Thomas Guillem wrote:
> ---
>  src/input/resource.c | 25 ++++++++++++++++---------
>  1 file changed, 16 insertions(+), 9 deletions(-)
> 
> diff --git a/src/input/resource.c b/src/input/resource.c
> index 0812db6fe6..01a2889655 100644
> --- a/src/input/resource.c
> +++ b/src/input/resource.c
> @@ -372,21 +372,16 @@ void input_resource_SetInput( input_resource_t 
> *p_resource, input_thread_t *p_in
>  vout_thread_t *input_resource_GetVout(input_resource_t *p_resource,
>                                        const vout_configuration_t *cfg)
>  {
> -    vout_configuration_t cfg_buf;
>      vout_thread_t *vout;
>  
> -    assert(cfg != NULL);
> -    assert(cfg->fmt != NULL);
>      vlc_mutex_lock( &p_resource->lock );
>  
> -    if (cfg->vout == NULL) {
> -        cfg_buf = *cfg;
> -        cfg_buf.vout = p_resource->p_vout_free;
> +    if (cfg == NULL || cfg->vout == NULL) {
> +        vout = p_resource->p_vout_free;
>          p_resource->p_vout_free = NULL;
> -        cfg = &cfg_buf;
>  
> -        if (cfg_buf.vout == NULL) {
> -            cfg_buf.vout = vout = vout_Create(p_resource->p_parent);
> +        if (vout == NULL) {
> +            vout = vout_Create(p_resource->p_parent);
>              if (vout == NULL)
>                  goto out;
>          } else
> @@ -397,8 +392,20 @@ vout_thread_t 
> *input_resource_GetVout(input_resource_t *p_resource,
>          vlc_mutex_lock(&p_resource->lock_hold);
>          TAB_REMOVE(p_resource->i_vout, p_resource->pp_vout, cfg->vout);
>          vlc_mutex_unlock(&p_resource->lock_hold);
> +        vout = cfg->vout;
> +    }
> +
> +    if (!cfg) {
> +        vlc_mutex_unlock(&p_resource->lock);
> +        return vout;
>      }
>  
> +    vout_configuration_t cfg_buf = *cfg;
> +    cfg_buf.vout = vout;
> +    cfg = &cfg_buf;
> +
> +    assert(cfg->fmt != NULL);
> +
>      if (vout_Request(cfg, p_resource->p_input)) {
>          vlc_mutex_unlock(&p_resource->lock);
>          input_resource_PutVout(p_resource, cfg->vout);
> -- 
> 2.20.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