input_item_t *p_input;
playlist_item_t *p_item;
- if( !psz_name ) psz_name = strdup( _("Undefined") );
+ if( !psz_name ) psz_name = _("Undefined");
p_input = input_ItemNewWithType( VLC_OBJECT(p_playlist), NULL, psz_name,
0, NULL, -1, ITEM_TYPE_NODE );
p_input->i_id = ++p_playlist->i_last_input_id;
int playlist_NodeDelete( playlist_t *p_playlist, playlist_item_t *p_root,
vlc_bool_t b_delete_items, vlc_bool_t b_force )
{
- int i, i_top, i_bottom;
+ int i;
+
if( p_root->i_children == -1 )
{
return VLC_EGENERIC;
p_playlist->p_root_onelevel );
(*pp_node_one)->i_flags |= PLAYLIST_RO_FLAG;
(*pp_node_one)->i_flags |= PLAYLIST_SKIP_FLAG;
+
+ (*pp_node_one)->p_input->i_id = (*pp_node_cat)->p_input->i_id;
}
+playlist_item_t * playlist_GetPreferredNode( playlist_t *p_playlist,
+ playlist_item_t *p_node )
+{
+ int i;
+ if( p_node->p_parent == p_playlist->p_root_category )
+ {
+ if( p_playlist->b_always_tree ||
+ p_node->p_input->b_prefers_tree ) return p_node;
+ for( i = 0 ; i< p_playlist->p_root_onelevel->i_children; i++ )
+ {
+ if( p_playlist->p_root_onelevel->pp_children[i]->p_input->i_id ==
+ p_node->p_input->i_id )
+ return p_playlist->p_root_onelevel->pp_children[i];
+ }
+ }
+ else if( p_node->p_parent == p_playlist->p_root_onelevel )
+ {
+ if( p_playlist->b_never_tree || !p_node->p_input->b_prefers_tree )
+ return p_node;
+ for( i = 0 ; i< p_playlist->p_root_category->i_children; i++ )
+ {
+ if( p_playlist->p_root_category->pp_children[i]->p_input->i_id ==
+ p_node->p_input->i_id )
+ return p_playlist->p_root_category->pp_children[i];
+ }
+ }
+ return NULL;
+}
/**********************************************************************
* Tree walking functions