From ae2972557f555a11591082c213e653ac68a01f23 Mon Sep 17 00:00:00 2001 From: Akemi Date: Wed, 28 Feb 2018 15:08:41 +0100 Subject: cocoa-cb: use new libmpv API instead of opengl-cb a new replacement API was introduced with b037121 and the old one was deprecated. porting cocoa-cb to the new API. --- video/out/cocoa-cb/events_view.swift | 2 +- video/out/cocoa-cb/video_layer.swift | 14 +++++++------- video/out/cocoa_cb_common.swift | 12 ++++++------ 3 files changed, 14 insertions(+), 14 deletions(-) (limited to 'video/out') diff --git a/video/out/cocoa-cb/events_view.swift b/video/out/cocoa-cb/events_view.swift index e2da8345f1..729a26263e 100644 --- a/video/out/cocoa-cb/events_view.swift +++ b/video/out/cocoa-cb/events_view.swift @@ -52,7 +52,7 @@ class EventsView: NSView { return } - tracker = NSTrackingArea(rect: self.bounds, + tracker = NSTrackingArea(rect: bounds, options: [.activeAlways, .mouseEnteredAndExited, .mouseMoved, .enabledDuringMouseDrag], owner: self, userInfo: nil) addTrackingArea(tracker!) diff --git a/video/out/cocoa-cb/video_layer.swift b/video/out/cocoa-cb/video_layer.swift index 8e2eee621b..c5604b88f7 100644 --- a/video/out/cocoa-cb/video_layer.swift +++ b/video/out/cocoa-cb/video_layer.swift @@ -76,10 +76,10 @@ class VideoLayer: CAOpenGLLayer { fatalError("init(coder:) has not been implemented") } - func setUpGLCB() { - self.mpv.initGLCB() - self.mpv.setGLCBUpdateCallback(self.updateCallback, context: self) - self.mpv.setGLCBControlCallback(self.cocoaCB.controlCallback, context: self.cocoaCB) + func setUpRender() { + mpv.initRender() + mpv.setRenderUpdateCallback(updateCallback, context: self) + mpv.setRenderControlCallback(cocoaCB.controlCallback, context: cocoaCB) } override func canDraw(inCGLContext ctx: CGLContextObj, @@ -114,7 +114,7 @@ class VideoLayer: CAOpenGLLayer { } } - mpv.drawGLCB(surfaceSize!) + mpv.drawRender(surfaceSize!) CGLFlushDrawable(ctx) drawLock.unlock() @@ -200,7 +200,7 @@ class VideoLayer: CAOpenGLLayer { return ctx } - let updateCallback: mpv_opengl_cb_update_fn = { (ctx) in + let updateCallback: mpv_render_update_fn = { (ctx) in let layer: VideoLayer = MPVHelper.bridge(ptr: ctx!) layer.neededFlips += 1 } @@ -218,7 +218,7 @@ class VideoLayer: CAOpenGLLayer { } func reportFlip() { - mpv.reportGLCBFlip() + mpv.reportRenderFlip() videoLock.lock() if !isAsynchronous && neededFlips > 0 && hasVideo { if !cocoaCB.window.occlusionState.contains(.visible) && diff --git a/video/out/cocoa_cb_common.swift b/video/out/cocoa_cb_common.swift index c18bb29971..426181d13e 100644 --- a/video/out/cocoa_cb_common.swift +++ b/video/out/cocoa_cb_common.swift @@ -61,7 +61,7 @@ class CocoaCB: NSObject { func setMpvHandle(_ ctx: OpaquePointer) { mpv = MPVHelper(ctx) - layer.setUpGLCB() + layer.setUpRender() } func preinit() { @@ -113,7 +113,7 @@ class CocoaCB: NSObject { NSApp.activate(ignoringOtherApps: true) layer.setVideo(true) - if self.mpv.getBoolProperty("fullscreen") { + if mpv.getBoolProperty("fullscreen") { DispatchQueue.main.async { self.window.toggleFullScreen(nil) } @@ -239,7 +239,7 @@ class CocoaCB: NSObject { func updateICCProfile() { if mpv.getBoolProperty("icc-profile-auto") { - mpv.setGLCBICCProfile(window.screen!.colorSpace!) + mpv.setRenderICCProfile(window.screen!.colorSpace!) } layer.colorspace = window.screen!.colorSpace!.cgColorSpace! } @@ -273,7 +273,7 @@ class CocoaCB: NSObject { var mean = (values[0] + values[1]) / 2 if ccb.lastLmu != mean { ccb.lastLmu = mean - ccb.mpv.setGLCBLux(ccb.lmuToLux(ccb.lastLmu)) + ccb.mpv.setRenderLux(ccb.lmuToLux(ccb.lastLmu)) } } } @@ -383,7 +383,7 @@ class CocoaCB: NSObject { return ev } - var controlCallback: mpv_opengl_cb_control_fn = { ( ctx, events, request, data ) -> Int32 in + var controlCallback: mp_render_cb_control_fn = { ( ctx, events, request, data ) -> Int32 in let ccb: CocoaCB = MPVHelper.bridge(ptr: ctx!) switch mp_voctrl(request) { @@ -466,7 +466,7 @@ class CocoaCB: NSObject { stopDisplaylink() uninitLightSensor() removeDisplayReconfigureObserver() - mpv.deinitGLCB() + mpv.deinitRender() mpv.deinitMPV() case MPV_EVENT_PROPERTY_CHANGE: if backendState == .init { -- cgit v1.2.3