[vlc-commits] Core playlist: provide playlist_GetNodeDuration
Olafs Vandāns
git at videolan.org
Thu Dec 20 17:34:31 CET 2012
vlc | branch: master | Olafs Vandāns <lunaroverlord at gmail.com> | Thu Dec 20 17:19:30 2012 +0100| [8df7ff8204ba931d7c212c65a54d20f9934bfde3] | committer: Jean-Baptiste Kempf
Core playlist: provide playlist_GetNodeDuration
Signed-off-by: Jean-Baptiste Kempf <jb at videolan.org>
> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=8df7ff8204ba931d7c212c65a54d20f9934bfde3
---
include/vlc_playlist.h | 4 ++++
src/libvlccore.sym | 1 +
src/playlist/item.c | 18 ++++++++++++++++++
3 files changed, 23 insertions(+)
diff --git a/include/vlc_playlist.h b/include/vlc_playlist.h
index 89b2edf..10108cb 100644
--- a/include/vlc_playlist.h
+++ b/include/vlc_playlist.h
@@ -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;
+/** Get the duration of all items in a node.
+ */
+VLC_API mtime_t playlist_GetNodeDuration( playlist_item_t * );
+
/** Clear the playlist
* \param b_locked TRUE if playlist is locked when entering this function
*/
diff --git a/src/libvlccore.sym b/src/libvlccore.sym
index 8c5be17..85cc03c 100644
--- a/src/libvlccore.sym
+++ b/src/libvlccore.sym
@@ -331,6 +331,7 @@ playlist_DeleteFromInput
playlist_Export
playlist_GetNextLeaf
playlist_GetPrevLeaf
+playlist_GetNodeDuration
playlist_Import
playlist_IsServicesDiscoveryLoaded
playlist_ItemGetById
diff --git a/src/playlist/item.c b/src/playlist/item.c
index f5fde96..205cb16 100644
--- a/src/playlist/item.c
+++ b/src/playlist/item.c
@@ -719,6 +719,24 @@ void playlist_SendAddNotify( playlist_t *p_playlist, int i_item_id,
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
***************************************************************************/
More information about the vlc-commits
mailing list