From 984c890661fef3bc5e326a291803c10ed86b6350 Mon Sep 17 00:00:00 2001 From: der richter Date: Sat, 27 Apr 2024 22:35:36 +0200 Subject: [PATCH] mac/helper: make wakeup callback declaration consistent --- osdep/mac/event_helper.swift | 4 ++-- osdep/mac/option_helper.swift | 6 ++++-- video/out/mac/common.swift | 2 +- 3 files changed, 7 insertions(+), 5 deletions(-) diff --git a/osdep/mac/event_helper.swift b/osdep/mac/event_helper.swift index 277a9aa08d..ac388001c8 100644 --- a/osdep/mac/event_helper.swift +++ b/osdep/mac/event_helper.swift @@ -27,7 +27,7 @@ extension EventSubscriber { } extension EventHelper { - typealias wakeup_cb = (@convention(c) (UnsafeMutableRawPointer?) -> Void)? + typealias WakeupCallback = (@convention(c) (UnsafeMutableRawPointer?) -> Void)? struct Event { var id: String { @@ -91,7 +91,7 @@ class EventHelper { } } - let wakeup: wakeup_cb = { ( ctx ) in + let wakeup: WakeupCallback = { ( ctx ) in let event = unsafeBitCast(ctx, to: EventHelper.self) DispatchQueue.main.async { event.eventLoop() } } diff --git a/osdep/mac/option_helper.swift b/osdep/mac/option_helper.swift index c44f0907c8..d7aaa0c670 100644 --- a/osdep/mac/option_helper.swift +++ b/osdep/mac/option_helper.swift @@ -17,7 +17,9 @@ import Cocoa -typealias swift_wakeup_cb_fn = (@convention(c) (UnsafeMutableRawPointer?) -> Void)? +extension OptionHelper { + typealias WakeupCallback = (@convention(c) (UnsafeMutableRawPointer?) -> Void)? +} class OptionHelper { var voCachePtr: UnsafeMutablePointer @@ -64,7 +66,7 @@ class OptionHelper { } } - func setMacOptionCallback(_ callback: swift_wakeup_cb_fn, context object: AnyObject) { + func setMacOptionCallback(_ callback: WakeupCallback, context object: AnyObject) { m_config_cache_set_wakeup_cb(macCachePtr, callback, TypeHelper.bridge(obj: object)) } diff --git a/video/out/mac/common.swift b/video/out/mac/common.swift index 74ce3c1903..eeb972064d 100644 --- a/video/out/mac/common.swift +++ b/video/out/mac/common.swift @@ -654,7 +654,7 @@ class Common: NSObject { } } - let macOptsWakeupCallback: swift_wakeup_cb_fn = { ( ctx ) in + let macOptsWakeupCallback: OptionHelper.WakeupCallback = { ( ctx ) in let com = unsafeBitCast(ctx, to: Common.self) DispatchQueue.main.async { com.macOptsUpdate()