mirror of
https://github.com/mpv-player/mpv.git
synced 2026-10-22 02:36:00 +08:00
mac/libmpv: remove mac option handling in favour of option handler
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.
This commit is contained in:
@@ -25,23 +25,12 @@ class LibmpvHelper {
|
||||
var log: LogHelper
|
||||
var mpvHandle: OpaquePointer?
|
||||
var mpvRenderContext: OpaquePointer?
|
||||
var macOptsPtr: UnsafeMutableRawPointer?
|
||||
var macOpts: macos_opts = macos_opts()
|
||||
var fbo: GLint = 1
|
||||
let deinitLock = NSLock()
|
||||
|
||||
init(_ mpv: OpaquePointer, _ mpLog: OpaquePointer?) {
|
||||
mpvHandle = mpv
|
||||
log = LogHelper(mpLog)
|
||||
|
||||
let global = mp_client_get_global(mpvHandle)
|
||||
guard let ptr = mp_get_config_group(nil, global, Application.getMacOSConf()) else
|
||||
{
|
||||
log.sendError("macOS config group couldn't be retrieved'")
|
||||
exit(1)
|
||||
}
|
||||
macOptsPtr = ptr
|
||||
macOpts = UnsafeMutablePointer<macos_opts>(OpaquePointer(ptr)).pointee
|
||||
}
|
||||
|
||||
func initRender() {
|
||||
@@ -63,7 +52,6 @@ class LibmpvHelper {
|
||||
exit(1)
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
let getProcAddress: (@convention(c) (UnsafeMutableRawPointer?, UnsafePointer<Int8>?)
|
||||
@@ -230,8 +218,6 @@ class LibmpvHelper {
|
||||
if destroy {
|
||||
mpv_destroy(mpvHandle)
|
||||
}
|
||||
ta_free(macOptsPtr)
|
||||
macOptsPtr = nil
|
||||
mpvHandle = nil
|
||||
}
|
||||
}
|
||||
|
||||
@@ -249,7 +249,7 @@ class GLLayer: CAOpenGLLayer {
|
||||
var pix: CGLPixelFormatObj?
|
||||
var depth: GLint = 8
|
||||
var err: CGLError = CGLError(rawValue: 0)
|
||||
let swRender = ccb.libmpv.macOpts.cocoa_cb_sw_renderer
|
||||
let swRender = ccb.option.macOpts.cocoa_cb_sw_renderer
|
||||
|
||||
if swRender != 1 {
|
||||
(pix, depth, err) = GLLayer.findPixelFormat(ccb)
|
||||
@@ -277,12 +277,12 @@ class GLLayer: CAOpenGLLayer {
|
||||
glBase.insert(CGLPixelFormatAttribute(ver.rawValue), at: 1)
|
||||
|
||||
var glFormat = [glBase]
|
||||
if ccb.libmpv.macOpts.cocoa_cb_10bit_context {
|
||||
if ccb.option.macOpts.cocoa_cb_10bit_context {
|
||||
glFormat += [glFormat10Bit]
|
||||
}
|
||||
glFormat += glFormatOptional
|
||||
|
||||
if !ccb.libmpv.macOpts.macos_force_dedicated_gpu {
|
||||
if !ccb.option.macOpts.macos_force_dedicated_gpu {
|
||||
glFormat += [glFormatAutoGPU]
|
||||
}
|
||||
|
||||
@@ -308,7 +308,7 @@ class GLLayer: CAOpenGLLayer {
|
||||
ccb.log.sendWarning("Couldn't create a " +
|
||||
"\(software ? "software" : "hardware accelerated") " +
|
||||
"CGL pixel format: \(errS) (\(err.rawValue))")
|
||||
if software == false && ccb.libmpv.macOpts.cocoa_cb_sw_renderer == -1 {
|
||||
if software == false && ccb.option.macOpts.cocoa_cb_sw_renderer == -1 {
|
||||
ccb.log.sendWarning("Falling back to software renderer")
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user