[vlc-devel] commit: Allow setting the playback rate from configuration ( Rémi Denis-Courmont )

git version control git at videolan.org
Sat Nov 21 21:35:57 CET 2009


vlc | branch: master | Rémi Denis-Courmont <remi at remlab.net> | Sat Nov 21 22:35:40 2009 +0200| [a03728789611bab7cec1b74f8b6e814ed0c8021b] | committer: Rémi Denis-Courmont 

Allow setting the playback rate from configuration

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=a03728789611bab7cec1b74f8b6e814ed0c8021b
---

 src/input/input.c   |    6 +++++-
 src/libvlc-module.c |    6 ++++++
 2 files changed, 11 insertions(+), 1 deletions(-)

diff --git a/src/input/input.c b/src/input/input.c
index 02be366..03d172f 100644
--- a/src/input/input.c
+++ b/src/input/input.c
@@ -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 );
diff --git a/src/libvlc-module.c b/src/libvlc-module.c
index 6551cc5..39e2a2f 100644
--- a/src/libvlc-module.c
+++ b/src/libvlc-module.c
@@ -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 )




More information about the vlc-devel mailing list