[vlc-devel] [PATCH 1/2] lib: media_player: keep player libvlc instance

Alexandre Janniaux ajanni at videolabs.io
Thu Jul 16 10:52:29 CEST 2020


Hi,

On Wed, Jul 15, 2020 at 10:55:46PM +0300, Rémi Denis-Courmont wrote:
> Le keskiviikkona 15. heinäkuuta 2020, 21.24.12 EEST Thomas Guillem a écrit :
> > On Wed, Jul 15, 2020, at 18:26, Rémi Denis-Courmont wrote:
> > > Le torstaina 9. heinäkuuta 2020, 18.21.50 EEST Alexandre Janniaux a écrit
> :
> > > > The media_player instance retains and releases the libvlc instance it's
> > > > created from. When using a different libvlc instance for media_player
> > > > and media,
> > >
> > > Frankly, it makes zero sense for a media to be tied to an instance in the
> > > first place. input_item_t is not tied to an instance. I think you're
> > > looking at it from the wrong angle.
> > >
> > > Of course, an instance is necessary for certain operation on the media:
> > > playing, parsing, etc. In all those case, we should do one of the
> > > following: 1) implicitly use the instance from the actor object (as media
> > > player does)
> > I vote for 1/, we should create a libvlc_parser API. That way we can remove
> > the instance from the media.
> > > 2) create an instance automatically,
> > > 3) take an explicit instance pointer as parameter.
>
> I tend to agree that (1) is better than either (2) or (3). There should be
> separate player, meta reader, thumbnailer and meta writer objects. Only the
> first one exists as yet.
>
> But I don't know if the new functions should create their own private VLC
> instance, require a supplied VLC instance, or leave the choice of either (i.e.
> create an instance if the instance parameter is NULL).

I tend to think that default in C is not really that idiomatic
nor easy to use/understand for the actual libvlc users.

libvlc_new() is easy to call and refcounting makes it easy to
just allocate the instance, allocate the actor object, and
release the instance, while providing a good habit of how the
libvlc API are working for the user.

Regards,
--
Alexandre Janniaux
Videolabs


More information about the vlc-devel mailing list