- vlc_object_destroy( p_playlist );
-}
-
-/*****************************************************************************
- * playlist_Add: add an item to the playlist
- *****************************************************************************
- * Add an item to the playlist at position i_pos. If i_pos is PLAYLIST_END,
- * add it at the end regardless of the playlist current size.
- *****************************************************************************/
-int playlist_Add( playlist_t *p_playlist, const char * psz_target,
- int i_mode, int i_pos )
-{
- playlist_item_t * p_item;
-
- p_item = malloc( sizeof( playlist_item_t ) );
- if( p_item == NULL )
- {
- msg_Err( p_playlist, "out of memory" );
- }
-
- p_item->psz_name = strdup( psz_target );
- p_item->psz_uri = strdup( psz_target );
- p_item->i_type = 0;
- p_item->i_status = 0;
- p_item->b_autodeletion = VLC_FALSE;
-
- return playlist_AddItem( p_playlist, p_item, i_mode, i_pos );
-}
-
-
-int playlist_AddItem( playlist_t *p_playlist, playlist_item_t * p_item,
- int i_mode, int i_pos)
-{
-
- vlc_mutex_lock( &p_playlist->object_lock );
-
- /*
- * CHECK_INSERT : checks if the item is already enqued before
- * enqueing it
- */
- if ( i_mode & PLAYLIST_CHECK_INSERT )
- {
- int j;
-
- if ( p_playlist->pp_items )
- {
- for ( j = 0; j < p_playlist->i_size; j++ )
- {
- if ( !strcmp( p_playlist->pp_items[j]->psz_uri, p_item->psz_uri ) )
- {
- if( p_item->psz_name )
- {
- free( p_item->psz_name );
- }
- if( p_item->psz_uri )
- {
- free( p_item->psz_uri );
- }
- free( p_item );
- vlc_mutex_unlock( &p_playlist->object_lock );
- return 0;
- }
- }
- }
- i_mode &= ~PLAYLIST_CHECK_INSERT;
- i_mode |= PLAYLIST_APPEND;
- }
-
-
- msg_Dbg( p_playlist, "adding playlist item « %s »", p_item->psz_name );
-
- /* Create the new playlist item */
-
-
- /* Do a few boundary checks and allocate space for the item */
- if( i_pos == PLAYLIST_END )
- {
- if( i_mode & PLAYLIST_INSERT )
- {
- i_mode &= ~PLAYLIST_INSERT;
- i_mode |= PLAYLIST_APPEND;
- }
-
- i_pos = p_playlist->i_size - 1;
- }
-
- if( !(i_mode & PLAYLIST_REPLACE)
- || i_pos < 0 || i_pos >= p_playlist->i_size )
- {
- /* Additional boundary checks */
- if( i_mode & PLAYLIST_APPEND )
- {
- i_pos++;
- }
-
- if( i_pos < 0 )
- {
- i_pos = 0;
- }
- else if( i_pos > p_playlist->i_size )
- {
- i_pos = p_playlist->i_size;
- }
-
- INSERT_ELEM( p_playlist->pp_items,
- p_playlist->i_size,
- i_pos,
- p_item );
-
- if( p_playlist->i_index >= i_pos )
- {
- p_playlist->i_index++;
- }
- }
- else
+ var_Destroy( p_playlist, "intf-change" );
+ var_Destroy( p_playlist, "item-change" );
+ var_Destroy( p_playlist, "playlist-current" );
+ var_Destroy( p_playlist, "intf-popmenu" );
+ var_Destroy( p_playlist, "intf-show" );
+ var_Destroy( p_playlist, "prevent-skip" );
+ var_Destroy( p_playlist, "random" );
+ var_Destroy( p_playlist, "repeat" );
+ var_Destroy( p_playlist, "loop" );
+
+ while( p_playlist->i_groups > 0 )