[vlc-devel] [PATCH] playlist: Recurse on ITEM_TYPE_NODE when calculating the duration
Wieland Hoffmann
themineo at gmail.com
Sat Jan 11 16:10:16 CET 2014
When adding an item X whose underlying input_item_t's i_type is
ITEM_TYPE_NODE (like a folder), we need to call playlist_GetNodeDuration
on X again for the duration of X to be the sum of the durations of X's
children.
---
src/playlist/item.c | 8 +++++++-
1 file changed, 7 insertions(+), 1 deletion(-)
diff --git a/src/playlist/item.c b/src/playlist/item.c
index b27389a..1aa5d56 100644
--- a/src/playlist/item.c
+++ b/src/playlist/item.c
@@ -733,7 +733,13 @@ mtime_t playlist_GetNodeDuration( playlist_item_t* node )
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 );
+ {
+ input_item_t* p_input = node->pp_children[i]->p_input;
+ if ( p_input->i_type == ITEM_TYPE_NODE )
+ mt_duration += playlist_GetNodeDuration( node->pp_children[i] );
+ else
+ mt_duration += input_item_GetDuration( p_input );
+ }
return mt_duration;
}
--
1.8.5.2
More information about the vlc-devel
mailing list