[vlc-devel] [PATCH] Added playlist total duration.

Rémi Denis-Courmont remi at remlab.net
Thu Nov 15 12:52:42 CET 2012


   Hello,

Please split the include/src parts and the Qt4 into separate patches.

On Thu, 15 Nov 2012 10:01:22 +0200, "Olafs Vandāns"
<lunaroverlord at gmail.com> wrote:
> diff --git a/src/playlist/item.c b/src/playlist/item.c
> index 2b99dce..476a797 100644
> --- a/src/playlist/item.c
> +++ b/src/playlist/item.c
> @@ -716,6 +716,20 @@ 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 )
> +{
> +    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;
> +}

I would add an assertion that the playlist is locked, if possible. I don't
suppose this works if the playlist is not locked, does it?


-- 
Rémi Denis-Courmont
Sent from my collocated server



More information about the vlc-devel mailing list