]> git.sesse.net Git - vlc/blobdiff - src/interface/intf_playlist.c
* Fixed the BeOS compile typo.
[vlc] / src / interface / intf_playlist.c
index d3d8df6ba93873d834f148c655dffad6439cbd2f..52ecdbf3cbd7cd1db20578a09441fa1e0b06f107 100644 (file)
@@ -2,7 +2,7 @@
  * intf_playlist.c : Playlist management functions
  *****************************************************************************
  * Copyright (C) 1999, 2000 VideoLAN
- * $Id: intf_playlist.c,v 1.3 2001/04/08 07:24:47 stef Exp $
+ * $Id: intf_playlist.c,v 1.7 2001/05/30 17:03:12 sam Exp $
  *
  * Authors: Samuel Hocevar <sam@zoy.org>
  *
@@ -77,6 +77,7 @@ void intf_PlaylistInit ( playlist_t * p_playlist )
 
     p_playlist->i_mode = PLAYLIST_FORWARD;
     p_playlist->i_seed = 0;
+    p_playlist->b_stopped = 0;
 
     /* There is no current item */
     p_playlist->current.i_type = 0;
@@ -86,7 +87,7 @@ void intf_PlaylistInit ( playlist_t * p_playlist )
     /* The playlist is empty */
     p_playlist->p_item = NULL;
 
-    intf_WarnMsg( 1, "intf: playlist initialized" );
+    intf_WarnMsg( 3, "intf: playlist initialized" );
 }
 
 /*****************************************************************************
@@ -132,7 +133,7 @@ int intf_PlaylistAdd( playlist_t * p_playlist, int i_pos,
     p_item->i_status = 0;
     p_item->psz_name = strdup( psz_item );
 
-    intf_WarnMsg( 1, "intf: added `%s' to playlist", psz_item );
+    intf_WarnMsg( 3, "intf: added `%s' to playlist", psz_item );
 
     vlc_mutex_unlock( &p_playlist->change_lock );
 
@@ -208,7 +209,7 @@ int intf_PlaylistDelete( playlist_t * p_playlist, int i_pos )
     p_playlist->p_item = realloc( p_playlist->p_item,
                     p_playlist->i_size * sizeof( playlist_item_t ) );
 
-    intf_WarnMsg( 1, "intf: removed `%s' from playlist", psz_name );
+    intf_WarnMsg( 3, "intf: removed `%s' from playlist", psz_name );
     
 
     /* Delete the item */
@@ -242,11 +243,11 @@ void intf_PlaylistDestroy( playlist_t * p_playlist )
 
     free( p_playlist );
 
-    intf_WarnMsg( 1, "intf: playlist destroyed" );
+    intf_WarnMsg( 3, "intf: playlist destroyed" );
 }
 
 /*****************************************************************************
- * intf_PlaylistJumpto
+ * intf_PlaylistJumpto: go to a specified position in playlist.
  *****************************************************************************/
 void intf_PlaylistJumpto( playlist_t * p_playlist , int i_pos)
 {
@@ -260,14 +261,51 @@ void intf_PlaylistJumpto( playlist_t * p_playlist , int i_pos)
         {
             free( p_playlist->current.psz_name );
         }
+
         p_playlist->current = p_playlist->p_item[ p_playlist->i_index ];
         p_playlist->current.psz_name
                             = strdup( p_playlist->current.psz_name );
-        }
+
+    }
+    p_main->p_playlist->b_stopped = 0;
 
     vlc_mutex_unlock( &p_playlist->change_lock );
 }   
 
+/* URL-decode a file: URL path, return NULL if it's not what we expect */
+void intf_UrlDecode( char *encoded_path )
+{
+    char *tmp = NULL, *cur = NULL, *ext = NULL;
+    int realchar;
+
+    if( !encoded_path || *encoded_path == '\0' )
+    {
+        return;
+    }
+    
+    cur = encoded_path ;
+    
+    tmp = calloc(strlen(encoded_path) + 1,  sizeof(char) );
+    
+    while ( ( ext = strchr(cur, '%') ) != NULL)
+    {
+        strncat(tmp, cur, (ext - cur) / sizeof(char));
+        ext++;
+
+        if (!sscanf(ext, "%2x", &realchar))
+        {
+            free(tmp);
+            return;
+        }
+
+        tmp[strlen(tmp)] = (char)realchar;
+        
+        cur = ext + 2;
+    }
+
+    strcat(tmp, cur);
+    strcpy(encoded_path,tmp);
+}
 
 /*****************************************************************************
  * Following functions are local