[vlc-commits] gui: macos: use float for rate

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


vlc | branch: master | Thomas Guillem <thomas at gllm.fr> | Fri Feb 15 16:06:12 2019 +0100| [b28045789d6a3769e726d40f993e8d07d0e5c4f1] | committer: Thomas Guillem

gui: macos: use float for rate

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

 modules/gui/macosx/coreinteraction/VLCCoreInteraction.m | 11 +++++------
 1 file changed, 5 insertions(+), 6 deletions(-)

diff --git a/modules/gui/macosx/coreinteraction/VLCCoreInteraction.m b/modules/gui/macosx/coreinteraction/VLCCoreInteraction.m
index b11284faab..1a014e6fd1 100644
--- a/modules/gui/macosx/coreinteraction/VLCCoreInteraction.m
+++ b/modules/gui/macosx/coreinteraction/VLCCoreInteraction.m
@@ -50,7 +50,7 @@ static int BossCallback(vlc_object_t *p_this, const char *psz_var,
 
 @interface VLCCoreInteraction ()
 {
-    int i_currentPlaybackRate;
+    float f_currentPlaybackRate;
     vlc_tick_t timeA, timeB;
 
     float f_maxVolume;
@@ -176,10 +176,9 @@ static int BossCallback(vlc_object_t *p_this, const char *psz_var,
     playlist_t * p_playlist = pl_Get(getIntf());
 
     double speed = pow(2, (double)i_value / 17);
-    int rate = INPUT_RATE_DEFAULT / speed;
-    if (i_currentPlaybackRate != rate)
-        var_SetFloat(p_playlist, "rate", (float)INPUT_RATE_DEFAULT / (float)rate);
-    i_currentPlaybackRate = rate;
+    if (f_currentPlaybackRate != speed)
+        var_SetFloat(p_playlist, "rate", speed);
+    f_currentPlaybackRate = speed;
 }
 
 - (int)playbackRate
@@ -199,6 +198,7 @@ static int BossCallback(vlc_object_t *p_this, const char *psz_var,
         playlist_t * p_playlist = pl_Get(getIntf());
         f_rate = var_GetFloat(p_playlist, "rate");
     }
+    f_currentPlaybackRate = f_rate;
 
     double value = 17 * log(f_rate) / log(2.);
     int returnValue = (int) ((value > 0) ? value + .5 : value - .5);
@@ -208,7 +208,6 @@ static int BossCallback(vlc_object_t *p_this, const char *psz_var,
     else if (returnValue > 34)
         returnValue = 34;
 
-    i_currentPlaybackRate = returnValue;
     return returnValue;
 }
 



More information about the vlc-commits mailing list