1
0
mirror of https://github.com/yattee/yattee.git synced 2024-12-13 22:00:31 +05:30

Fix crashes when using mpv

This commit is contained in:
Arkadiusz Fal 2022-11-10 23:26:25 +01:00
parent 01d8e28d7c
commit c821285664

View File

@ -406,17 +406,20 @@ final class MPVClient: ObservableObject {
}
func setDoubleAsync(_ name: String, _ value: Double) {
guard mpv != nil else { return }
var data = value
mpv_set_property_async(mpv, 0, name, MPV_FORMAT_DOUBLE, &data)
}
private func getDouble(_ name: String) -> Double {
guard mpv != nil else { return 0.0 }
var data = Double()
mpv_get_property(mpv, name, MPV_FORMAT_DOUBLE, &data)
return data
}
private func getInt(_ name: String) -> Int {
guard mpv != nil else { return 0 }
var data = Int64()
mpv_get_property(mpv, name, MPV_FORMAT_INT64, &data)
return Int(data)