Commit 11448014 authored by Rémi Denis-Courmont's avatar Rémi Denis-Courmont

playlist: create a playlist node depending on item type

If the input item for the new playlist item is already of type node,
assume that the caller wants to create a new playlist node. This skips
calling ChangeToNode() later and incurred processing in interfaces.

This also enables some further code factorization.
parent fa2b9820
......@@ -249,7 +249,7 @@ playlist_item_t *playlist_ItemNewFromInput( playlist_t *p_playlist,
p_item->p_input = p_input;
p_item->i_id = p->i_last_playlist_id;
p_item->p_parent = NULL;
p_item->i_children = -1;
p_item->i_children = (p_input->i_type == ITEM_TYPE_NODE) ? 0 : -1;
p_item->pp_children = NULL;
p_item->i_nb_played = 0;
p_item->i_flags = 0;
......
......@@ -74,7 +74,6 @@ playlist_item_t * playlist_NodeCreate( playlist_t *p_playlist,
input_item_Release( p_new_input );
if( p_item == NULL ) return NULL;
p_item->i_children = 0;
if( p_parent != NULL )
playlist_NodeInsert( p_parent, p_item, i_pos );
......
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