]> git.sesse.net Git - vlc/commitdiff
Allow setting the playback rate from configuration
authorRémi Denis-Courmont <remi@remlab.net>
Sat, 21 Nov 2009 20:35:40 +0000 (22:35 +0200)
committerRémi Denis-Courmont <remi@remlab.net>
Sat, 21 Nov 2009 20:35:40 +0000 (22:35 +0200)
src/input/input.c
src/libvlc-module.c

index 02be3663c2b01fdea2330dbb59550dfaad0883fa..03d172ffeb1d9c931193bb2c201c8c2290df2a35 100644 (file)
@@ -346,7 +346,11 @@ 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;
+    p_input->p->i_rate = INPUT_RATE_DEFAULT
+                         / var_CreateGetFloat( p_input, "rate" );
+    /* Currently, the input rate variable is an integer. So we need to destroy
+     * the float variable inherited from the configuration. */
+    var_Destroy( p_input, "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 );
index 6551cc52295f7aac4cef043f7b2a3ec53c9f212a..39e2a2f8fcd861cc3ed6f0622dcf6fdb3f68333b 100644 (file)
@@ -727,6 +727,10 @@ static const char *const ppsz_clock_descriptions[] =
 #define INPUT_FAST_SEEK_LONGTEXT N_( \
     "Favor speed over precision while seeking" )
 
+#define INPUT_RATE_TEXT N_("Playback speed")
+#define INPUT_RATE_LONGTEXT N_( \
+    "This defines the playback speed (nominal speed is 1.0)." )
+
 #define INPUT_LIST_TEXT N_("Input list")
 #define INPUT_LIST_LONGTEXT N_( \
     "You can give a comma-separated list " \
@@ -1794,6 +1798,8 @@ vlc_module_begin ()
     add_bool( "input-fast-seek", false, NULL,
               INPUT_FAST_SEEK_TEXT, INPUT_FAST_SEEK_LONGTEXT, false )
         change_safe ()
+    add_float( "rate", 1., NULL,
+               INPUT_RATE_TEXT, INPUT_RATE_LONGTEXT, false )
 
     add_string( "input-list", NULL, NULL,
                  INPUT_LIST_TEXT, INPUT_LIST_LONGTEXT, true )