Commit 2575bf38 authored by Rémi Denis-Courmont's avatar Rémi Denis-Courmont

playlist: privatize all_items array

parent ff130ffa
......@@ -165,7 +165,6 @@ struct playlist_t
VLC_COMMON_MEMBERS
playlist_item_array_t items; /**< Arrays of items */
playlist_item_array_t all_items; /**< Array of items and nodes */
playlist_item_array_t current; /**< Items currently being played */
int i_current_index; /**< Index in current array */
......
......@@ -221,7 +221,7 @@ playlist_t *playlist_Create( vlc_object_t *p_parent )
pl_priv(p_playlist)->p_input = NULL;
ARRAY_INIT( p_playlist->items );
ARRAY_INIT( p_playlist->all_items );
ARRAY_INIT( p->all_items );
ARRAY_INIT( p_playlist->current );
p_playlist->i_current_index = 0;
......@@ -331,12 +331,12 @@ void playlist_Destroy( playlist_t *p_playlist )
vlc_mutex_destroy( &p_sys->lock );
/* Remove all remaining items */
FOREACH_ARRAY( playlist_item_t *p_del, p_playlist->all_items )
FOREACH_ARRAY( playlist_item_t *p_del, p_sys->all_items )
free( p_del->pp_children );
vlc_gc_decref( p_del->p_input );
free( p_del );
FOREACH_END();
ARRAY_RESET( p_playlist->all_items );
ARRAY_RESET( p_sys->all_items );
ARRAY_RESET( p_playlist->items );
ARRAY_RESET( p_playlist->current );
......
......@@ -820,7 +820,7 @@ static void AddItem( playlist_t *p_playlist, playlist_item_t *p_item,
{
PL_ASSERT_LOCKED;
ARRAY_APPEND(p_playlist->items, p_item);
ARRAY_APPEND(p_playlist->all_items, p_item);
ARRAY_APPEND(pl_priv(p_playlist)->all_items, p_item);
if( i_pos == PLAYLIST_END )
playlist_NodeAppend( p_playlist, p_item, p_node );
......
......@@ -49,6 +49,8 @@ typedef struct playlist_private_t
playlist_t public_data;
struct intf_thread_t *interface; /**< Linked-list of interfaces */
playlist_item_array_t all_items; /**< Array of items and nodes */
vlc_sd_internal_t **pp_sds;
int i_sds; /**< Number of service discovery modules */
input_thread_t * p_input; /**< the input thread associated
......
......@@ -45,9 +45,9 @@ playlist_item_t* playlist_ItemGetById( playlist_t * p_playlist , int i_id )
{
int i;
PL_ASSERT_LOCKED;
ARRAY_BSEARCH( p_playlist->all_items,->i_id, int, i_id, i );
ARRAY_BSEARCH( pl_priv(p_playlist)->all_items,->i_id, int, i_id, i );
if( i != -1 )
return ARRAY_VAL( p_playlist->all_items, i );
return ARRAY_VAL( pl_priv(p_playlist)->all_items, i );
else
return NULL;
}
......@@ -62,7 +62,6 @@ playlist_item_t* playlist_ItemGetById( playlist_t * p_playlist , int i_id )
playlist_item_t* playlist_ItemGetByInput( playlist_t * p_playlist,
const input_item_t *p_item )
{
int i;
PL_ASSERT_LOCKED;
if( get_current_status_item( p_playlist ) &&
get_current_status_item( p_playlist )->p_input == p_item )
......@@ -70,11 +69,11 @@ playlist_item_t* playlist_ItemGetByInput( playlist_t * p_playlist,
return get_current_status_item( p_playlist );
}
/** \todo Check if this is always incremental and whether we can bsearch */
for( i = 0 ; i < p_playlist->all_items.i_size; i++ )
for( int i = 0 ; i < pl_priv(p_playlist)->all_items.i_size; i++ )
{
if( ARRAY_VAL(p_playlist->all_items, i)->p_input == p_item )
if( ARRAY_VAL(pl_priv(p_playlist)->all_items, i)->p_input == p_item )
{
return ARRAY_VAL(p_playlist->all_items, i);
return ARRAY_VAL(pl_priv(p_playlist)->all_items, i);
}
}
return NULL;
......
......@@ -77,7 +77,7 @@ playlist_item_t * playlist_NodeCreate( playlist_t *p_playlist,
if( p_item == NULL ) return NULL;
p_item->i_children = 0;
ARRAY_APPEND(p_playlist->all_items, p_item);
ARRAY_APPEND(pl_priv(p_playlist)->all_items, p_item);
if( p_parent != NULL )
playlist_NodeInsert( p_playlist, p_item, p_parent,
......@@ -156,9 +156,9 @@ int playlist_NodeDelete( playlist_t *p_playlist, playlist_item_t *p_root,
int i;
var_SetInteger( p_playlist, "playlist-item-deleted", p_root->i_id );
ARRAY_BSEARCH( p_playlist->all_items, ->i_id, int, p_root->i_id, i );
ARRAY_BSEARCH( pl_priv(p_playlist)->all_items, ->i_id, int, p_root->i_id, i );
if( i != -1 )
ARRAY_REMOVE( p_playlist->all_items, i );
ARRAY_REMOVE( pl_priv(p_playlist)->all_items, i );
if( p_root->i_children == -1 ) {
ARRAY_BSEARCH( p_playlist->items,->i_id, int, p_root->i_id, i );
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment