since the option handler is not optional anymore and available on init in cocoa-cb we don't need to duplicate this functionality in libmpv anymore.
Unified · Split
| @@ -25,23 +25,12 @@ class LibmpvHelper { · 24 unmodified lines | |||
| 25 | var log: LogHelper | 25 | var log: LogHelper |
| 26 | var mpvHandle: OpaquePointer? | 26 | var mpvHandle: OpaquePointer? |
| 27 | var mpvRenderContext: OpaquePointer? | 27 | var mpvRenderContext: OpaquePointer? |
| 28 | var macOptsPtr: UnsafeMutableRawPointer? | ||
| 29 | var macOpts: macos_opts = macos_opts() | ||
| 30 | var fbo: GLint = 1 | 28 | var fbo: GLint = 1 |
| 31 | let deinitLock = NSLock() | 29 | let deinitLock = NSLock() |
| 32 | 30 | ||
| 33 | init(_ mpv: OpaquePointer, _ mpLog: OpaquePointer?) { | 31 | init(_ mpv: OpaquePointer, _ mpLog: OpaquePointer?) { |
| 34 | mpvHandle = mpv | 32 | mpvHandle = mpv |
| 35 | log = LogHelper(mpLog) | 33 | log = LogHelper(mpLog) |
| 36 | |||
| 37 | let global = mp_client_get_global(mpvHandle) | ||
| 38 | guard let ptr = mp_get_config_group(nil, global, Application.getMacOSConf()) else | ||
| 39 | { | ||
| 40 | log.sendError("macOS config group couldn't be retrieved'") | ||
| 41 | exit(1) | ||
| 42 | } | ||
| 43 | macOptsPtr = ptr | ||
| 44 | macOpts = UnsafeMutablePointer<macos_opts>(OpaquePointer(ptr)).pointee | ||
| 45 | } | 34 | } |
| 46 | 35 | ||
| 47 | func initRender() { | 36 | func initRender() { |
| @@ -63,7 +52,6 @@ class LibmpvHelper { · 15 unmodified lines | |||
| 63 | exit(1) | 52 | exit(1) |
| 64 | } | 53 | } |
| 65 | } | 54 | } |
| 66 | |||
| 67 | } | 55 | } |
| 68 | 56 | ||
| 69 | let getProcAddress: (@convention(c) (UnsafeMutableRawPointer?, UnsafePointer<Int8>?) | 57 | let getProcAddress: (@convention(c) (UnsafeMutableRawPointer?, UnsafePointer<Int8>?) |
| @@ -230,8 +218,6 @@ class LibmpvHelper { · 160 unmodified lines | |||
| 230 | if destroy { | 218 | if destroy { |
| 231 | mpv_destroy(mpvHandle) | 219 | mpv_destroy(mpvHandle) |
| 232 | } | 220 | } |
| 233 | ta_free(macOptsPtr) | ||
| 234 | macOptsPtr = nil | ||
| 235 | mpvHandle = nil | 221 | mpvHandle = nil |
| 236 | } | 222 | } |
| 237 | } | 223 | } |
| @@ -249,7 +249,7 @@ class GLLayer: CAOpenGLLayer { · 248 unmodified lines | |||
| 249 | var pix: CGLPixelFormatObj? | 249 | var pix: CGLPixelFormatObj? |
| 250 | var depth: GLint = 8 | 250 | var depth: GLint = 8 |
| 251 | var err: CGLError = CGLError(rawValue: 0) | 251 | var err: CGLError = CGLError(rawValue: 0) |
| 252 | let swRender = ccb.libmpv.macOpts.cocoa_cb_sw_renderer | 252 | let swRender = ccb.option.macOpts.cocoa_cb_sw_renderer |
| 253 | 253 | ||
| 254 | if swRender != 1 { | 254 | if swRender != 1 { |
| 255 | (pix, depth, err) = GLLayer.findPixelFormat(ccb) | 255 | (pix, depth, err) = GLLayer.findPixelFormat(ccb) |
| @@ -277,12 +277,12 @@ class GLLayer: CAOpenGLLayer { · 21 unmodified lines | |||
| 277 | glBase.insert(CGLPixelFormatAttribute(ver.rawValue), at: 1) | 277 | glBase.insert(CGLPixelFormatAttribute(ver.rawValue), at: 1) |
| 278 | 278 | ||
| 279 | var glFormat = [glBase] | 279 | var glFormat = [glBase] |
| 280 | if ccb.libmpv.macOpts.cocoa_cb_10bit_context { | 280 | if ccb.option.macOpts.cocoa_cb_10bit_context { |
| 281 | glFormat += [glFormat10Bit] | 281 | glFormat += [glFormat10Bit] |
| 282 | } | 282 | } |
| 283 | glFormat += glFormatOptional | 283 | glFormat += glFormatOptional |
| 284 | 284 | ||
| 285 | if !ccb.libmpv.macOpts.macos_force_dedicated_gpu { | 285 | if !ccb.option.macOpts.macos_force_dedicated_gpu { |
| 286 | glFormat += [glFormatAutoGPU] | 286 | glFormat += [glFormatAutoGPU] |
| 287 | } | 287 | } |
| 288 | 288 | ||
| @@ -308,7 +308,7 @@ class GLLayer: CAOpenGLLayer { · 19 unmodified lines | |||
| 308 | ccb.log.sendWarning("Couldn't create a " + | 308 | ccb.log.sendWarning("Couldn't create a " + |
| 309 | "\(software ? "software" : "hardware accelerated") " + | 309 | "\(software ? "software" : "hardware accelerated") " + |
| 310 | "CGL pixel format: \(errS) (\(err.rawValue))") | 310 | "CGL pixel format: \(errS) (\(err.rawValue))") |
| 311 | if software == false && ccb.libmpv.macOpts.cocoa_cb_sw_renderer == -1 { | 311 | if software == false && ccb.option.macOpts.cocoa_cb_sw_renderer == -1 { |
| 312 | ccb.log.sendWarning("Falling back to software renderer") | 312 | ccb.log.sendWarning("Falling back to software renderer") |
| 313 | } | 313 | } |
| 314 | 314 | ||