From 69bab4e74f2b210bf95fd1867a382a2773940197 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20Storsj=C3=B6?= Date: Tue, 25 Mar 2025 19:27:39 +0200 Subject: [PATCH] avfoundation: Fix compilation for OSes other than macOS and iOS MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit E.g. tvOS doesn't have devicesWithMediaType. In principle, we could probably disable building the whole input device on such OSes, but that would either require testing explicitly for the OS type in configure (which we don't do anywhere so far), or test for individual objective C methods. This approach allows the code to compile, but no input devices will be found at runtime. Signed-off-by: Martin Storsjö --- libavdevice/avfoundation.m | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/libavdevice/avfoundation.m b/libavdevice/avfoundation.m index 61dac4b713..6f15e2837e 100644 --- a/libavdevice/avfoundation.m +++ b/libavdevice/avfoundation.m @@ -814,8 +814,10 @@ static NSArray* getDevicesWithMediaType(AVMediaType mediaType) { mediaType:mediaType position:AVCaptureDevicePositionUnspecified]; return [captureDeviceDiscoverySession devices]; -#else +#elif TARGET_OS_OSX return [AVCaptureDevice devicesWithMediaType:mediaType]; +#else + return nil; #endif }