summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorder richter <der.richter@gmx.de>2024-03-17 17:51:05 +0100
committerder richter <der.richter@gmx.de>2024-03-18 20:29:27 +0100
commit647bf5d0badbe09002bb05a7c3a7c3fe316a62a1 (patch)
tree7509608ac4f66ddb8ea9f569bd3868da6d120868
parentc8088d801a99109b213a416da20a9e5d712ca492 (diff)
downloadmpv-647bf5d0badbe09002bb05a7c3a7c3fe316a62a1.tar.bz2
mpv-647bf5d0badbe09002bb05a7c3a7c3fe316a62a1.tar.xz
mac/touchbar: take playback speed into account for rate limiting
-rw-r--r--osdep/mac/touch_bar.swift5
1 files changed, 4 insertions, 1 deletions
diff --git a/osdep/mac/touch_bar.swift b/osdep/mac/touch_bar.swift
index dcebb24970..9ee312fa7a 100644
--- a/osdep/mac/touch_bar.swift
+++ b/osdep/mac/touch_bar.swift
@@ -80,6 +80,7 @@ class TouchBar: NSTouchBar, NSTouchBarDelegate {
var isPaused: Bool = false
var position: Double = 0
var duration: Double = 0
+ var rate: Double = 0
override init() {
super.init()
@@ -326,7 +327,7 @@ class TouchBar: NSTouchBar, NSTouchBarDelegate {
switch String(cString: property.name) {
case "time-pos" where property.format == MPV_FORMAT_DOUBLE:
let newPosition = max(LibmpvHelper.mpvDoubleToDouble(property.data) ?? 0, 0)
- if Int(floor(newPosition) - floor(position)) != 0 {
+ if Int((floor(newPosition) - floor(position)) / rate) != 0 {
position = newPosition
updateTouchBarTimeItems()
}
@@ -336,6 +337,8 @@ class TouchBar: NSTouchBar, NSTouchBarDelegate {
case "pause" where property.format == MPV_FORMAT_FLAG:
isPaused = LibmpvHelper.mpvFlagToBool(property.data) ?? false
updatePlayButton()
+ case "speed" where property.format == MPV_FORMAT_DOUBLE:
+ rate = LibmpvHelper.mpvDoubleToDouble(property.data) ?? 1
default:
break
}