Commit fd7ce755 authored by Clément Stenac's avatar Clément Stenac

* Don't delete main nodes in playlist_Clear

* Fix item add in RC
parent 0f4a4917
...@@ -77,7 +77,7 @@ static void RegisterCallbacks( intf_thread_t * ); ...@@ -77,7 +77,7 @@ static void RegisterCallbacks( intf_thread_t * );
static vlc_bool_t ReadCommand( intf_thread_t *, char *, int * ); static vlc_bool_t ReadCommand( intf_thread_t *, char *, int * );
static playlist_item_t *parse_MRL( intf_thread_t *, char * ); static input_item_t *parse_MRL( intf_thread_t *, char * );
static int Input ( vlc_object_t *, char const *, static int Input ( vlc_object_t *, char const *,
vlc_value_t, vlc_value_t, void * ); vlc_value_t, vlc_value_t, void * );
...@@ -1269,13 +1269,13 @@ static int Playlist( vlc_object_t *p_this, char const *psz_cmd, ...@@ -1269,13 +1269,13 @@ static int Playlist( vlc_object_t *p_this, char const *psz_cmd,
else if( !strcmp( psz_cmd, "add" ) && else if( !strcmp( psz_cmd, "add" ) &&
newval.psz_string && *newval.psz_string ) newval.psz_string && *newval.psz_string )
{ {
playlist_item_t *p_item = parse_MRL( p_intf, newval.psz_string ); input_item_t *p_item = parse_MRL( p_intf, newval.psz_string );
if( p_item ) if( p_item )
{ {
msg_rc( "Trying to add %s to playlist.", newval.psz_string ); msg_rc( "Trying to add %s to playlist.", newval.psz_string );
// playlist_AddItem( p_playlist, p_item, playlist_PlaylistAddInput( p_playlist, p_item,
// PLAYLIST_GO|PLAYLIST_APPEND, PLAYLIST_END ); PLAYLIST_GO|PLAYLIST_APPEND, PLAYLIST_END );
} }
} }
else if( !strcmp( psz_cmd, "playlist" ) ) else if( !strcmp( psz_cmd, "playlist" ) )
...@@ -2060,19 +2060,19 @@ vlc_bool_t ReadCommand( intf_thread_t *p_intf, char *p_buffer, int *pi_size ) ...@@ -2060,19 +2060,19 @@ vlc_bool_t ReadCommand( intf_thread_t *p_intf, char *p_buffer, int *pi_size )
} }
/***************************************************************************** /*****************************************************************************
* parse_MRL: build a playlist item from a full mrl * parse_MRL: build a input item from a full mrl
***************************************************************************** *****************************************************************************
* MRL format: "simplified-mrl [:option-name[=option-value]]" * MRL format: "simplified-mrl [:option-name[=option-value]]"
* We don't check for '"' or '\'', we just assume that a ':' that follows a * We don't check for '"' or '\'', we just assume that a ':' that follows a
* space is a new option. Should be good enough for our purpose. * space is a new option. Should be good enough for our purpose.
*****************************************************************************/ *****************************************************************************/
static playlist_item_t *parse_MRL( intf_thread_t *p_intf, char *psz_mrl ) static input_item_t *parse_MRL( intf_thread_t *p_intf, char *psz_mrl )
{ {
#define SKIPSPACE( p ) { while( *p && ( *p == ' ' || *p == '\t' ) ) p++; } #define SKIPSPACE( p ) { while( *p && ( *p == ' ' || *p == '\t' ) ) p++; }
#define SKIPTRAILINGSPACE( p, d ) \ #define SKIPTRAILINGSPACE( p, d ) \
{ char *e=d; while( e > p && (*(e-1)==' ' || *(e-1)=='\t') ){e--;*e=0;} } { char *e=d; while( e > p && (*(e-1)==' ' || *(e-1)=='\t') ){e--;*e=0;} }
playlist_item_t *p_item = NULL; input_item_t *p_item = NULL;
char *psz_item = NULL, *psz_item_mrl = NULL, *psz_orig; char *psz_item = NULL, *psz_item_mrl = NULL, *psz_orig;
char **ppsz_options = NULL; char **ppsz_options = NULL;
int i, i_options = 0; int i, i_options = 0;
...@@ -2123,10 +2123,10 @@ static playlist_item_t *parse_MRL( intf_thread_t *p_intf, char *psz_mrl ) ...@@ -2123,10 +2123,10 @@ static playlist_item_t *parse_MRL( intf_thread_t *p_intf, char *psz_mrl )
/* Now create a playlist item */ /* Now create a playlist item */
if( psz_item_mrl ) if( psz_item_mrl )
{ {
p_item = playlist_ItemNew( p_intf, psz_item_mrl, psz_item_mrl ); p_item = input_ItemNew( p_intf, psz_item_mrl, psz_item_mrl );
for( i = 0; i < i_options; i++ ) for( i = 0; i < i_options; i++ )
{ {
playlist_ItemAddOption( p_item, ppsz_options[i] ); vlc_input_item_AddOption( p_item, ppsz_options[i] );
} }
} }
......
...@@ -84,6 +84,11 @@ playlist_t * playlist_Create( vlc_object_t *p_parent ) ...@@ -84,6 +84,11 @@ playlist_t * playlist_Create( vlc_object_t *p_parent )
p_playlist->p_ml_onelevel = playlist_NodeCreate( p_playlist, p_playlist->p_ml_onelevel = playlist_NodeCreate( p_playlist,
_( "Media Library" ), p_playlist->p_root_onelevel ); _( "Media Library" ), p_playlist->p_root_onelevel );
p_playlist->p_local_category->i_flags |= PLAYLIST_RO_FLAG;
p_playlist->p_ml_category->i_flags |= PLAYLIST_RO_FLAG;
p_playlist->p_local_onelevel->i_flags |= PLAYLIST_RO_FLAG;
p_playlist->p_ml_onelevel->i_flags |= PLAYLIST_RO_FLAG;
/* This is a hack to find it later. Quite ugly, but I haven't found a /* This is a hack to find it later. Quite ugly, but I haven't found a
* better way */ * better way */
p_playlist->p_local_onelevel->p_input->i_id = p_playlist->p_local_onelevel->p_input->i_id =
...@@ -127,7 +132,12 @@ void playlist_Destroy( playlist_t *p_playlist ) ...@@ -127,7 +132,12 @@ void playlist_Destroy( playlist_t *p_playlist )
var_Destroy( p_playlist, "loop" ); var_Destroy( p_playlist, "loop" );
var_Destroy( p_playlist, "activity" ); var_Destroy( p_playlist, "activity" );
playlist_LockClear( p_playlist ); PL_LOCK;
playlist_NodeDelete( p_playlist, p_playlist->p_root_category, VLC_TRUE,
VLC_TRUE );
playlist_NodeDelete( p_playlist, p_playlist->p_root_onelevel, VLC_TRUE,
VLC_TRUE );
PL_UNLOCK;
if( p_playlist->p_stats ) if( p_playlist->p_stats )
free( p_playlist->p_stats ); free( p_playlist->p_stats );
......
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