[vlc-devel] Re: playlist API
Sam Hocevar
sam at zoy.org
Wed Jan 29 18:02:44 CET 2003
On Wed, Jan 29, 2003, Stephan Assmus wrote:
> Here is my proposal for an easier but more powerful API:
>
> playlist_item_t* playlist_ItemAt( int index );
> int playlist_AddItem( playlist_item_t* item, int index = - 1 );
> int playlist_RemoveItem( playlist_item_t* item );
> playlist_item_t* playlist_RemoveItem( int index );
Be careful that this is not enough. The current API sucks a lot, but
this is mainly due to locking (several threads may be accessing the
playlist at the same time). I think your proposal needs at least two
additional functions to work properly (playlist_Lock/playlist_Unlock).
> With these four simple functions, any playlist modification is
> possible. The most annoying thing about the current API is, that items
> actually get freed when you remove them.
Let's implement playlist_Swap( int index1, int index2 ), so that
bubble sort is trivial to implement! (just joking)
> This caused me troubles when
> trying to implement sorting. In my API, no function would do any
> allocating or freeing of the items. That would be left up to the
> caller.
My opinion is that the caller should not necessarily know what is
in p_item, which is a playlist's internal type, but still be able
to delete items.
> The power in my API lies in the fact, that you can disconnect
> playlist items from the list and add them at another index.
This could be done with a playlist_MoveItem function.
> An additional playlist_DeleteItem() is still needed, and that function
> should also take care of actually stopping the playback if the deleted
> item happens to be the currently played item. Currently,
> playlist_Delete() does nothing in that regard.
Hehe, my feeling was that the deleted item should continue playing,
but it can probably be made a config option :)
> Last but not least, playlist_Add( const char* path ) would be
> convenient to keep arround.
> If you are in trouble, please contact <postmaster at videolan.org>
Agreed.
--
Sam.
--
This is the vlc-devel mailing-list, see http://www.videolan.org/vlc/
To unsubscribe, please read http://developers.videolan.org/lists.html
If you are in trouble, please contact <postmaster at videolan.org>
More information about the vlc-devel
mailing list