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

Thomas Guillem thomas at gllm.fr
Tue Sep 29 10:10:04 CEST 2020



On Mon, Sep 28, 2020, at 17:48, Rémi Denis-Courmont wrote:
> 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?

Yes it will, but only for copy of medias.

If you create a media, play or preparse it, you will get updates.

> 
> >  }
> > 
> >  // Create a media with a certain given media resource location
> 
> 
> -- 
> Реми Дёни-Курмон
> http://www.remlab.net/
> 
> 
> 
> _______________________________________________
> 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