[vlc-devel] [PATCH] playlist: swipe away the category / onelevel mess -> singular item storage

Jakob Leben jakob.leben at gmail.com
Mon Feb 1 15:47:27 CET 2010


On Mon, Feb 1, 2010 at 12:36 PM, Laurent Aimar <fenrir at via.ecp.fr> wrote:

> Hi,
>
> On Mon, Feb 01, 2010, Jakob Leben wrote:
> >    Hi all!
> >
> > +void input_item_BeginAddSubItems( input_item_t *p_item )
> > +{
> > +  vlc_event_t event;
> > +  event.type = vlc_InputItemBeginAddSubItems;
> > +  vlc_event_send( &p_item->event_manager, &event );
> > +}
> > +
> > +void input_item_EndAddSubItems( input_item_t *p_item )
> > +{
> > +  vlc_event_t event;
> > +  event.type = vlc_InputItemEndAddSubItems;
> > +  vlc_event_send( &p_item->event_manager, &event );
> > +}
>  Why are they needed ?
>  They are a call to future bugs (way too easy to forget them
> or to break when moving arround code).
>

Yes, I am aware of that. The point is, if we are in flat mode so we do
delete the parent when it gets sub items, we can not do that just on first
created sub-item, because we still have to listen to
vlc_InputItemAddSubItems event. So we have to delete and clear references to
it _after_ it has created all sub-items. But how do we know when is after?
That is why at least the InputItemEndAddSubItems was needed.

Another idea was to have an event that reports for all the new children
together, so modules should create an array and pass that in the event. That
demanded much more work on the side of the modules, so I went the way I did
for simplicity. You are right, simplicity is not the best argument.



>   I am a bit suspucious about the locking but I haven't really checked it.
>

Hmm, yes, right, I am suspicious too on second thought... I shall improve
that.

Best regards
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.videolan.org/pipermail/vlc-devel/attachments/20100201/2e11560a/attachment.html>


More information about the vlc-devel mailing list