mpv: fix build on Darwin (patch by marsam)

This commit is contained in:
Anderson Torres 2024-06-08 13:32:43 -03:00
parent c14b678b5a
commit 6ee4b2de1a
2 changed files with 35 additions and 2 deletions

View File

@ -0,0 +1,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;

View File

@ -88,7 +88,7 @@
pulseSupport ? config.pulseaudio or stdenv.isLinux,
rubberbandSupport ? true,
screenSaverSupport ? true,
sdl2Support ? true,
sdl2Support ? !stdenv.isDarwin,
sixelSupport ? false,
speexSupport ? true,
swiftSupport ? stdenv.isDarwin,
@ -152,6 +152,11 @@ stdenv'.mkDerivation (finalAttrs: {
hash = "sha256-dFajnCpGlNqUv33A8eFEn8kjtzIPkcBY5j0gNVlaiIY=";
};
patches = [
# Fix build with Darwin SDK 11
./0001-fix-darwin-build.patch
];
postPatch = lib.concatStringsSep "\n" [
# Don't reference compile time dependencies or create a build outputs cycle
# between out and dev
@ -355,7 +360,6 @@ stdenv'.mkDerivation (finalAttrs: {
mpv is a free and open-source general-purpose video player, based on the
MPlayer and mplayer2 projects, with great improvements above both.
'';
broken = stdenv.isDarwin; # Yet another SDK incompatibility...
changelog = "https://github.com/mpv-player/mpv/releases/tag/v${finalAttrs.version}";
license = lib.licenses.gpl2Plus;
mainProgram = "mpv";