Skip to content

Commit e0014f8

Browse files
committed
log cleanup
1 parent 046f820 commit e0014f8

File tree

1 file changed

+13
-10
lines changed

1 file changed

+13
-10
lines changed

video/out/mac_common.swift

Lines changed: 13 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,9 @@ class MacCommon: Common {
2222

2323
// functions called by context
2424
@objc init(_ vo: UnsafeMutablePointer<vo>) {
25-
super.init()
26-
mpv = MPVHelper(vo, "mac")
25+
let newlog = mp_log_new(vo, vo.pointee.log, "mac")
26+
super.init(newlog)
27+
mpv = MPVHelper(vo, log)
2728

2829
DispatchQueue.main.sync {
2930
layer = CAMetalLayer()
@@ -49,15 +50,15 @@ class MacCommon: Common {
4950

5051
guard let mpv = mpv else {
5152
// TODO log helper refactor
52-
//mpv?.sendWarning("Unexpected nil value in Control Callback")
53+
//log.sendWarning("Unexpected nil value in Control Callback")
5354
exit(1)
5455
}
5556
guard let layer = self.layer else {
56-
mpv.sendError("Something went wrong, no Video was initialized")
57+
log.sendError("Something went wrong, no Video was initialized")
5758
exit(1)
5859
}
5960
guard let targetScreen = getScreenBy(id: Int(mpv.opts.screen_id)) ?? NSScreen.main else {
60-
mpv.sendError("Something went wrong, no Screen was found")
61+
log.sendError("Something went wrong, no Screen was found")
6162
exit(1)
6263
}
6364

@@ -68,13 +69,13 @@ class MacCommon: Common {
6869
if window == nil {
6970
view = EventsView(frame: wr, common: self)
7071
guard let view = self.view else {
71-
mpv.sendError("Something went wrong, no View was initialized")
72+
log.sendError("Something went wrong, no View was initialized")
7273
exit(1)
7374
}
7475

7576
window = Window(contentRect: wr, screen: targetScreen, view: view, common: self)
7677
guard let window = self.window else {
77-
mpv.sendError("Something went wrong, no Window was initialized")
78+
log.sendError("Something went wrong, no Window was initialized")
7879
exit(1)
7980
}
8081

@@ -83,7 +84,9 @@ class MacCommon: Common {
8384
view.layerContentsPlacement = .scaleProportionallyToFit
8485
//view?.layerContentsRedrawPolicy = .duringViewResize
8586

87+
window.setOnTop(Bool(mpv.opts.ontop), Int(mpv.opts.ontop_level))
8688
window.keepAspect = Bool(mpv.opts.keepaspect_window)
89+
window.title = title
8790
window.border = Bool(mpv.opts.border)
8891

8992
titleBar = TitleBar(frame: wr, window: window, common: self)
@@ -127,7 +130,7 @@ class MacCommon: Common {
127130

128131
//TODO ICC
129132
guard let colorSpace = window?.screen?.colorSpace else {
130-
mpv.sendWarning("Couldn't update ICC Profile, no color space available")
133+
log.sendWarning("Couldn't update ICC Profile, no color space available")
131134
return
132135
}
133136

@@ -218,7 +221,7 @@ class MacCommon: Common {
218221
guard let opts: mp_vo_opts = mpv.opts,
219222
let targetScreen = getScreenBy(id: Int(opts.screen_id)) ?? NSScreen.main else
220223
{
221-
mpv.sendWarning("Couldn't update Window size, no Screen available")
224+
log.sendWarning("Couldn't update Window size, no Screen available")
222225
return
223226
}
224227

@@ -312,7 +315,7 @@ class MacCommon: Common {
312315

313316
func updateICCProfile() {
314317
guard let colorSpace = window?.screen?.colorSpace else {
315-
mpv.sendWarning("Couldn't update ICC Profile, no color space available")
318+
log.sendWarning("Couldn't update ICC Profile, no color space available")
316319
return
317320
}
318321

0 commit comments

Comments
 (0)