- VLC_UNUSED(p_e); VLC_UNUSED(i_options); VLC_UNUSED(ppsz_options);
-
- int did_lock = 0;
- assert( PL );
- ///\todo Handle additionnal options
-
- if( PL->items.i_size == 0 ) RAISEVOID( "Empty playlist" );
- if( i_id > 0 )
- {
- playlist_item_t *p_item;
- if (! playlist_was_locked( p_instance ) )
- {
- playlist_mark_locked( p_instance, 1 );
- vlc_object_lock( PL );
- did_lock = 1;
- }
-
- p_item = playlist_ItemGetByInputId( PL, i_id,
- PL->p_root_category );
- if( !p_item )
- {
- if( did_lock == 1 )
- {
- vlc_object_unlock( PL );
- playlist_mark_locked( p_instance, 0 );
- }
- RAISEVOID( "Unable to find item" );
- }
-
- playlist_Control( PL, PLAYLIST_VIEWPLAY, pl_Locked,
- PL->p_root_category, p_item );
- if( did_lock == 1 )
- {
- vlc_object_unlock( PL );
- playlist_mark_locked( p_instance, 0 );
- }
- }
- else
- {
- playlist_Control( PL, PLAYLIST_PLAY,
- playlist_was_locked( p_instance ) );
- }
-}
-
-void libvlc_playlist_pause( libvlc_instance_t *p_instance,
- libvlc_exception_t *p_e )
-{
- assert( PL );
- if( playlist_Control( PL, PLAYLIST_PAUSE,
- playlist_was_locked( p_instance ) ) != VLC_SUCCESS )
- RAISEVOID( "Empty playlist" );
-}
-
-
-void libvlc_playlist_stop( libvlc_instance_t *p_instance,
- libvlc_exception_t *p_e )
-{
- assert( PL );
- if( playlist_Control( PL, PLAYLIST_STOP,
- playlist_was_locked( p_instance ) ) != VLC_SUCCESS )
- RAISEVOID( "Empty playlist" );
-}
-
-void libvlc_playlist_clear( libvlc_instance_t *p_instance,
- libvlc_exception_t *p_e )
-{
- VLC_UNUSED(p_e);
-
- assert( PL );
- playlist_Clear( PL, playlist_was_locked( p_instance ) );
-}
-
-void libvlc_playlist_next( libvlc_instance_t *p_instance,
- libvlc_exception_t *p_e )
-{
- assert( PL );
- if( playlist_Control( PL, PLAYLIST_SKIP, playlist_was_locked( p_instance ),
- 1 ) != VLC_SUCCESS )
- RAISEVOID( "Empty playlist" );
-}
-
-void libvlc_playlist_prev( libvlc_instance_t *p_instance,
- libvlc_exception_t *p_e )
-{
- if( playlist_Control( PL, PLAYLIST_SKIP, playlist_was_locked( p_instance ),
- -1 ) != VLC_SUCCESS )
- RAISEVOID( "Empty playlist" );
-}
-
-int libvlc_playlist_add( libvlc_instance_t *p_instance, const char *psz_uri,
- const char *psz_name, libvlc_exception_t *p_e )
-{
- return libvlc_playlist_add_extended( p_instance, psz_uri, psz_name,
- 0, NULL, p_e );
-}
-
-static int PlaylistAddExtended( libvlc_instance_t *p_instance,
- const char *psz_uri, const char *psz_name,
- int i_options, const char **ppsz_options,
- unsigned i_option_flags,
- libvlc_exception_t *p_e )
-{
- assert( PL );
- if( playlist_was_locked( p_instance ) )
- {
- libvlc_exception_raise( p_e, "You must unlock playlist before "
- "calling libvlc_playlist_add" );
- return VLC_EGENERIC;
- }
- return playlist_AddExt( PL, psz_uri, psz_name,
- PLAYLIST_INSERT, PLAYLIST_END, -1,
- i_options, ppsz_options, i_option_flags,
- true, pl_Unlocked );
-}
-int libvlc_playlist_add_extended( libvlc_instance_t *p_instance,
- const char *psz_uri, const char *psz_name,
- int i_options, const char **ppsz_options,
- libvlc_exception_t *p_e )
-{
- return PlaylistAddExtended( p_instance, psz_uri, psz_name,
- i_options, ppsz_options, VLC_INPUT_OPTION_TRUSTED,
- p_e );
-}
-int libvlc_playlist_add_extended_untrusted( libvlc_instance_t *p_instance,
- const char *psz_uri, const char *psz_name,
- int i_options, const char **ppsz_options,
- libvlc_exception_t *p_e )
-{
- return PlaylistAddExtended( p_instance, psz_uri, psz_name,
- i_options, ppsz_options, 0,
- p_e );
-}
-
-int libvlc_playlist_delete_item( libvlc_instance_t *p_instance, int i_id,
- libvlc_exception_t *p_e )
-{
- assert( PL );
-
- if( playlist_DeleteFromInput( PL, i_id,
- playlist_was_locked( p_instance ) ) )
- {
- libvlc_exception_raise( p_e, "deletion failed" );
- return VLC_ENOITEM;
- }
- return VLC_SUCCESS;
-}
-
-int libvlc_playlist_isplaying( libvlc_instance_t *p_instance,
- libvlc_exception_t *p_e )
-{