]> git.sesse.net Git - vlc/blobdiff - src/input/input.c
Fix quoted values containing # in VLM shell.
[vlc] / src / input / input.c
index 495ae18fa5011cdbafdfb34e9b21bf63cba70ac8..f4081ccbce239e0a360743bf225debad7eea8869 100644 (file)
@@ -110,9 +110,6 @@ static void SubtitleAdd( input_thread_t *p_input, char *psz_subtitle, bool b_for
 
 static void input_ChangeState( input_thread_t *p_input, int i_state ); /* TODO fix name */
 
-/* Do not let a pts_delay from access/demux go beyong 60s */
-#define INPUT_PTS_DELAY_MAX INT64_C(60000000)
-
 #undef input_Create
 /**
  * Create a new input_thread_t.
@@ -335,6 +332,14 @@ static input_thread_t *Create( vlc_object_t *p_parent, input_item_t *p_item,
     if( !p_input->p )
         return NULL;
 
+    /* Parse input options */
+    vlc_mutex_lock( &p_item->lock );
+    assert( (int)p_item->optflagc == p_item->i_options );
+    for( i = 0; i < p_item->i_options; i++ )
+        var_OptionParse( VLC_OBJECT(p_input), p_item->ppsz_options[i],
+                         !!(p_item->optflagv[i] & VLC_INPUT_OPTION_TRUSTED) );
+    vlc_mutex_unlock( &p_item->lock );
+
     p_input->b_preparsing = b_quick;
     p_input->psz_header = psz_header ? strdup( psz_header ) : NULL;
 
@@ -349,8 +354,13 @@ static input_thread_t *Create( vlc_object_t *p_parent, input_item_t *p_item,
     p_input->p->title = NULL;
     p_input->p->i_title_offset = p_input->p->i_seekpoint_offset = 0;
     p_input->p->i_state = INIT_S;
-    p_input->p->i_rate = INPUT_RATE_DEFAULT
-                         / var_InheritFloat( p_input, "rate" );
+    double f_rate = var_InheritFloat( p_input, "rate" );
+    if( f_rate <= 0. )
+    {
+        msg_Warn( p_input, "Negative or zero rate values are forbidden" );
+        f_rate = 1.;
+    }
+    p_input->p->i_rate = INPUT_RATE_DEFAULT / f_rate;
     p_input->p->b_recording = false;
     memset( &p_input->p->bookmark, 0, sizeof(p_input->p->bookmark) );
     TAB_INIT( p_input->p->i_bookmark, p_input->p->pp_bookmark );
@@ -397,14 +407,6 @@ static input_thread_t *Create( vlc_object_t *p_parent, input_item_t *p_item,
     p_input->p->i_control = 0;
     p_input->p->b_abort = false;
 
-    /* Parse input options */
-    vlc_mutex_lock( &p_item->lock );
-    assert( (int)p_item->optflagc == p_item->i_options );
-    for( i = 0; i < p_item->i_options; i++ )
-        var_OptionParse( VLC_OBJECT(p_input), p_item->ppsz_options[i],
-                         !!(p_item->optflagv[i] & VLC_INPUT_OPTION_TRUSTED) );
-    vlc_mutex_unlock( &p_item->lock );
-
     /* Create Object Variables for private use only */
     input_ConfigVarInit( p_input );
 
@@ -1137,7 +1139,7 @@ static void UpdatePtsDelay( input_thread_t *p_input )
     /* */
     es_out_SetDelay( p_input->p->p_es_out_display, AUDIO_ES, i_audio_delay );
     es_out_SetDelay( p_input->p->p_es_out_display, SPU_ES, i_spu_delay );
-    es_out_SetJitter( p_input->p->p_es_out, i_pts_delay, i_cr_average );
+    es_out_SetJitter( p_input->p->p_es_out, i_pts_delay, 0, i_cr_average );
 }
 
 static void InitPrograms( input_thread_t * p_input )
@@ -2400,10 +2402,6 @@ static int InputSourceInit( input_thread_t *p_input,
             }
             psz_path += i_localhost;
         }
-        /* Remove HTML anchor if present (not supported). */
-        char *p = strchr( psz_path, '#' );
-        if( p )
-            *p = '\0';
         /* Then URI-decode the path. */
         decode_URI( psz_path );
 #if defined( WIN32 ) && !defined( UNDER_CE )
@@ -3088,13 +3086,12 @@ void input_SplitMRL( const char **ppsz_access, const char **ppsz_demux,
         *psz_path = '\0';
         psz_path += 3; /* skips "://" */
 
-        /* Separate access from demux (<access>/<demux>://<path>) */
         psz_access = psz_dup;
-
         /* We really don't want module name substitution here! */
         if( psz_access[0] == '$' )
             psz_access++;
 
+        /* Separate access from demux (<access>/<demux>://<path>) */
         char *p = strchr( psz_access, '/' );
         if( p )
         {
@@ -3103,6 +3100,12 @@ void input_SplitMRL( const char **ppsz_access, const char **ppsz_demux,
             if( psz_demux[0] == '$' )
                 psz_demux++;
         }
+
+        /* Remove HTML anchor if present (not supported).
+         * The hash symbol itself should be URI-encoded. */
+        p = strchr( psz_path, '#' );
+        if( p )
+            *p = '\0';
     }
     else
     {