about summary refs log tree commit diff
path: root/pkgs/applications/video/mpv/0001-fix-darwin-build.patch
blob: c7e486a3c5d143b41523d59b0ec820bb2493fd20 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
--- a/osdep/mac/input_helper.swift
+++ b/osdep/mac/input_helper.swift
@@ -18,6 +18,14 @@
 import Cocoa
 import Carbon.HIToolbox
 
+extension NSCondition {
+    fileprivate func withLock<T>(_ body: () throws -> T) rethrows -> T {
+        self.lock()
+        defer { self.unlock() }
+        return try body()
+    }
+}
+
 class InputHelper: NSObject {
     var option: OptionHelper?
     var lock = NSCondition()
--- a/audio/out/ao_avfoundation.m
+++ b/audio/out/ao_avfoundation.m
@@ -312,7 +312,8 @@

+    #if __MAC_OS_X_VERSION_MAX_ALLOWED >= 120000
     p->observer = [[AVObserver alloc] initWithAO:ao];
     NSNotificationCenter *center = [NSNotificationCenter defaultCenter];
     [center addObserver:p->observer selector:@selector(handleRestartNotification:) name:AVSampleBufferAudioRendererOutputConfigurationDidChangeNotification object:p->renderer];
     [center addObserver:p->observer selector:@selector(handleRestartNotification:) name:AVSampleBufferAudioRendererWasFlushedAutomaticallyNotification object:p->renderer];
-
+    #endif
     return CONTROL_OK;