From 8cc3160f71161f86d0d0d5bbde9dec4a1a91f94e Mon Sep 17 00:00:00 2001 From: der richter Date: Thu, 17 Oct 2024 13:33:35 +0200 Subject: [PATCH] mac/event: add MPV_FORMAT_NODE handler --- osdep/mac/event_helper.swift | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/osdep/mac/event_helper.swift b/osdep/mac/event_helper.swift index 6331a64a9f..0857a0bc0f 100644 --- a/osdep/mac/event_helper.swift +++ b/osdep/mac/event_helper.swift @@ -40,21 +40,27 @@ extension EventHelper { let format: mpv_format let string: String? let bool: Bool? + let int: Int64? let double: Double? + let array: [Any?] init( name: String = "", format: mpv_format = MPV_FORMAT_NONE, string: String? = nil, bool: Bool? = nil, - double: Double? = nil + int: Int64? = nil, + double: Double? = nil, + array: [Any?] = [] ) { self.name = name self.format = format self.string = string self.bool = bool + self.int = int self.double = double + self.array = array } } } @@ -136,6 +142,17 @@ class EventHelper { event = .init(name: name, format: format, bool: TypeHelper.toBool(property.data)) case MPV_FORMAT_DOUBLE: event = .init(name: name, format: format, double: TypeHelper.toDouble(property.data)) + case MPV_FORMAT_NODE: + let node = TypeHelper.toNode(property.data) + event = .init( + name: name, + format: format, + string: TypeHelper.nodeToString(node), + bool: TypeHelper.nodeToBool(node), + int: TypeHelper.nodeToInt(node), + double: TypeHelper.nodeToDouble(node), + array: TypeHelper.nodeToArray(node) + ) case MPV_FORMAT_NONE: event = .init(name: name, format: format) default: break