]> git.sesse.net Git - vlc/blobdiff - src/input/input.c
Don't loop continuously the playlist thread, use cond.
[vlc] / src / input / input.c
index 3f12c76d33018e92f181d86f7f60b75f2cf4ba57..484d7764a64459a588304c95bf94b77912c11114 100644 (file)
@@ -39,6 +39,7 @@
 #include "vlc_playlist.h"
 #include "vlc_interface.h"
 #include "vlc_interaction.h"
+#include "vlc_url.h"
 
 #include "charset.h"
 
@@ -69,7 +70,6 @@ static int  UpdateMeta( input_thread_t * );
 
 static void UpdateItemLength( input_thread_t *, int64_t i_length );
 
-static void DecodeUrl( char * );
 static void MRLSections( input_thread_t *, char *, int *, int *, int *, int *);
 
 static input_source_t *InputSourceNew( input_thread_t *);
@@ -380,7 +380,7 @@ void input_StopThread( input_thread_t *p_input )
     /* Set die for input */
     p_input->b_die = VLC_TRUE;
 
-    /* We cannot touch p_input fields directly (we can from another thread),
+    /* We cannot touch p_input fields directly (we come from another thread),
      * so use the vlc_object_find way, it's perfectly safe */
 
     /* Set die for all access */
@@ -442,6 +442,7 @@ static int Run( input_thread_t *p_input )
     {
         /* If we failed, wait before we are killed, and exit */
         p_input->b_error = VLC_TRUE;
+        playlist_Signal( pl_Get( p_input ) );
 
         Error( p_input );
 
@@ -468,6 +469,7 @@ static int Run( input_thread_t *p_input )
 
         /* We have finished */
         p_input->b_eof = VLC_TRUE;
+        playlist_Signal( pl_Get( p_input ) );
     }
 
     /* Wait until we are asked to die */
@@ -2016,7 +2018,7 @@ static int InputSourceInit( input_thread_t *p_input,
         /* Access failed, URL encoded ? */
         if( in->p_access == NULL && strchr( psz_path, '%' ) )
         {
-            DecodeUrl( psz_path );
+            decode_URI( psz_path );
 
             msg_Dbg( p_input, "retrying with access `%s' demux `%s' path `%s'",
                      psz_access, psz_demux, psz_path );
@@ -2299,44 +2301,6 @@ static void InputMetaUser( input_thread_t *p_input )
 #undef GET_META
 }
 
-/*****************************************************************************
- * DecodeUrl: decode a given encoded url
- *****************************************************************************/
-static void DecodeUrl( char *psz )
-{
-    char *dup = strdup( psz );
-    char *p = dup;
-
-    while( *p )
-    {
-        if( *p == '%' )
-        {
-            char val[3];
-            p++;
-            if( !*p )
-            {
-                break;
-            }
-
-            val[0] = *p++;
-            val[1] = *p++;
-            val[2] = '\0';
-
-            *psz++ = strtol( val, NULL, 16 );
-        }
-        else if( *p == '+' )
-        {
-            *psz++ = ' ';
-            p++;
-        }
-        else
-        {
-            *psz++ = *p++;
-        }
-    }
-    if( psz ) *psz++  ='\0';
-    if( dup ) free( dup );
-}
 
 /*****************************************************************************
  * MRLSplit: parse the access, demux and url part of the