[vlc-devel] [PATCHv3 1/7] input_item: add an owner placeholder
Thomas Guillem
thomas at gllm.fr
Tue Sep 22 17:36:55 CEST 2020
On Tue, Sep 22, 2020, at 17:10, Rémi Denis-Courmont wrote:
> Le tiistaina 22. syyskuuta 2020, 15.09.52 EEST Thomas Guillem a écrit :
> > This will be used by libvlc_media to store the media instance into an
> > input_item. This will allow to get the media corresponding to an item
> > when propagating media events.
>
> There seems to be an inconsistency here.
>
> We don't have owner data right now, because an input item can be referenced
> and monitored by multiple parties. I don't understand how a single owner
> pointer works with potentially multiple callbacks from different listener.
I identify 4 ways to create an input_item_t that will end up referenced by a libvlc_media_t.
- Created by the user, via libvlc_media_new_from_*()
- Created by the player (via demux_t the ES_OUT_POST_SUBNODE control)
- Created by a preparser via stream_t.pf_readdir (that finish in demux_t ES_OUT_POST_SUBNODE control).
- Created by services discoveries modules.
In the last 3 cases, libvlc_media_t is not the natural owner of the input_item_t, that is why it is cloned in "lib: media: copy the input item". I checked, we don't any demux_t, stream_t or sd modules that are updating an item after sending it.
Therefore, the input_item owned by libvlc_media_t is always referenced by only one owner: libvlc_media_t.
But you are right, this approach will not work when multiple parties are involved (medialib for example ?).
I suggest to rename owner_data to libvlc_owner (still a void *) to avoid any confusion.
The most important is that the libvlc_media_player will continue to receive input_item updates when it plays it. Indeed, there is no way to play a media that is not added by the user.
>
> I'm not saying that the current approach is right and immutable. In fact, most
> other object types with callbacks have a single owner and a single set of
> callbacks, and maybe that's how input item should be.
>
> But at least the current approach is self-consistent.
>
> --
> レミ・デニ-クールモン
> 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