Commit 081c2366 authored by dionoea's avatar dionoea

Code the playlist_TreeMove function.

zorglub: i'm not really sure about the i_serial incrementation stuff, could you give it a look ?
parent 7edae502
......@@ -364,6 +364,7 @@ VLC_EXPORT( int, playlist_ItemAddOption, (playlist_item_t *, const char *) );
#define playlist_SortGroup(p, i) playlist_Sort( p, SORT_GROUP, i)
VLC_EXPORT( int, playlist_Sort, ( playlist_t *, int, int) );
VLC_EXPORT( int, playlist_Move, ( playlist_t *, int, int ) );
VLC_EXPORT( int, playlist_TreeMove, ( playlist_t *, playlist_item_t *, playlist_item_t *, int, int ) );
VLC_EXPORT( int, playlist_NodeGroup, ( playlist_t *, int,playlist_item_t *,playlist_item_t **,int, int, int ) );
VLC_EXPORT( int, playlist_NodeSort, ( playlist_t *, playlist_item_t *,int, int ) );
VLC_EXPORT( int, playlist_RecursiveNodeSort, ( playlist_t *, playlist_item_t *,int, int ) );
......
......@@ -475,6 +475,7 @@ struct module_symbols_t
char * (*FromLocaleDup_inner) (const char *);
int (*utf8_mkdir_inner) (const char *filename);
vlm_media_t* (*vlm_MediaSearch_inner) (vlm_t *, const char *);
int (*playlist_TreeMove_inner) (playlist_t *, playlist_item_t *, playlist_item_t *, int, int);
};
# if defined (__PLUGIN__)
# define aout_FiltersCreatePipeline (p_symbols)->aout_FiltersCreatePipeline_inner
......@@ -930,6 +931,7 @@ struct module_symbols_t
# define FromLocaleDup (p_symbols)->FromLocaleDup_inner
# define utf8_mkdir (p_symbols)->utf8_mkdir_inner
# define vlm_MediaSearch (p_symbols)->vlm_MediaSearch_inner
# define playlist_TreeMove (p_symbols)->playlist_TreeMove_inner
# elif defined (HAVE_DYNAMIC_PLUGINS) && !defined (__BUILTIN__)
/******************************************************************
* STORE_SYMBOLS: store VLC APIs into p_symbols for plugin access.
......@@ -1388,6 +1390,7 @@ struct module_symbols_t
((p_symbols)->FromLocaleDup_inner) = FromLocaleDup; \
((p_symbols)->utf8_mkdir_inner) = utf8_mkdir; \
((p_symbols)->vlm_MediaSearch_inner) = vlm_MediaSearch; \
((p_symbols)->playlist_TreeMove_inner) = playlist_TreeMove; \
(p_symbols)->net_ConvertIPv4_deprecated = NULL; \
(p_symbols)->__stats_CounterGet_deprecated = NULL; \
(p_symbols)->__stats_TimerDumpAll_deprecated = NULL; \
......
......@@ -890,36 +890,39 @@ int playlist_TreeMove( playlist_t * p_playlist, playlist_item_t *p_item,
{
int i;
playlist_item_t *p_detach = NULL;
#if 0
if( i_view == ALL_VIEWS )
{
for( i = 0 ; i < p_playlist->i_views; i++ )
{
playlist_TreeMove( p_playlist, p_item, p_node, i_newpos,
p_playlist->pp_views[i] );
}
}
#endif
struct item_parent_t *p_parent;
/* Find the parent */
/* Detach from the parent */
printf("detaching from parent(s)\n");
for( i = 0 ; i< p_item->i_parents; i++ )
{
if( p_item->pp_parents[i]->i_view == i_view )
{
int j;
p_detach = p_item->pp_parents[i]->p_parent;
break;
for( j = 0; j < p_detach->i_children; j++ )
{
if( p_detach->pp_children[j] == p_item ) break;
}
REMOVE_ELEM( p_detach->pp_children, p_detach->i_children, j );
p_detach->i_serial++;
free( p_item->pp_parents[i] );
REMOVE_ELEM( p_item->pp_parents, p_item->i_parents, i );
}
}
if( p_detach == NULL )
{
msg_Err( p_playlist, "item not found in view %i", i_view );
return VLC_EGENERIC;
}
/* Detach from the parent */
// playlist_NodeDetach( p_detach, p_item );
/* Attach to new parent */
printf("attaching to new parent...\n");
INSERT_ELEM( p_node->pp_children, p_node->i_children, i_newpos, p_item );
p_parent = malloc( sizeof( struct item_parent_t ) );
p_parent->p_parent = p_node;
p_parent->i_view = i_view;
INSERT_ELEM( p_item->pp_parents, p_item->i_parents, p_item->i_parents,
p_parent );
p_node->i_serial++;
p_item->i_serial++;
return VLC_SUCCESS;
}
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