[vlc-commits] playlist: Recurse on ITEM_TYPE_NODE when calculating the duration

Wieland Hoffmann git at videolan.org
Sun Jan 12 18:28:15 CET 2014


vlc | branch: master | Wieland Hoffmann <themineo at gmail.com> | Sat Jan 11 14:10:16 2014 +0000| [8eae542ad94652396035ee70920ca2ab107033ed] | committer: Jean-Baptiste Kempf

playlist: Recurse on ITEM_TYPE_NODE when calculating the duration

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.

Signed-off-by: Jean-Baptiste Kempf <jb at videolan.org>

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=8eae542ad94652396035ee70920ca2ab107033ed
---

 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;
 }



More information about the vlc-commits mailing list