]> git.sesse.net Git - vlc/commitdiff
* Don't delete main nodes in playlist_Clear
authorClément Stenac <zorglub@videolan.org>
Thu, 8 Jun 2006 19:39:15 +0000 (19:39 +0000)
committerClément Stenac <zorglub@videolan.org>
Thu, 8 Jun 2006 19:39:15 +0000 (19:39 +0000)
* Fix item add in RC

modules/control/rc.c
src/playlist/engine.c

index 901d7409ee28769b0de25016de74a6e894424342..832c1ae7a762012d4212aac1d85132a3a1e0b979 100644 (file)
@@ -77,7 +77,7 @@ static void RegisterCallbacks( intf_thread_t * );
 
 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 *,
                            vlc_value_t, vlc_value_t, void * );
@@ -1269,13 +1269,13 @@ static int Playlist( vlc_object_t *p_this, char const *psz_cmd,
     else if( !strcmp( psz_cmd, "add" ) &&
              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 )
         {
             msg_rc( "Trying to add %s to playlist.", newval.psz_string );
-//            playlist_AddItem( p_playlist, p_item,
-//                              PLAYLIST_GO|PLAYLIST_APPEND, PLAYLIST_END );
+            playlist_PlaylistAddInput( p_playlist, p_item,
+                              PLAYLIST_GO|PLAYLIST_APPEND, PLAYLIST_END );
         }
     }
     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 )
 }
 
 /*****************************************************************************
- * 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]]"
  * 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.
  *****************************************************************************/
-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 SKIPTRAILINGSPACE( p, d ) \
     { 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 **ppsz_options = NULL;
     int i, i_options = 0;
@@ -2123,10 +2123,10 @@ static playlist_item_t *parse_MRL( intf_thread_t *p_intf, char *psz_mrl )
     /* Now create a playlist item */
     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++ )
         {
-            playlist_ItemAddOption( p_item, ppsz_options[i] );
+            vlc_input_item_AddOption( p_item, ppsz_options[i] );
         }
     }
 
index 87ad67cb2d22a1d627a5b028c4e213a6e8cbdcbe..ea5ebe2abc450feabdcb760b03aac2a907208fb2 100644 (file)
@@ -84,6 +84,11 @@ playlist_t * playlist_Create( vlc_object_t *p_parent )
     p_playlist->p_ml_onelevel =  playlist_NodeCreate( p_playlist,
                            _( "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
      * better way */
     p_playlist->p_local_onelevel->p_input->i_id =
@@ -127,7 +132,12 @@ void playlist_Destroy( playlist_t *p_playlist )
     var_Destroy( p_playlist, "loop" );
     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 )
         free( p_playlist->p_stats );