]> git.sesse.net Git - vlc/blobdiff - src/input/var.c
Fix quoted values containing # in VLM shell.
[vlc] / src / input / var.c
index 8352629eac612a3cc445796c1360fc8cff126f13..781ce7c10287a12f2b16ce3517c067f04cba4e98 100644 (file)
@@ -136,8 +136,8 @@ void input_ControlVarInit ( input_thread_t *p_input )
     var_Change( p_input, "state", VLC_VAR_SETVALUE, &val, NULL );
 
     /* Rate */
-    var_Create( p_input, "rate", VLC_VAR_INTEGER );
-    val.i_int = p_input->p->i_rate;
+    var_Create( p_input, "rate", VLC_VAR_FLOAT );
+    val.f_float = (float)INPUT_RATE_DEFAULT / (float)p_input->p->i_rate;
     var_Change( p_input, "rate", VLC_VAR_SETVALUE, &val, NULL );
 
     var_Create( p_input, "rate-slower", VLC_VAR_VOID );
@@ -216,6 +216,8 @@ void input_ControlVarInit ( input_thread_t *p_input )
     text.psz_string = _("Subtitles Track");
     var_Change( p_input, "spu-es", VLC_VAR_SETTEXT, &text, NULL );
 
+    var_Create( p_input, "sub-margin", VLC_VAR_INTEGER | VLC_VAR_DOINHERIT );
+
     /* Special read only objects variables for intf */
     var_Create( p_input, "bookmarks", VLC_VAR_STRING | VLC_VAR_DOINHERIT );
 
@@ -223,6 +225,9 @@ void input_ControlVarInit ( input_thread_t *p_input )
     val.i_time = 0;
     var_Change( p_input, "length", VLC_VAR_SETVALUE, &val, NULL );
 
+    var_Create( p_input, "bit-rate", VLC_VAR_INTEGER );
+    var_Create( p_input, "sample-rate", VLC_VAR_INTEGER );
+
     if( !p_input->b_preparsing )
     {
         /* Special "intf-event" variable. */
@@ -241,7 +246,8 @@ void input_ControlVarInit ( input_thread_t *p_input )
  *****************************************************************************/
 void input_ControlVarStop( input_thread_t *p_input )
 {
-    InputDelCallbacks( p_input, p_input_callbacks );
+    if( !p_input->b_preparsing )
+        InputDelCallbacks( p_input, p_input_callbacks );
 
     if( p_input->p->i_title > 0 )
     {
@@ -353,7 +359,7 @@ void input_ControlVarNavigation( input_thread_t *p_input )
 void input_ControlVarTitle( input_thread_t *p_input, int i_title )
 {
     input_title_t *t = p_input->p->title[i_title];
-    vlc_value_t val, text;
+    vlc_value_t text;
     int  i;
 
     /* Create/Destroy command variables */
@@ -362,7 +368,7 @@ void input_ControlVarTitle( input_thread_t *p_input, int i_title )
         var_Destroy( p_input, "next-chapter" );
         var_Destroy( p_input, "prev-chapter" );
     }
-    else if( var_Get( p_input, "next-chapter", &val ) != VLC_SUCCESS )
+    else if( var_Type( p_input, "next-chapter" ) == 0 )
     {
         var_Create( p_input, "next-chapter", VLC_VAR_VOID );
         text.psz_string = _("Next chapter");
@@ -379,6 +385,7 @@ void input_ControlVarTitle( input_thread_t *p_input, int i_title )
     var_Change( p_input, "chapter", VLC_VAR_CLEARCHOICES, NULL, NULL );
     for( i = 0; i <  t->i_seekpoint; i++ )
     {
+        vlc_value_t val;
         val.i_int = i;
 
         if( t->seekpoint[i]->psz_name == NULL ||
@@ -559,7 +566,9 @@ static int RateCallback( vlc_object_t *p_this, char const *psz_cmd,
     input_thread_t *p_input = (input_thread_t*)p_this;
     VLC_UNUSED(oldval); VLC_UNUSED(p_data);
 
-    /* Problem with this way: the "rate" variable is update after the input thread do the change */
+    /* Problem with this way: the "rate" variable is updated after the
+     * input thread did the change */
+
     if( !strcmp( psz_cmd, "rate-slower" ) )
     {
         input_ControlPush( p_input, INPUT_CONTROL_SET_RATE_SLOWER, NULL );
@@ -570,6 +579,7 @@ static int RateCallback( vlc_object_t *p_this, char const *psz_cmd,
     }
     else
     {
+        newval.i_int = INPUT_RATE_DEFAULT / newval.f_float;
         input_ControlPush( p_input, INPUT_CONTROL_SET_RATE, &newval );
     }
     return VLC_SUCCESS;