]> git.sesse.net Git - vlc/blobdiff - src/input/input.c
input/input.c: Misformatted if statement fix. Could someone check if that's really...
[vlc] / src / input / input.c
index d10b1b11bc80aa7a52732a3d31326f6f3106070d..0e3ba0efb539e5e0c4500f1b6c2c5ec549de731b 100644 (file)
@@ -116,6 +116,7 @@ static void AppendAttachment( int *pi_attachment, input_attachment_t ***ppp_atta
  *  - can-pause
  * * For intf callback upon changes
  *  - intf-change
+ *  - rate-change for when playback rate changes
  * TODO explain when Callback is called
  * TODO complete this list (?)
  *****************************************************************************/
@@ -202,7 +203,7 @@ static input_thread_t *Create( vlc_object_t *p_parent, input_item_t *p_item,
     /* Parse input options */
     vlc_mutex_lock( &p_item->lock );
     for( i = 0; i < p_item->i_options; i++ )
-        var_OptionParse( p_input, p_item->ppsz_options[i] );
+        var_OptionParse( VLC_OBJECT(p_input), p_item->ppsz_options[i] );
     vlc_mutex_unlock( &p_item->lock );
 
     /* Create Object Variables for private use only */
@@ -298,7 +299,7 @@ static void Destroy( input_thread_t *p_input, sout_instance_t **pp_sout )
             sout_DeleteInstance( priv->p_sout );
     }
 
-    vlc_object_destroy( p_input );
+    vlc_object_release( p_input );
     vlc_mutex_destroy( &priv->lock_control );
     free( priv );
 }
@@ -1768,6 +1769,7 @@ static vlc_bool_t Control( input_thread_t *p_input, int i_type,
             {
                 val.i_int = i_rate;
                 var_Change( p_input, "rate", VLC_VAR_SETVALUE, &val, NULL );
+                var_SetBool( p_input, "rate-change", VLC_TRUE );
 
                 p_input->p->i_rate  = i_rate;
 
@@ -2190,10 +2192,11 @@ static int InputSourceInit( input_thread_t *p_input,
         if( !psz_access ||
             (strncmp( psz_access, "udp", 3 ) &&
              strncmp( psz_access, "rtp", 3 )) )
-
-        /* Find optional titles and seekpoints */
-        MRLSections( p_input, psz_path, &in->i_title_start, &in->i_title_end,
+        {
+            /* Find optional titles and seekpoints */
+            MRLSections( p_input, psz_path, &in->i_title_start, &in->i_title_end,
                      &in->i_seekpoint_start, &in->i_seekpoint_end );
+        }
 
         if( psz_forced_demux && *psz_forced_demux )
         {
@@ -2696,23 +2699,6 @@ static void InputUpdateMeta( input_thread_t *p_input, vlc_meta_t *p_meta )
 }
 
 
-static inline vlc_bool_t IsValidAccess( const char *psz )
-{
-    char c;
-
-    while( ( c = *psz ) != '\0' )
-    {
-        if( c == ':' )
-            return VLC_TRUE;
-
-        if( ( !isascii( c ) || !isalnum( c ) ) && c != '-' && ( c != '/' ) )
-            return VLC_FALSE;
-        psz++;
-    }
-    /* should not happen though */
-    return VLC_FALSE;
-}
-
 static void AppendAttachment( int *pi_attachment, input_attachment_t ***ppp_attachment,
                               int i_new, input_attachment_t **pp_new )
 {
@@ -2791,52 +2777,32 @@ static void DemuxMeta( input_thread_t *p_input, vlc_meta_t *p_meta, demux_t *p_d
 void MRLSplit( char *psz_dup, const char **ppsz_access, const char **ppsz_demux,
                char **ppsz_path )
 {
-    const char *psz_access = "";
-    const char *psz_demux  = "";
+    char *psz_access = NULL;
+    char *psz_demux  = NULL;
     char *psz_path;
-    char *psz;
 
-    psz = strchr( psz_dup, ':' );
-
-    if( psz != NULL )
+    /* Either there is an access/demux specification before ://
+     * or we have a plain local file path. */
+    psz_path = strstr( psz_dup, "://" );
+    if( psz_path != NULL )
     {
-        /* Guess whether ':' is part of a local filename, or separates
-         * access/demux from path */
-        if( !IsValidAccess( psz_dup ) )
-            psz = NULL;
-#if defined( WIN32 ) || defined( UNDER_CE )
-        else if( ( psz - psz_dup == 1 ) && isalpha( psz_dup[0] ) )
-        {
-            //msg_Dbg( p_input, "drive letter %c: found in source", *psz_dup );
-            psz = NULL;
-        }
-#endif
-    }
-
-    if( psz != NULL )
-    {
-        *psz++ = '\0';
-        if( psz[0] == '/' && psz[1] == '/' ) psz += 2;
-
-        psz_path = psz;
-
-        psz = strchr( psz_dup, '/' );
-        if( psz )
-        {
-            *psz++ = '\0';
-            psz_demux = psz;
-        }
+        *psz_path = '\0';
+        psz_path += 3; /* skips "://" */
 
+        /* Separate access from demux (<access>/<demux>://<path>) */
         psz_access = psz_dup;
+        psz_demux = strchr( psz_access, '/' );
+        if( psz_demux )
+            *psz_demux++ = '\0';
     }
     else
     {
         psz_path = psz_dup;
     }
 
-    *ppsz_access = psz_access;
-    *ppsz_demux = psz_demux;
-    *ppsz_path = psz_path;
+    *ppsz_access = psz_access ? psz_access : "";
+    *ppsz_demux = psz_demux ? psz_demux : "";
+    *ppsz_path = psz_path ? psz_path : "";
 }
 
 /*****************************************************************************