[vlc-commits] gui:macosx: convert vlc_tick_t to seconds explicitly using SEC_FROM_VLC_TICK()
Steve Lhomme
git at videolan.org
Fri Jul 6 16:07:20 CEST 2018
vlc | branch: master | Steve Lhomme <robux4 at ycbcr.xyz> | Thu Jun 14 13:42:23 2018 +0200| [c93ec6762b8a5d110e240af6cd873c631a6583e9] | committer: Steve Lhomme
gui:macosx: convert vlc_tick_t to seconds explicitly using SEC_FROM_VLC_TICK()
> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=c93ec6762b8a5d110e240af6cd873c631a6583e9
---
modules/gui/macosx/VLCFSPanelController.m | 6 +++---
modules/gui/macosx/VLCMainWindow.m | 4 +---
modules/gui/macosx/VLCStringUtility.m | 4 ++--
modules/gui/macosx/applescript.m | 2 +-
4 files changed, 7 insertions(+), 9 deletions(-)
diff --git a/modules/gui/macosx/VLCFSPanelController.m b/modules/gui/macosx/VLCFSPanelController.m
index cf65ad197c..4b9f43400b 100644
--- a/modules/gui/macosx/VLCFSPanelController.m
+++ b/modules/gui/macosx/VLCFSPanelController.m
@@ -268,15 +268,15 @@ static NSString *kAssociatedFullscreenRect = @"VLCFullscreenAssociatedWindowRect
vlc_tick_t remaining = 0;
if (dur > t)
remaining = dur - t;
- totalTime = [NSString stringWithFormat:@"-%s", secstotimestr(psz_time, (int)(remaining / CLOCK_FREQ))];
+ totalTime = [NSString stringWithFormat:@"-%s", secstotimestr(psz_time, (int)SEC_FROM_VLC_TICK(remaining))];
} else {
- totalTime = toNSStr(secstotimestr(psz_time, (int)(dur / 1000000)));
+ totalTime = toNSStr(secstotimestr(psz_time, (int)SEC_FROM_VLC_TICK(dur)));
}
[_remainingOrTotalTime setStringValue:totalTime];
}
/* Update current position (left field) */
- NSString *playbackPosition = toNSStr(secstotimestr(psz_time, (int)(t / CLOCK_FREQ)));
+ NSString *playbackPosition = toNSStr(secstotimestr(psz_time, (int)SEC_FROM_VLC_TICK(t)));
[_elapsedTime setStringValue:playbackPosition];
vlc_object_release(p_input);
diff --git a/modules/gui/macosx/VLCMainWindow.m b/modules/gui/macosx/VLCMainWindow.m
index b68dab5c27..24ce676d29 100644
--- a/modules/gui/macosx/VLCMainWindow.m
+++ b/modules/gui/macosx/VLCMainWindow.m
@@ -842,12 +842,10 @@ static const float f_min_window_height = 307.;
if (mt_duration < 1)
return @"";
- mt_duration = mt_duration / CLOCK_FREQ;
-
NSDateComponentsFormatter *formatter = [[NSDateComponentsFormatter alloc] init];
formatter.unitsStyle = NSDateComponentsFormatterUnitsStyleAbbreviated;
- NSString* outputString = [formatter stringFromTimeInterval:mt_duration];
+ NSString* outputString = [formatter stringFromTimeInterval:SEC_FROM_VLC_TICK(mt_duration)];
return [NSString stringWithFormat:@" — %@", outputString];
}
diff --git a/modules/gui/macosx/VLCStringUtility.m b/modules/gui/macosx/VLCStringUtility.m
index 307fcc78fb..de5c84b0de 100644
--- a/modules/gui/macosx/VLCStringUtility.m
+++ b/modules/gui/macosx/VLCStringUtility.m
@@ -118,9 +118,9 @@ NSString *const kVLCMediaUnknown = @"Unknown";
vlc_tick_t remaining = 0;
if (dur > t)
remaining = dur - t;
- return [NSString stringWithFormat: @"-%s", secstotimestr(psz_time, (int)(remaining / 1000000))];
+ return [NSString stringWithFormat: @"-%s", secstotimestr(psz_time, (int)SEC_FROM_VLC_TICK(remaining))];
} else
- return toNSStr(secstotimestr(psz_time, (int)(t / CLOCK_FREQ )));
+ return toNSStr(secstotimestr(psz_time, (int)SEC_FROM_VLC_TICK(t)));
}
- (NSString *)stringForTime:(long long int)time
diff --git a/modules/gui/macosx/applescript.m b/modules/gui/macosx/applescript.m
index a0f6ec1697..1ea4163900 100644
--- a/modules/gui/macosx/applescript.m
+++ b/modules/gui/macosx/applescript.m
@@ -232,7 +232,7 @@
input_Control(p_input, INPUT_GET_TIME, &i_currentTime);
vlc_object_release(p_input);
- return (int)(i_currentTime / CLOCK_FREQ);
+ return (int)SEC_FROM_VLC_TICK(i_currentTime);
}
- (void) setCurrentTime:(int)i_currentTime {
More information about the vlc-commits
mailing list