[vlc-devel] [PATCHv3 6/7] lib: media: copy the input item

Rémi Denis-Courmont remi at remlab.net
Mon Sep 28 17:48:30 CEST 2020


Le tiistaina 22. syyskuuta 2020, 15.09.57 EEST Thomas Guillem a écrit :
> In order to avoid having more than one libvlc_media_t using the same
> input_item_t.
> 
> And to assert that one input_item has only one unique owner. Cf. next
> commit.
> ---
>  lib/media.c | 5 ++++-
>  1 file changed, 4 insertions(+), 1 deletion(-)
> 
> diff --git a/lib/media.c b/lib/media.c
> index 0c1a58be8cd..da0e5777b5c 100644
> --- a/lib/media.c
> +++ b/lib/media.c
> @@ -511,7 +511,10 @@ libvlc_media_t * libvlc_media_new_from_input_item(
>      if( p_md == NULL )
>          return NULL;
> 
> -    return libvlc_media_attach_input_item( p_md, p_input_item );
> +    input_item_t *p_item_copy = input_item_Copy( p_input_item, NULL );
> +    if( p_item_copy != NULL )
> +        return libvlc_media_attach_input_item( p_md, p_item_copy );
> +    return NULL;

Won't that "unshare" item updates from parsing and from playing?
If so, is that expected by apps?

>  }
> 
>  // Create a media with a certain given media resource location


-- 
Реми Дёни-Курмон
http://www.remlab.net/





More information about the vlc-devel mailing list