Commit 8df7ff82 authored by Olafs Vandāns's avatar Olafs Vandāns Committed by Jean-Baptiste Kempf

Core playlist: provide playlist_GetNodeDuration

Signed-off-by: default avatarJean-Baptiste Kempf <jb@videolan.org>
parent 403c71dd
...@@ -283,6 +283,10 @@ VLC_API int playlist_Control( playlist_t *p_playlist, int i_query, bool b_locked ...@@ -283,6 +283,10 @@ VLC_API int playlist_Control( playlist_t *p_playlist, int i_query, bool b_locked
*/ */
VLC_API input_thread_t * playlist_CurrentInput( playlist_t *p_playlist ) VLC_USED; VLC_API input_thread_t * playlist_CurrentInput( playlist_t *p_playlist ) VLC_USED;
/** Get the duration of all items in a node.
*/
VLC_API mtime_t playlist_GetNodeDuration( playlist_item_t * );
/** Clear the playlist /** Clear the playlist
* \param b_locked TRUE if playlist is locked when entering this function * \param b_locked TRUE if playlist is locked when entering this function
*/ */
......
...@@ -331,6 +331,7 @@ playlist_DeleteFromInput ...@@ -331,6 +331,7 @@ playlist_DeleteFromInput
playlist_Export playlist_Export
playlist_GetNextLeaf playlist_GetNextLeaf
playlist_GetPrevLeaf playlist_GetPrevLeaf
playlist_GetNodeDuration
playlist_Import playlist_Import
playlist_IsServicesDiscoveryLoaded playlist_IsServicesDiscoveryLoaded
playlist_ItemGetById playlist_ItemGetById
......
...@@ -719,6 +719,24 @@ void playlist_SendAddNotify( playlist_t *p_playlist, int i_item_id, ...@@ -719,6 +719,24 @@ void playlist_SendAddNotify( playlist_t *p_playlist, int i_item_id,
var_SetAddress( p_playlist, "playlist-item-append", &add ); var_SetAddress( p_playlist, "playlist-item-append", &add );
} }
/**
* Get the duration of all items in a node.
*/
mtime_t playlist_GetNodeDuration( playlist_item_t* node )
{
/* For the assert */
playlist_t *p_playlist = node->p_playlist;
PL_ASSERT_LOCKED;
mtime_t mt_duration = 0;
if( node->i_children != -1 )
for( int i = 0; i < node->i_children; i++ )
mt_duration += input_item_GetDuration( node->pp_children[i]->p_input );
return mt_duration;
}
/*************************************************************************** /***************************************************************************
* The following functions are local * The following functions are local
***************************************************************************/ ***************************************************************************/
......
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