mirror of
https://github.com/yattee/yattee.git
synced 2024-12-14 14:20:32 +05:30
Fix crashes when using mpv
This commit is contained in:
parent
01d8e28d7c
commit
c821285664
@ -406,17 +406,20 @@ final class MPVClient: ObservableObject {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func setDoubleAsync(_ name: String, _ value: Double) {
|
func setDoubleAsync(_ name: String, _ value: Double) {
|
||||||
|
guard mpv != nil else { return }
|
||||||
var data = value
|
var data = value
|
||||||
mpv_set_property_async(mpv, 0, name, MPV_FORMAT_DOUBLE, &data)
|
mpv_set_property_async(mpv, 0, name, MPV_FORMAT_DOUBLE, &data)
|
||||||
}
|
}
|
||||||
|
|
||||||
private func getDouble(_ name: String) -> Double {
|
private func getDouble(_ name: String) -> Double {
|
||||||
|
guard mpv != nil else { return 0.0 }
|
||||||
var data = Double()
|
var data = Double()
|
||||||
mpv_get_property(mpv, name, MPV_FORMAT_DOUBLE, &data)
|
mpv_get_property(mpv, name, MPV_FORMAT_DOUBLE, &data)
|
||||||
return data
|
return data
|
||||||
}
|
}
|
||||||
|
|
||||||
private func getInt(_ name: String) -> Int {
|
private func getInt(_ name: String) -> Int {
|
||||||
|
guard mpv != nil else { return 0 }
|
||||||
var data = Int64()
|
var data = Int64()
|
||||||
mpv_get_property(mpv, name, MPV_FORMAT_INT64, &data)
|
mpv_get_property(mpv, name, MPV_FORMAT_INT64, &data)
|
||||||
return Int(data)
|
return Int(data)
|
||||||
|
Loading…
Reference in New Issue
Block a user