/*****************************************************************************
- * item-ext.c : Playlist item management functions
+ * item-ext.c : Playlist item management functions (act on the playlist)
*****************************************************************************
* Copyright (C) 1999-2004 VideoLAN
* $Id$
mtime_t i_duration, const char **ppsz_options,
int i_options )
{
- playlist_item_t *p_item =
- playlist_ItemNew( p_playlist , psz_uri, psz_name );
+ playlist_item_t *p_item;
+ p_item = playlist_ItemNew( p_playlist , psz_uri, psz_name );
if( p_item == NULL )
{
-1, NULL, 0 );
}
-/***************************************************************************
- * Item search functions
- ***************************************************************************/
-
/**
- * Search the position of an item by its id
- * This function must be entered with the playlist lock
+ * Add a playlist item into a playlist
*
- * \param p_playlist the playlist
- * \param i_id the id to find
- * \return the position, or VLC_EGENERIC on failure
+ * \param p_playlist the playlist to insert into
+ * \param p_item the playlist item to insert
+ * \param i_mode the mode used when adding
+ * \param i_pos the possition in the playlist where to add. If this is
+ * PLAYLIST_END the item will be added at the end of the playlist
+ * regardless of it's size
+ * \return The id of the playlist item
*/
-int playlist_GetPositionById( playlist_t * p_playlist , int i_id )
+int playlist_AddItem( playlist_t *p_playlist, playlist_item_t *p_item,
+ int i_mode, int i_pos)
{
- int i;
- for( i = 0 ; i < p_playlist->i_size ; i++ )
+ vlc_value_t val;
+ vlc_bool_t b_end = VLC_FALSE;
+ playlist_view_t *p_view;
+
+ vlc_mutex_lock( &p_playlist->object_lock );
+
+ /*
+ * CHECK_INSERT : checks if the item is already enqued before
+ * enqueing it
+ */
+
+ /* That should not change */
+ if ( i_mode & PLAYLIST_CHECK_INSERT )
{
- if( p_playlist->pp_items[i]->i_id == i_id )
+ int j;
+
+ if ( p_playlist->pp_items )
{
- return i;
- }
+ for ( j = 0; j < p_playlist->i_size; j++ )
+ {
+ if ( !strcmp( p_playlist->pp_items[j]->input.psz_uri,
+ p_item->input.psz_uri ) )
+ {
+ playlist_ItemDelete( p_item );
+ vlc_mutex_unlock( &p_playlist->object_lock );
+ return -1;
+ }
+ }
+ }
+ i_mode &= ~PLAYLIST_CHECK_INSERT;
+ i_mode |= PLAYLIST_APPEND;
}
- return VLC_EGENERIC;
-}
-/**
- * Search an item by its id
- *
- * \param p_playlist the playlist
- * \param i_id the id to find
- * \return the item, or NULL on failure
- */
-playlist_item_t * playlist_ItemGetById( playlist_t * p_playlist , int i_id )
-{
- int i;
- for( i = 0 ; i < p_playlist->i_size ; i++ )
+ msg_Dbg( p_playlist, "adding playlist item `%s' ( %s )",
+ p_item->input.psz_name, p_item->input.psz_uri );
+
+ p_item->input.i_id = ++p_playlist->i_last_id;
+
+ /* Do a few boundary checks and allocate space for the item */
+ if( i_pos == PLAYLIST_END )
{
- if( p_playlist->pp_items[i]->i_id == i_id )
+ b_end = VLC_TRUE;
+ if( i_mode & PLAYLIST_INSERT )
{
- return p_playlist->pp_items[i];
+ i_mode &= ~PLAYLIST_INSERT;
+ i_mode |= PLAYLIST_APPEND;
}
+
+ i_pos = p_playlist->i_size - 1;
}
- return NULL;
-}
-/**
- * Search an item by its position
- * This function must be entered with the playlist lock
- *
- * \param p_playlist the playlist
- * \param i_pos the position of the item to find
- * \return the item, or NULL on failure
- */
-playlist_item_t * playlist_ItemGetByPos( playlist_t * p_playlist , int i_pos )
-{
- if( i_pos >= 0 && i_pos < p_playlist->i_size)
+ if( !(i_mode & PLAYLIST_REPLACE)
+ || i_pos < 0 || i_pos >= p_playlist->i_size )
{
- return p_playlist->pp_items[i_pos];
+ /* 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 );
+ p_playlist->i_enabled ++;
+
+ /* We update the ALL view directly */
+ playlist_ViewUpdate( p_playlist, VIEW_ALL );
+
+ /* Add the item to the General category */
+ if( b_end == VLC_TRUE )
+ {
+ playlist_NodeAppend( p_playlist, VIEW_CATEGORY, p_item,
+ p_playlist->p_general );
+ }
+ else
+ {
+ playlist_NodeInsert( p_playlist, VIEW_CATEGORY, p_item,
+ p_playlist->p_general, i_pos );
+ }
+ p_view = playlist_ViewFind( p_playlist, VIEW_ALL );
+ playlist_ItemAddParent( p_item, VIEW_ALL, p_view->p_root );
+
+ /* Also add the item to the "simple" view */
+ p_view = playlist_ViewFind( p_playlist, VIEW_SIMPLE );
+
+ if( b_end == VLC_TRUE )
+ {
+ playlist_NodeAppend( p_playlist, VIEW_SIMPLE,p_item,
+ p_view->p_root );
+ }
+ else
+ {
+ playlist_NodeInsert( p_playlist, VIEW_SIMPLE,p_item,
+ p_view->p_root, i_pos );
+ }
+
+ /* FIXME : Update sorted views */
+
+ if( p_playlist->i_index >= i_pos )
+ {
+ p_playlist->i_index++;
+ }
}
- else if( p_playlist->i_size > 0)
+ else
{
- return p_playlist->pp_items[p_playlist->i_index];
+ msg_Err( p_playlist, "Insert mode not implemented" );
}
- else
+
+ if( i_mode & PLAYLIST_GO )
{
- return NULL;
+ p_playlist->request.b_request = VLC_TRUE;
+ /* FIXME ... */
+ p_playlist->request.i_view = VIEW_SIMPLE;
+ p_playlist->request.p_node = p_view->p_root;
+ p_playlist->request.p_item = p_item;
+
+ if( p_playlist->p_input )
+ {
+ input_StopThread( p_playlist->p_input );
+ }
+ p_playlist->status.i_status = PLAYLIST_RUNNING;
}
-}
-/**********************************************************************
- * playlist_item_t structure accessors
- * These functions give access to the fields of the playlist_item_t
- * structure
- **********************************************************************/
+ vlc_mutex_unlock( &p_playlist->object_lock );
-/**
- * Set the group of a playlist item
- *
- * \param p_item the item
- * \param i_group the group to set
- * \return VLC_SUCCESS on success
- */
-int playlist_ItemSetGroup( playlist_item_t *p_item, int i_group)
-{
- p_item->i_group = i_group;
- return VLC_SUCCESS;
+ val.b_bool = VLC_TRUE;
+ var_Set( p_playlist, "intf-change", val );
+
+ return p_item->input.i_id;
}
+
/**
- * Set the group of a playlist item (by position)
- * This function must be entered with the playlist lock
- * Legacy function due to disappear (locks the whole playlist)
+ * Add a playlist item to a given node (in the category view )
*
- * \param p_playlist the playlist
- * \param i_pos the postition of the item of which we change the group
- * \param i_group the new group
- * \return VLC_SUCCESS on success, VLC_EGENERIC on failure
+ * \param p_playlist the playlist to insert into
+ * \param p_item the playlist item to insert
+ * \param i_view the view for which to add or TODO: ALL_VIEWS
+ * \param p_parent the parent node
+ * \param i_mode the mode used when adding
+ * \param i_pos the possition in the node where to add. If this is
+ * PLAYLIST_END the item will be added at the end of the node
+ ** \return The id of the playlist item
*/
-int playlist_SetGroup( playlist_t *p_playlist, int i_pos, int i_group )
+int playlist_NodeAddItem( playlist_t *p_playlist, playlist_item_t *p_item,
+ int i_view,playlist_item_t *p_parent,
+ int i_mode, int i_pos)
{
vlc_value_t val;
- playlist_item_t *p_item;
- if( !p_playlist )
+ int i_position;
+ playlist_view_t *p_view;
+
+ vlc_mutex_lock( &p_playlist->object_lock );
+
+ /* Sanity checks */
+ if( !p_parent || p_parent->i_children == -1 )
{
- return VLC_ENOOBJ;
+ msg_Err( p_playlist, "invalid node" );
}
- p_item = playlist_ItemGetByPos( p_playlist , i_pos );
- if( !p_item )
+ /*
+ * CHECK_INSERT : checks if the item is already enqued before
+ * enqueing it
+ */
+ if ( i_mode & PLAYLIST_CHECK_INSERT )
{
- return VLC_ENOOBJ;
+ int j;
+
+ if ( p_playlist->pp_items )
+ {
+ for ( j = 0; j < p_playlist->i_size; j++ )
+ {
+ if ( !strcmp( p_playlist->pp_items[j]->input.psz_uri,
+ p_item->input.psz_uri ) )
+ {
+ playlist_ItemDelete( p_item );
+ vlc_mutex_unlock( &p_playlist->object_lock );
+ return -1;
+ }
+ }
+ }
+ i_mode &= ~PLAYLIST_CHECK_INSERT;
+ i_mode |= PLAYLIST_APPEND;
}
- vlc_mutex_lock( &p_item->input.lock );
- playlist_ItemSetGroup( p_item , i_group );
- vlc_mutex_unlock( &p_item->input.lock );
+ msg_Dbg( p_playlist, "adding playlist item `%s' ( %s )",
+ p_item->input.psz_name, p_item->input.psz_uri );
- val.b_bool = (i_pos >= 0 && i_pos < p_playlist->i_size ) ? i_pos : -1;
- var_Set( p_playlist, "item-change", val );
+ p_item->input.i_id = ++p_playlist->i_last_id;
- return VLC_SUCCESS;
+ /* First, add the item at the right position in the item bank */
+ /* WHY THAT ? */
+ //i_position = p_playlist->i_index == -1 ? 0 : p_playlist->i_index;
+ i_position = p_playlist->i_size ;
+
+ INSERT_ELEM( p_playlist->pp_items,
+ p_playlist->i_size,
+ i_position,
+ p_item );
+ p_playlist->i_enabled ++;
+
+ /* TODO: Handle modes */
+ playlist_NodeAppend( p_playlist, i_view, p_item, p_parent );
+
+ /* We update the ALL view directly */
+ p_view = playlist_ViewFind( p_playlist, VIEW_ALL );
+ playlist_ItemAddParent( p_item, VIEW_ALL, p_view->p_root );
+ playlist_ViewUpdate( p_playlist, VIEW_ALL );
+
+ /* TODO : Update sorted views*/
+
+ if( i_mode & PLAYLIST_GO )
+ {
+ p_playlist->request.b_request = VLC_TRUE;
+ p_playlist->request.i_view = VIEW_CATEGORY;
+ p_playlist->request.p_node = p_parent;
+ p_playlist->request.p_item = p_item;
+ if( p_playlist->p_input )
+ {
+ input_StopThread( p_playlist->p_input );
+ }
+ p_playlist->status.i_status = PLAYLIST_RUNNING;
+ }
+
+ vlc_mutex_unlock( &p_playlist->object_lock );
+
+ val.b_bool = VLC_TRUE;
+ var_Set( p_playlist, "intf-change", val );
+
+ return p_item->input.i_id;
}
+/***************************************************************************
+ * Item search functions
+ ***************************************************************************/
+
/**
- * Set the name of a playlist item
+ * Search the position of an item by its id
+ * This function must be entered with the playlist lock
*
- * \param p_item the item
- * \param psz_name the new name
- * \return VLC_SUCCESS on success, VLC_EGENERIC on failure
+ * \param p_playlist the playlist
+ * \param i_id the id to find
+ * \return the position, or VLC_EGENERIC on failure
*/
-int playlist_ItemSetName( playlist_item_t *p_item, char *psz_name )
+int playlist_GetPositionById( playlist_t * p_playlist , int i_id )
{
- if( psz_name && p_item )
+ int i;
+ for( i = 0 ; i < p_playlist->i_size ; i++ )
{
- p_item->input.psz_name = strdup( psz_name );
- return VLC_SUCCESS;
+ if( p_playlist->pp_items[i]->input.i_id == i_id )
+ {
+ return i;
+ }
}
return VLC_EGENERIC;
}
+
/**
- * Set the name of a playlist item (by position)
+ * Search an item by its position
* This function must be entered with the playlist lock
- * Legacy function due to disappear (locks the whole playlist)
*
* \param p_playlist the playlist
- * \param i_pos the position of the item of which we change the name
- * \param psz_name the new name
- * \return VLC_SUCCESS on success, VLC_EGENERIC on failure
+ * \param i_pos the position of the item to find
+ * \return the item, or NULL on failure
*/
-int playlist_SetName( playlist_t *p_playlist, int i_pos, char *psz_name )
+playlist_item_t * playlist_ItemGetByPos( playlist_t * p_playlist , int i_pos )
{
- vlc_value_t val;
- playlist_item_t *p_item;
- if( !p_playlist )
+ if( i_pos >= 0 && i_pos < p_playlist->i_size)
{
- return VLC_ENOOBJ;
+ return p_playlist->pp_items[i_pos];
}
-
- p_item = playlist_ItemGetByPos( p_playlist , i_pos );
- if( !p_item )
+ else if( p_playlist->i_size > 0)
{
- return VLC_ENOOBJ;
+ return p_playlist->pp_items[p_playlist->i_index];
+ }
+ else
+ {
+ return NULL;
}
-
- vlc_mutex_lock( &p_item->input.lock );
- playlist_ItemSetName( p_item , psz_name );
- vlc_mutex_unlock( &p_item->input.lock );
-
- val.b_bool = (i_pos >= 0 && i_pos < p_playlist->i_size ) ? i_pos : -1;
- var_Set( p_playlist, "item-change", val );
-
- return VLC_SUCCESS;
}
/**
- * Set the duration of a playlist item
- * This function must be entered with the item lock
+ * Search an item by its id
*
- * \param p_item the item
- * \param i_duration the new duration
- * \return VLC_SUCCESS on success, VLC_EGENERIC on failure
+ * \param p_playlist the playlist
+ * \param i_id the id to find
+ * \return the item, or NULL on failure
*/
-int playlist_ItemSetDuration( playlist_item_t *p_item, mtime_t i_duration )
+playlist_item_t * playlist_ItemGetById( playlist_t * p_playlist , int i_id )
{
- char psz_buffer[MSTRTIME_MAX_SIZE];
- if( p_item )
+ int i;
+ for( i = 0 ; i < p_playlist->i_size ; i++ )
{
- p_item->input.i_duration = i_duration;
- if( i_duration != -1 )
+ if( p_playlist->pp_items[i]->input.i_id == i_id )
{
- secstotimestr( psz_buffer, i_duration/1000000 );
- }
- else
- {
- memcpy( psz_buffer, "--:--:--", sizeof("--:--:--") );
+ return p_playlist->pp_items[i];
}
- playlist_ItemAddInfo( p_item, _("General") , _("Duration"),
- "%s", psz_buffer );
-
- return VLC_SUCCESS;
}
- return VLC_EGENERIC;
+ return NULL;
}
+
+
+
+/***********************************************************************
+ * Misc functions
+ ***********************************************************************/
+
/**
- * Set the duration of a playlist item
- * This function must be entered with the playlist lock
- * Legacy function due to disappear (locks the whole playlist)
+ * Transform an item to a node
*
- * \param p_playlist the playlist
- * \param i_pos the position of the item of which we change the duration
- * \param i_duration the duration to set
- * \return VLC_SUCCESS on success, VLC_EGENERIC on failure
+ * \param p_playlist the playlist object
+ * \param p_item the item to transform
+ * \return nothing
*/
-int playlist_SetDuration( playlist_t *p_playlist, int i_pos, mtime_t i_duration )
+void playlist_ItemToNode( playlist_t *p_playlist,playlist_item_t *p_item )
{
- vlc_value_t val;
- playlist_item_t *p_item;
- if( !p_playlist )
+ int i = 0;
+ if( p_item->i_children == -1 )
{
- return VLC_ENOOBJ;
+ p_item->i_children = 0;
}
- p_item = playlist_ItemGetByPos( p_playlist , i_pos );
- if( !p_item )
+ vlc_mutex_lock( &p_playlist->object_lock );
+
+ /* Remove it from the array of available items */
+ for( i = 0 ; i < p_playlist->i_size ; i++ )
{
- return VLC_ENOOBJ;
+ if( p_item == p_playlist->pp_items[i] )
+ {
+ REMOVE_ELEM( p_playlist->pp_items, p_playlist->i_size, i );
+ }
}
+ vlc_mutex_unlock( &p_playlist->object_lock );
- vlc_mutex_lock( &p_item->input.lock );
- playlist_ItemSetDuration( p_item , i_duration );
- vlc_mutex_unlock( &p_item->input.lock );
-
- val.b_bool = (i_pos >= 0 && i_pos < p_playlist->i_size ) ? i_pos : -1;
- var_Set( p_playlist, "item-change", val );
-
- return VLC_SUCCESS;
+ /* Handle the parents
+ * Nothing to do ! */
}
-/**********************************************************************
- * Actions on existing playlist items
- **********************************************************************/
-
/**
* delete an item from a playlist.
*
* \param p_playlist the playlist to remove from.
- * \param i_pos the position of the item to remove
- * \return returns 0
+ * \param i_id the identifier of the item to delete
+ * \return returns VLC_SUCCESS or an error
*/
-int playlist_Delete( playlist_t * p_playlist, int i_pos )
+int playlist_Delete( playlist_t * p_playlist, int i_id )
{
vlc_value_t val;
+ int i;
- /* if i_pos is the current played item, playlist should stop playing it */
- if( ( p_playlist->i_status == PLAYLIST_RUNNING) &&
- (p_playlist->i_index == i_pos) )
+ playlist_item_t *p_item = playlist_ItemGetById( p_playlist, i_id );
+
+ if( p_item == NULL ) return VLC_EGENERIC;
+
+ /* Check if it is the current item */
+ if( p_playlist->status.p_item == p_item )
{
- playlist_Command( p_playlist, PLAYLIST_STOP, 0 );
+ playlist_Control( p_playlist, PLAYLIST_STOP );
+ p_playlist->status.p_item = NULL;
}
vlc_mutex_lock( &p_playlist->object_lock );
- if( i_pos >= 0 && i_pos < p_playlist->i_size )
- {
- playlist_item_t *p_item = p_playlist->pp_items[i_pos];
-
- msg_Dbg( p_playlist, "deleting playlist item `%s'",
- p_item->input.psz_name );
- playlist_ItemDelete( p_item );
+ msg_Dbg( p_playlist, "deleting playlist item `%s'",
+ p_item->input.psz_name );
- if( i_pos <= p_playlist->i_index )
+ /* Remove the item from all its parent nodes */
+ for ( i= 0 ; i < p_item->i_parents ; i++ )
+ {
+ playlist_NodeRemoveItem( p_playlist, p_item,
+ p_item->pp_parents[i]->p_parent );
+ if( p_item->pp_parents[i]->i_view == VIEW_ALL )
{
- p_playlist->i_index--;
+ p_playlist->i_size--;
}
+ }
- /* Renumber the playlist */
- REMOVE_ELEM( p_playlist->pp_items, p_playlist->i_size, i_pos );
+ /* TODO : Update views */
- if( p_playlist->i_enabled > 0 ) p_playlist->i_enabled--;
- }
+ playlist_ItemDelete( p_item );
vlc_mutex_unlock( &p_playlist->object_lock );
val.b_bool = VLC_TRUE;
var_Set( p_playlist, "intf-change", val );
- return 0;
+ return VLC_SUCCESS;
}
/**
*/
int playlist_Clear( playlist_t * p_playlist )
{
-
- while( p_playlist->i_groups > 0 )
- {
- playlist_DeleteGroup( p_playlist, p_playlist->pp_groups[0]->i_id );
- }
-
- while( p_playlist->i_size > 0 )
+ int i;
+ for( i = p_playlist->i_size; i > 0 ; i-- )
{
- playlist_Delete( p_playlist, 0 );
+ playlist_Delete( p_playlist, p_playlist->pp_items[0]->input.i_id );
}
-
- p_playlist->i_index = -1;
- p_playlist->i_size = 0;
- p_playlist->pp_items = NULL;
-
- p_playlist->i_groups = 0;
- p_playlist->pp_groups = NULL;
-
- return 0;
+ return VLC_SUCCESS;
}
+
/**
* Disables a playlist item
*
* \param i_pos the position of the item to disable
* \return returns 0
*/
-int playlist_Disable( playlist_t * p_playlist, int i_pos )
+int playlist_Disable( playlist_t * p_playlist, playlist_item_t *p_item )
{
vlc_value_t val;
- vlc_mutex_lock( &p_playlist->object_lock );
+ if( !p_item ) return VLC_EGENERIC;
- if( i_pos >= 0 && i_pos < p_playlist->i_size )
- {
- msg_Dbg( p_playlist, "disabling playlist item `%s'",
- p_playlist->pp_items[i_pos]->input.psz_name );
+ msg_Dbg( p_playlist, "disabling playlist item `%s'",
+ p_item->input.psz_name );
- if( p_playlist->pp_items[i_pos]->b_enabled == VLC_TRUE )
- p_playlist->i_enabled--;
- p_playlist->pp_items[i_pos]->b_enabled = VLC_FALSE;
+ if( p_item->i_flags & PLAYLIST_ENA_FLAG )
+ {
+ p_playlist->i_enabled--;
}
+ p_item->i_flags &= ~PLAYLIST_ENA_FLAG;
- vlc_mutex_unlock( &p_playlist->object_lock );
-
- val.b_bool = i_pos;
- var_Set( p_playlist, "item-change", val );
-
- return 0;
+ var_SetInteger( p_playlist, "item-change", p_item->input.i_id );
+ return VLC_SUCCESS;
}
/**
* \param i_pos the position of the item to enable
* \return returns 0
*/
-int playlist_Enable( playlist_t * p_playlist, int i_pos )
+int playlist_Enable( playlist_t * p_playlist, playlist_item_t *p_item )
{
vlc_value_t val;
- vlc_mutex_lock( &p_playlist->object_lock );
-
- if( i_pos >= 0 && i_pos < p_playlist->i_size )
- {
- msg_Dbg( p_playlist, "enabling playlist item `%s'",
- p_playlist->pp_items[i_pos]->input.psz_name );
- if( p_playlist->pp_items[i_pos]->b_enabled == VLC_FALSE )
- p_playlist->i_enabled++;
+ if( !p_item ) return VLC_EGENERIC;
- p_playlist->pp_items[i_pos]->b_enabled = VLC_TRUE;
- }
+ msg_Dbg( p_playlist, "enabling playlist item `%s'",
+ p_item->input.psz_name );
- vlc_mutex_unlock( &p_playlist->object_lock );
-
- val.b_bool = i_pos;
- var_Set( p_playlist, "item-change", val );
-
- return 0;
-}
-
-/**
- * Disables a playlist group
- *
- * \param p_playlist the playlist to disable from.
- * \param i_group the id of the group to disable
- * \return returns 0
- */
-int playlist_DisableGroup( playlist_t * p_playlist, int i_group )
-{
- vlc_value_t val;
- int i;
- vlc_mutex_lock( &p_playlist->object_lock );
-
- msg_Dbg( p_playlist, "disabling group %i", i_group );
- for( i = 0 ; i< p_playlist->i_size; i++ )
+ if( p_item->i_flags & ~PLAYLIST_ENA_FLAG )
{
- if( p_playlist->pp_items[i]->i_group == i_group )
- {
- msg_Dbg( p_playlist, "disabling playlist item `%s'",
- p_playlist->pp_items[i]->input.psz_name );
-
- if( p_playlist->pp_items[i]->b_enabled == VLC_TRUE )
- p_playlist->i_enabled--;
-
- p_playlist->pp_items[i]->b_enabled = VLC_FALSE;
- val.b_bool = i;
- var_Set( p_playlist, "item-change", val );
- }
+ p_playlist->i_enabled++;
}
- vlc_mutex_unlock( &p_playlist->object_lock );
-
- return 0;
-}
+ p_item->i_flags |= PLAYLIST_ENA_FLAG;
-/**
- * Enables a playlist group
- *
- * \param p_playlist the playlist to enable from.
- * \param i_group the id of the group to enable
- * \return returns 0
- */
-int playlist_EnableGroup( playlist_t * p_playlist, int i_group )
-{
- vlc_value_t val;
- int i;
- vlc_mutex_lock( &p_playlist->object_lock );
-
- for( i = 0; i< p_playlist->i_size; i++ )
- {
- if( p_playlist->pp_items[i]->i_group == i_group )
- {
- msg_Dbg( p_playlist, "enabling playlist item `%s'",
- p_playlist->pp_items[i]->input.psz_name );
-
- if( p_playlist->pp_items[i]->b_enabled == VLC_FALSE )
- p_playlist->i_enabled++;
-
- p_playlist->pp_items[i]->b_enabled = VLC_TRUE;
- val.b_bool = i;
- var_Set( p_playlist, "item-change", val );
- }
- }
- vlc_mutex_unlock( &p_playlist->object_lock );
-
- return 0;
+ var_SetInteger( p_playlist, "item-change", p_item->input.i_id );
+ return VLC_SUCCESS;
}
/**
{
p_playlist->i_index = i_newpos;
}
- else if( i_pos > p_playlist->i_index && i_newpos <= p_playlist->i_index )
+ else if( i_pos > p_playlist->i_index &&
+ i_newpos <= p_playlist->i_index )
{
p_playlist->i_index++;
}
- else if( i_pos < p_playlist->i_index && i_newpos >= p_playlist->i_index )
+ else if( i_pos < p_playlist->i_index &&
+ i_newpos >= p_playlist->i_index )
{
p_playlist->i_index--;
}