[FFmpeg-cvslog] avfoundation: Fix compilation for OSes other than macOS and iOS

Martin Storsjö git at videolan.org
Fri Apr 4 17:16:43 EEST 2025


ffmpeg | branch: master | Martin Storsjö <martin at martin.st> | Tue Mar 25 19:27:39 2025 +0200| [69bab4e74f2b210bf95fd1867a382a2773940197] | committer: Martin Storsjö

avfoundation: Fix compilation for OSes other than macOS and iOS

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ö <martin at martin.st>

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=69bab4e74f2b210bf95fd1867a382a2773940197
---

 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
 }
 



More information about the ffmpeg-cvslog mailing list