+ 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->status.p_node );
+ 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->status.p_node, 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 );
+}
+
+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 )
+{
+ assert( PL );
+ if( playlist_was_locked( p_instance ) )