[vlc-commits] input: change INPUT_RATE_MAX/INPUT_RATE_MIN

Thomas Guillem git at videolan.org
Fri Feb 15 16:38:12 CET 2019


vlc | branch: master | Thomas Guillem <thomas at gllm.fr> | Fri Feb 15 16:11:50 2019 +0100| [797a8dce4e36d44eb3aa971bd20d41ff03ea4679] | committer: Thomas Guillem

input: change INPUT_RATE_MAX/INPUT_RATE_MIN

Inverse them. Indeed, INPUT_RATE_MAX was the min and INPUT_RATE_MIN was the
max. The dbus module did the mistake.

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

 include/vlc_input.h                | 12 ++++--------
 modules/control/dbus/dbus_player.c |  4 ++--
 modules/control/hotkeys.c          |  4 ++--
 src/input/input.c                  |  8 ++++----
 4 files changed, 12 insertions(+), 16 deletions(-)

diff --git a/include/vlc_input.h b/include/vlc_input.h
index d44641dae6..17765de836 100644
--- a/include/vlc_input.h
+++ b/include/vlc_input.h
@@ -296,13 +296,9 @@ typedef enum input_state_e
  * Input rate.
  *
  * It is an float used by the variable "rate" in the
- * range [INPUT_RATE_DEFAULT/INPUT_RATE_MAX, INPUT_RATE_DEFAULT/INPUT_RATE_MIN]
- * the default value being 1. It represents the ratio of playback speed to
+ * range [INPUT_RATE_MIN, INPUT_RATE_MAX]
+ * the default value being 1.f. It represents the ratio of playback speed to
  * nominal speed (bigger is faster).
- *
- * Internally, the rate is stored as a value in the range
- * [INPUT_RATE_MIN, INPUT_RATE_MAX].
- * internal rate = INPUT_RATE_DEFAULT / rate variable
  */
 
 /**
@@ -312,11 +308,11 @@ typedef enum input_state_e
 /**
  * Minimal rate value
  */
-#define INPUT_RATE_MIN        32            /* Up to 32/1 */
+#define INPUT_RATE_MIN 0.03125f
 /**
  * Maximal rate value
  */
-#define INPUT_RATE_MAX     32000            /* Up to 1/32 */
+#define INPUT_RATE_MAX 31.25f
 
 /**
  * Input events
diff --git a/modules/control/dbus/dbus_player.c b/modules/control/dbus/dbus_player.c
index 2a873cea70..5664b50664 100644
--- a/modules/control/dbus/dbus_player.c
+++ b/modules/control/dbus/dbus_player.c
@@ -432,7 +432,7 @@ static int
 MarshalMinimumRate( intf_thread_t *p_intf, DBusMessageIter *container )
 {
     VLC_UNUSED( p_intf );
-    double d_min_rate = (double) INPUT_RATE_MIN / INPUT_RATE_DEFAULT;
+    double d_min_rate = INPUT_RATE_MIN;
 
     if( !dbus_message_iter_append_basic( container, DBUS_TYPE_DOUBLE, &d_min_rate ) )
         return VLC_ENOMEM;
@@ -444,7 +444,7 @@ static int
 MarshalMaximumRate( intf_thread_t *p_intf, DBusMessageIter *container )
 {
     VLC_UNUSED( p_intf );
-    double d_max_rate = (double) INPUT_RATE_MAX / INPUT_RATE_DEFAULT;
+    double d_max_rate = INPUT_RATE_MAX;
 
     if( !dbus_message_iter_append_basic( container, DBUS_TYPE_DOUBLE, &d_max_rate ) )
         return VLC_ENOMEM;
diff --git a/modules/control/hotkeys.c b/modules/control/hotkeys.c
index e995692607..2b7bbfcd61 100644
--- a/modules/control/hotkeys.c
+++ b/modules/control/hotkeys.c
@@ -1569,8 +1569,8 @@ static void DisplayRate( vout_thread_t *p_vout, float f_rate )
 
 static float AdjustRateFine( vlc_object_t *p_obj, const int i_dir )
 {
-    const float f_rate_min = (float)INPUT_RATE_DEFAULT / INPUT_RATE_MAX;
-    const float f_rate_max = (float)INPUT_RATE_DEFAULT / INPUT_RATE_MIN;
+    const float f_rate_min = INPUT_RATE_MIN;
+    const float f_rate_max = INPUT_RATE_MAX;
     float f_rate = var_GetFloat( p_obj, "rate" );
 
     int i_sign = f_rate < 0 ? -1 : 1;
diff --git a/src/input/input.c b/src/input/input.c
index 08f55c0470..3b8f1e3ca0 100644
--- a/src/input/input.c
+++ b/src/input/input.c
@@ -2001,15 +2001,15 @@ static bool Control( input_thread_t *p_input,
             int i_rate_sign = rate < 0 ? -1 : 1;
 
             /* Check rate bound */
-            if( rate > INPUT_RATE_DEFAULT / INPUT_RATE_MIN )
+            if( rate > INPUT_RATE_MAX )
             {
                 msg_Info( p_input, "cannot set rate faster" );
-                rate = INPUT_RATE_DEFAULT / INPUT_RATE_MIN;
+                rate = INPUT_RATE_MAX;
             }
-            else if( rate < INPUT_RATE_DEFAULT / INPUT_RATE_MAX )
+            else if( rate < INPUT_RATE_MIN )
             {
                 msg_Info( p_input, "cannot set rate slower" );
-                rate = INPUT_RATE_DEFAULT / INPUT_RATE_MAX;
+                rate = INPUT_RATE_MIN;
             }
 
             /* Apply direction */



More information about the vlc-commits mailing list