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 | 25 | var log: LogHelper |
| 26 | 26 | var mpvHandle: OpaquePointer? |
| 27 | 27 | var mpvRenderContext: OpaquePointer? |
| 28 | − var macOptsPtr: UnsafeMutableRawPointer? | |
| 29 | − var macOpts: macos_opts = macos_opts() | |
| 30 | 28 | var fbo: GLint = 1 |
| 31 | 29 | let deinitLock = NSLock() |
| 32 | 30 | |
| 33 | 31 | init(_ mpv: OpaquePointer, _ mpLog: OpaquePointer?) { |
| 34 | 32 | mpvHandle = mpv |
| 35 | 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 | 36 | func initRender() { |
| @@ -63,7 +52,6 @@ class LibmpvHelper { · 15 unmodified lines | ||
| 63 | 52 | exit(1) |
| 64 | 53 | } |
| 65 | 54 | } |
| 66 | − | |
| 67 | 55 | } |
| 68 | 56 | |
| 69 | 57 | let getProcAddress: (@convention(c) (UnsafeMutableRawPointer?, UnsafePointer<Int8>?) |
| @@ -230,8 +218,6 @@ class LibmpvHelper { · 160 unmodified lines | ||
| 230 | 218 | if destroy { |
| 231 | 219 | mpv_destroy(mpvHandle) |
| 232 | 220 | } |
| 233 | − ta_free(macOptsPtr) | |
| 234 | − macOptsPtr = nil | |
| 235 | 221 | mpvHandle = nil |
| 236 | 222 | } |
| 237 | 223 | } |
| @@ -249,7 +249,7 @@ class GLLayer: CAOpenGLLayer { · 248 unmodified lines | ||
| 249 | 249 | var pix: CGLPixelFormatObj? |
| 250 | 250 | var depth: GLint = 8 |
| 251 | 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 | 254 | if swRender != 1 { |
| 255 | 255 | (pix, depth, err) = GLLayer.findPixelFormat(ccb) |
| @@ -277,12 +277,12 @@ class GLLayer: CAOpenGLLayer { · 21 unmodified lines | ||
| 277 | 277 | glBase.insert(CGLPixelFormatAttribute(ver.rawValue), at: 1) |
| 278 | 278 | |
| 279 | 279 | var glFormat = [glBase] |
| 280 | − if ccb.libmpv.macOpts.cocoa_cb_10bit_context { | |
| 280 | + if ccb.option.macOpts.cocoa_cb_10bit_context { | |
| 281 | 281 | glFormat += [glFormat10Bit] |
| 282 | 282 | } |
| 283 | 283 | glFormat += glFormatOptional |
| 284 | 284 | |
| 285 | − if !ccb.libmpv.macOpts.macos_force_dedicated_gpu { | |
| 285 | + if !ccb.option.macOpts.macos_force_dedicated_gpu { | |
| 286 | 286 | glFormat += [glFormatAutoGPU] |
| 287 | 287 | } |
| 288 | 288 | |
| @@ -308,7 +308,7 @@ class GLLayer: CAOpenGLLayer { · 19 unmodified lines | ||
| 308 | 308 | ccb.log.sendWarning("Couldn't create a " + |
| 309 | 309 | "\(software ? "software" : "hardware accelerated") " + |
| 310 | 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 | 312 | ccb.log.sendWarning("Falling back to software renderer") |
| 313 | 313 | } |
| 314 | 314 | |