summaryrefslogtreecommitdiffstats
path: root/video/out/mac_common.swift
diff options
context:
space:
mode:
Diffstat (limited to 'video/out/mac_common.swift')
-rw-r--r--video/out/mac_common.swift17
1 files changed, 8 insertions, 9 deletions
diff --git a/video/out/mac_common.swift b/video/out/mac_common.swift
index 364cd59319..b356cc6e1b 100644
--- a/video/out/mac_common.swift
+++ b/video/out/mac_common.swift
@@ -26,9 +26,9 @@ class MacCommon: Common {
@objc init(_ vo: UnsafeMutablePointer<vo>) {
let newlog = mp_log_new(vo, vo.pointee.log, "mac")
- super.init(newlog)
+ let option = OptionHelper(vo, vo.pointee.global)
+ super.init(option, newlog)
self.vo = vo
- option = OptionHelper(vo, vo.pointee.global)
input = InputHelper(vo.pointee.input_ctx, option)
timer = PreciseTimer(common: self)
@@ -45,7 +45,7 @@ class MacCommon: Common {
let previousActiveApp = getActiveApp()
initApp()
- let (_, _, wr) = getInitProperties(vo)
+ let (_, wr) = getInitProperties(vo)
guard let layer = self.layer else {
log.sendError("Something went wrong, no MetalLayer was initialized")
@@ -59,12 +59,12 @@ class MacCommon: Common {
}
if !NSEqualSizes(window?.unfsContentFramePixel.size ?? NSZeroSize, wr.size) &&
- option?.opts.auto_window_resize ?? true
+ option.opts.auto_window_resize
{
window?.updateSize(wr.size)
}
- if option?.opts.focus_on ?? 1 == 2 {
+ if option.opts.focus_on == 2 {
NSApp.activate(ignoringOtherApps: true)
}
@@ -89,7 +89,7 @@ class MacCommon: Common {
}
@objc func swapBuffer() {
- if option?.macOpts.macos_render_timer ?? Int32(RENDER_TIMER_CALLBACK) != RENDER_TIMER_SYSTEM {
+ if option.macOpts.macos_render_timer != RENDER_TIMER_SYSTEM {
swapLock.lock()
while(swapTime < 1) {
swapLock.wait()
@@ -105,7 +105,6 @@ class MacCommon: Common {
_ flagsIn: CVOptionFlags,
_ flagsOut: UnsafeMutablePointer<CVOptionFlags>) -> CVReturn
{
- let frameTimer = option?.macOpts.macos_render_timer ?? Int32(RENDER_TIMER_CALLBACK)
let signalSwap = {
self.swapLock.lock()
self.swapTime += 1
@@ -113,8 +112,8 @@ class MacCommon: Common {
self.swapLock.unlock()
}
- if frameTimer != RENDER_TIMER_SYSTEM {
- if let timer = self.timer, frameTimer == RENDER_TIMER_PRECISE {
+ if option.macOpts.macos_render_timer != RENDER_TIMER_SYSTEM {
+ if let timer = self.timer, option.macOpts.macos_render_timer == RENDER_TIMER_PRECISE {
timer.scheduleAt(time: inOutputTime.pointee.hostTime, closure: signalSwap)
return kCVReturnSuccess
}