[vlc-commits] Fix misleading Playback Speed string on menu.

Naohiro KORIYAMA git at videolan.org
Tue Mar 20 16:39:57 CET 2012


vlc | branch: master | Naohiro KORIYAMA <nkoriyama at gmail.com> | Sat Jan 14 14:17:50 2012 +0900| [70a5e26593b671ab5d267b3c527fda4ba83deae1] | committer: Felix Paul Kühne

Fix misleading Playback Speed string on menu.

When increasing speed to 1.50 (command + =), '1.50x' is shown on OSD, but '10x' is shown on menu (Playback -> 'Playback Speed').

Signed-off-by: Felix Paul Kühne <fkuehne at videolan.org>

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

 modules/gui/macosx/MainMenu.m |   15 ++++++---------
 1 files changed, 6 insertions(+), 9 deletions(-)

diff --git a/modules/gui/macosx/MainMenu.m b/modules/gui/macosx/MainMenu.m
index a811e11..55cb972 100644
--- a/modules/gui/macosx/MainMenu.m
+++ b/modules/gui/macosx/MainMenu.m
@@ -544,9 +544,8 @@ static VLCMainMenu *_o_sharedInstance = nil;
     [o_mi_rate_sld setEnabled: b_enabled];
     [o_mi_rate_sld setIntValue: [[VLCCoreInteraction sharedInstance] playbackRate]];
     int i = [[VLCCoreInteraction sharedInstance] playbackRate];
-    if (i == 0)
-        i = 1;
-    [o_mi_rate_fld setStringValue: [NSString stringWithFormat:@"%ix", i]];
+    double speed =  pow( 2, (double)i / 17 );
+    [o_mi_rate_fld setStringValue: [NSString stringWithFormat:@"%.2fx", speed]];
     if (b_enabled) {
         [o_mi_rate_lbl setHidden: NO];
         [o_mi_rate_lbl_gray setHidden: YES];
@@ -598,17 +597,15 @@ static VLCMainMenu *_o_sharedInstance = nil;
 {
     [[VLCCoreInteraction sharedInstance] setPlaybackRate: [o_mi_rate_sld intValue]];
     int i = [[VLCCoreInteraction sharedInstance] playbackRate];
-    if (i == 0)
-        i = 1;
-    [o_mi_rate_fld setStringValue: [NSString stringWithFormat:@"%ix", i]];
+    double speed =  pow( 2, (double)i / 17 );
+    [o_mi_rate_fld setStringValue: [NSString stringWithFormat:@"%.2fx", speed]];
 }
 
 - (void)updatePlaybackRate
 {
     int i = [[VLCCoreInteraction sharedInstance] playbackRate];
-    if (i == 0)
-        i = 1;
-    [o_mi_rate_fld setStringValue: [NSString stringWithFormat:@"%ix", i]];
+    double speed =  pow( 2, (double)i / 17 );
+    [o_mi_rate_fld setStringValue: [NSString stringWithFormat:@"%.2fx", speed]];
     [o_mi_rate_sld setIntValue: i];
 }
 



More information about the vlc-commits mailing list