Commit 0969e58f authored by Laurent Aimar's avatar Laurent Aimar

Removed or privatized playlist functions.

parent 337b63e8
...@@ -274,9 +274,7 @@ VLC_EXPORT( int, playlist_AskForArtEnqueue, (playlist_t *, input_item_t *, bool ...@@ -274,9 +274,7 @@ VLC_EXPORT( int, playlist_AskForArtEnqueue, (playlist_t *, input_item_t *, bool
VLC_EXPORT( int, playlist_TreeMove, ( playlist_t *, playlist_item_t *, playlist_item_t *, int ) ); VLC_EXPORT( int, playlist_TreeMove, ( playlist_t *, playlist_item_t *, playlist_item_t *, int ) );
VLC_EXPORT( int, playlist_RecursiveNodeSort, ( playlist_t *, playlist_item_t *,int, int ) ); VLC_EXPORT( int, playlist_RecursiveNodeSort, ( playlist_t *, playlist_item_t *,int, int ) );
VLC_EXPORT( int, playlist_CurrentId, ( playlist_t * ) );
VLC_EXPORT( playlist_item_t *, playlist_CurrentPlayingItem, ( playlist_t * ) ); VLC_EXPORT( playlist_item_t *, playlist_CurrentPlayingItem, ( playlist_t * ) );
VLC_EXPORT( bool, playlist_IsPlaying, ( playlist_t * ) );
VLC_EXPORT( int, playlist_Status, ( playlist_t * ) ); VLC_EXPORT( int, playlist_Status, ( playlist_t * ) );
/** /**
...@@ -318,9 +316,6 @@ VLC_EXPORT( int, playlist_AddExt, ( playlist_t *, const char *, const char *, i ...@@ -318,9 +316,6 @@ VLC_EXPORT( int, playlist_AddExt, ( playlist_t *, const char *, const char *, i
VLC_EXPORT( int, playlist_AddInput, ( playlist_t *, input_item_t *, int, int, bool, bool ) ); VLC_EXPORT( int, playlist_AddInput, ( playlist_t *, input_item_t *, int, int, bool, bool ) );
VLC_EXPORT( int, playlist_BothAddInput, ( playlist_t *, input_item_t *,playlist_item_t *,int , int, int*, int*, bool ) ); VLC_EXPORT( int, playlist_BothAddInput, ( playlist_t *, input_item_t *,playlist_item_t *,int , int, int*, int*, bool ) );
/********************** Misc item operations **********************/
VLC_EXPORT( playlist_item_t*, playlist_ItemToNode, (playlist_t *,playlist_item_t *, bool) );
/********************************** Item search *************************/ /********************************** Item search *************************/
VLC_EXPORT( playlist_item_t *, playlist_ItemGetById, (playlist_t *, int ) ); VLC_EXPORT( playlist_item_t *, playlist_ItemGetById, (playlist_t *, int ) );
VLC_EXPORT( playlist_item_t *, playlist_ItemGetByInput, (playlist_t *,input_item_t * ) ); VLC_EXPORT( playlist_item_t *, playlist_ItemGetByInput, (playlist_t *,input_item_t * ) );
...@@ -331,8 +326,6 @@ VLC_EXPORT( int, playlist_LiveSearchUpdate, (playlist_t *, playlist_item_t *, co ...@@ -331,8 +326,6 @@ VLC_EXPORT( int, playlist_LiveSearchUpdate, (playlist_t *, playlist_item_t *, co
/******************************************************** /********************************************************
* Tree management * Tree management
********************************************************/ ********************************************************/
VLC_EXPORT( int, playlist_NodeChildrenCount, (playlist_t *,playlist_item_t* ) );
/* Node management */ /* Node management */
VLC_EXPORT( playlist_item_t *, playlist_NodeCreate, ( playlist_t *, const char *, playlist_item_t * p_parent, int i_flags, input_item_t * ) ); VLC_EXPORT( playlist_item_t *, playlist_NodeCreate, ( playlist_t *, const char *, playlist_item_t * p_parent, int i_flags, input_item_t * ) );
VLC_EXPORT( int, playlist_NodeAppend, (playlist_t *,playlist_item_t*,playlist_item_t *) ); VLC_EXPORT( int, playlist_NodeAppend, (playlist_t *,playlist_item_t*,playlist_item_t *) );
...@@ -340,8 +333,7 @@ VLC_EXPORT( int, playlist_NodeInsert, (playlist_t *,playlist_item_t*,playlist_it ...@@ -340,8 +333,7 @@ VLC_EXPORT( int, playlist_NodeInsert, (playlist_t *,playlist_item_t*,playlist_it
VLC_EXPORT( int, playlist_NodeRemoveItem, (playlist_t *,playlist_item_t*,playlist_item_t *) ); VLC_EXPORT( int, playlist_NodeRemoveItem, (playlist_t *,playlist_item_t*,playlist_item_t *) );
VLC_EXPORT( playlist_item_t *, playlist_ChildSearchName, (playlist_item_t*, const char* ) ); VLC_EXPORT( playlist_item_t *, playlist_ChildSearchName, (playlist_item_t*, const char* ) );
VLC_EXPORT( int, playlist_NodeDelete, ( playlist_t *, playlist_item_t *, bool , bool ) ); VLC_EXPORT( int, playlist_NodeDelete, ( playlist_t *, playlist_item_t *, bool , bool ) );
VLC_EXPORT( int, playlist_NodeEmpty, ( playlist_t *, playlist_item_t *, bool ) );
VLC_EXPORT( void, playlist_NodesPairCreate, (playlist_t *, const char *, playlist_item_t **, playlist_item_t **, bool ) );
VLC_EXPORT( playlist_item_t *, playlist_GetPreferredNode, ( playlist_t *p_playlist, playlist_item_t *p_node ) ); VLC_EXPORT( playlist_item_t *, playlist_GetPreferredNode, ( playlist_t *p_playlist, playlist_item_t *p_node ) );
VLC_EXPORT( playlist_item_t *, playlist_GetNextLeaf, ( playlist_t *p_playlist, playlist_item_t *p_root, playlist_item_t *p_item, bool b_ena, bool b_unplayed ) ); VLC_EXPORT( playlist_item_t *, playlist_GetNextLeaf, ( playlist_t *p_playlist, playlist_item_t *p_root, playlist_item_t *p_item, bool b_ena, bool b_unplayed ) );
VLC_EXPORT( playlist_item_t *, playlist_GetPrevLeaf, ( playlist_t *p_playlist, playlist_item_t *p_root, playlist_item_t *p_item, bool b_ena, bool b_unplayed ) ); VLC_EXPORT( playlist_item_t *, playlist_GetPrevLeaf, ( playlist_t *p_playlist, playlist_item_t *p_root, playlist_item_t *p_item, bool b_ena, bool b_unplayed ) );
......
...@@ -631,9 +631,8 @@ void Playlist::Rebuild() ...@@ -631,9 +631,8 @@ void Playlist::Rebuild()
playlist_item_t * p_root = p_playlist->p_local_onelevel; playlist_item_t * p_root = p_playlist->p_local_onelevel;
playlist_item_t * p_child = NULL; playlist_item_t * p_child = NULL;
for( int i = 0; i < playlist_NodeChildrenCount( p_playlist, p_root ); i++ ) while( ( p_child = playlist_GetNextLeaf( p_playlist, p_root, p_child, FALSE, FALSE ) ) )
{ {
p_child = playlist_GetNextLeaf( p_playlist, p_root, p_child, FALSE, FALSE);
LVITEM lv; LVITEM lv;
lv.mask = LVIF_TEXT; lv.mask = LVIF_TEXT;
lv.pszText = _T(""); lv.pszText = _T("");
......
...@@ -653,14 +653,6 @@ void MediaServer::fetchContents() ...@@ -653,14 +653,6 @@ void MediaServer::fetchContents()
Container* root = new Container( 0, "0", getFriendlyName() ); Container* root = new Container( 0, "0", getFriendlyName() );
_fetchContents( root ); _fetchContents( root );
// if ( _contents )
// {
// PL_LOCK;
// playlist_NodeEmpty( p_playlist, _playlistNode, true );
// PL_UNLOCK;
// delete _contents;
// }
_contents = root; _contents = root;
_contents->setInputItem( _inputItem ); _contents->setInputItem( _inputItem );
......
...@@ -215,7 +215,7 @@ int libvlc_playlist_isplaying( libvlc_instance_t *p_instance, ...@@ -215,7 +215,7 @@ int libvlc_playlist_isplaying( libvlc_instance_t *p_instance,
VLC_UNUSED(p_e); VLC_UNUSED(p_e);
assert( PL ); assert( PL );
return playlist_IsPlaying( PL ); return playlist_Status( PL ) == PLAYLIST_RUNNING;
} }
int libvlc_playlist_items_count( libvlc_instance_t *p_instance, int libvlc_playlist_items_count( libvlc_instance_t *p_instance,
...@@ -233,7 +233,10 @@ int libvlc_playlist_get_current_index ( libvlc_instance_t *p_instance, ...@@ -233,7 +233,10 @@ int libvlc_playlist_get_current_index ( libvlc_instance_t *p_instance,
VLC_UNUSED(p_e); VLC_UNUSED(p_e);
assert( PL ); assert( PL );
return playlist_CurrentId( PL ); playlist_item_t *p_item = playlist_CurrentPlayingItem( PL );
if( !p_item )
return -1;
return p_item->i_id;
} }
void libvlc_playlist_lock( libvlc_instance_t *p_instance ) void libvlc_playlist_lock( libvlc_instance_t *p_instance )
......
...@@ -281,7 +281,6 @@ playlist_BothAddInput ...@@ -281,7 +281,6 @@ playlist_BothAddInput
playlist_ChildSearchName playlist_ChildSearchName
playlist_Clear playlist_Clear
playlist_Control playlist_Control
playlist_CurrentId
playlist_CurrentInput playlist_CurrentInput
playlist_CurrentPlayingItem playlist_CurrentPlayingItem
playlist_DeleteFromInput playlist_DeleteFromInput
...@@ -291,22 +290,17 @@ playlist_GetNextLeaf ...@@ -291,22 +290,17 @@ playlist_GetNextLeaf
playlist_GetPreferredNode playlist_GetPreferredNode
playlist_GetPrevLeaf playlist_GetPrevLeaf
playlist_Import playlist_Import
playlist_IsPlaying
playlist_IsServicesDiscoveryLoaded playlist_IsServicesDiscoveryLoaded
playlist_ItemGetById playlist_ItemGetById
playlist_ItemGetByInput playlist_ItemGetByInput
playlist_ItemGetByInputId playlist_ItemGetByInputId
playlist_ItemToNode
playlist_LiveSearchUpdate playlist_LiveSearchUpdate
playlist_Lock playlist_Lock
playlist_NodeAppend playlist_NodeAppend
playlist_NodeChildrenCount
playlist_NodeCreate playlist_NodeCreate
playlist_NodeDelete playlist_NodeDelete
playlist_NodeEmpty
playlist_NodeInsert playlist_NodeInsert
playlist_NodeRemoveItem playlist_NodeRemoveItem
playlist_NodesPairCreate
playlist_PreparseEnqueue playlist_PreparseEnqueue
playlist_RecursiveNodeSort playlist_RecursiveNodeSort
playlist_ServicesDiscoveryAdd playlist_ServicesDiscoveryAdd
......
...@@ -302,18 +302,6 @@ static void VariablesInit( playlist_t *p_playlist ) ...@@ -302,18 +302,6 @@ static void VariablesInit( playlist_t *p_playlist )
var_Create( p_playlist, "album-art", VLC_VAR_INTEGER | VLC_VAR_DOINHERIT ); var_Create( p_playlist, "album-art", VLC_VAR_INTEGER | VLC_VAR_DOINHERIT );
} }
int playlist_CurrentId( playlist_t * p_playlist )
{
return pl_priv(p_playlist)->status.p_item->i_id;
}
bool playlist_IsPlaying( playlist_t * p_playlist )
{
return ( pl_priv(p_playlist)->status.i_status == PLAYLIST_RUNNING &&
!(pl_priv(p_playlist)->request.b_request && pl_priv(p_playlist)->request.i_status == PLAYLIST_STOPPED) );
}
playlist_item_t * playlist_CurrentPlayingItem( playlist_t * p_playlist ) playlist_item_t * playlist_CurrentPlayingItem( playlist_t * p_playlist )
{ {
return pl_priv(p_playlist)->status.p_item; return pl_priv(p_playlist)->status.p_item;
...@@ -323,3 +311,4 @@ int playlist_Status( playlist_t * p_playlist ) ...@@ -323,3 +311,4 @@ int playlist_Status( playlist_t * p_playlist )
{ {
return pl_priv(p_playlist)->status.i_status; return pl_priv(p_playlist)->status.i_status;
} }
...@@ -38,6 +38,8 @@ static void ChangeToNode( playlist_t *p_playlist, playlist_item_t *p_item ); ...@@ -38,6 +38,8 @@ static void ChangeToNode( playlist_t *p_playlist, playlist_item_t *p_item );
static int DeleteInner( playlist_t * p_playlist, playlist_item_t *p_item, static int DeleteInner( playlist_t * p_playlist, playlist_item_t *p_item,
bool b_stop ); bool b_stop );
static playlist_item_t *ItemToNode( playlist_t *, playlist_item_t *, bool );
/***************************************************************************** /*****************************************************************************
* An input item has gained a subitem (Event Callback) * An input item has gained a subitem (Event Callback)
*****************************************************************************/ *****************************************************************************/
...@@ -86,7 +88,7 @@ static void input_item_subitem_added( const vlc_event_t * p_event, ...@@ -86,7 +88,7 @@ static void input_item_subitem_added( const vlc_event_t * p_event,
/* If this item is already a node don't transform it */ /* If this item is already a node don't transform it */
if( p_item_in_category->i_children == -1 ) if( p_item_in_category->i_children == -1 )
{ {
p_item_in_category = playlist_ItemToNode( p_playlist, p_item_in_category = ItemToNode( p_playlist,
p_item_in_category, pl_Locked ); p_item_in_category, pl_Locked );
p_item_in_category->p_input->i_type = ITEM_TYPE_PLAYLIST; p_item_in_category->p_input->i_type = ITEM_TYPE_PLAYLIST;
} }
...@@ -547,9 +549,9 @@ playlist_item_t * playlist_NodeAddInput( playlist_t *p_playlist, ...@@ -547,9 +549,9 @@ playlist_item_t * playlist_NodeAddInput( playlist_t *p_playlist,
* \param b_locked TRUE if the playlist is locked * \param b_locked TRUE if the playlist is locked
* \return the item transform in a node * \return the item transform in a node
*/ */
playlist_item_t *playlist_ItemToNode( playlist_t *p_playlist, static playlist_item_t *ItemToNode( playlist_t *p_playlist,
playlist_item_t *p_item, playlist_item_t *p_item,
bool b_locked ) bool b_locked )
{ {
playlist_item_t *p_item_in_category; playlist_item_t *p_item_in_category;
......
...@@ -141,6 +141,11 @@ int playlist_DeleteFromInputInParent( playlist_t *, int, playlist_item_t *, bool ...@@ -141,6 +141,11 @@ int playlist_DeleteFromInputInParent( playlist_t *, int, playlist_item_t *, bool
int playlist_DeleteFromItemId( playlist_t*, int ); int playlist_DeleteFromItemId( playlist_t*, int );
int playlist_ItemRelease( playlist_item_t * ); int playlist_ItemRelease( playlist_item_t * );
void playlist_NodesPairCreate( playlist_t *, const char *, playlist_item_t **, playlist_item_t **, bool );
int playlist_NodeEmpty( playlist_t *, playlist_item_t *, bool );
/** /**
* @} * @}
*/ */
......
...@@ -239,35 +239,6 @@ int playlist_NodeRemoveItem( playlist_t *p_playlist, ...@@ -239,35 +239,6 @@ int playlist_NodeRemoveItem( playlist_t *p_playlist,
return VLC_SUCCESS; return VLC_SUCCESS;
} }
/**
* Count the children of a node
*
* \param p_playlist the playlist
* \param p_node the node
* \return the number of children
*/
int playlist_NodeChildrenCount( playlist_t *p_playlist, playlist_item_t*p_node)
{
PL_ASSERT_LOCKED;
int i;
int i_nb = 0;
if( p_node->i_children == -1 )
return 0;
i_nb = p_node->i_children;
for( i=0 ; i< p_node->i_children;i++ )
{
if( p_node->pp_children[i]->i_children == -1 )
break;
else
i_nb += playlist_NodeChildrenCount( p_playlist,
p_node->pp_children[i] );
}
return i_nb;
}
/** /**
* Search a child of a node by its name * Search a child of a node by its name
* *
......
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