[FFmpeg-devel] [PATCH] libavdevice: fix compilation for Mac OS X 10.7-10.12, iOS < 11
Erik Bråthen Solem
erikbsolem at hotmail.com
Wed Aug 21 01:43:14 EEST 2024
avfoundation.m uses constants prefixed with AVMediaType on Mac OS X > 10.6.
In 10.7 through 10.12 their type was NSString*, but starting with 10.13 a
new AVMediaType struct type was introduced. In avfoundation.m, the function
getDevicesWithMediaType takes this struct as parameter, which breaks support
for Mac OS X 10.7 through 10.12. By typedef-ing AVMediaType to NSString* for
these versions, the code compiles. Prior to 10.15 the value is passed to a
function that takes AVMediaType on 10.13+ and NSString* on <= 10.12. The
same API change was introduced in iOS starting with iOS 11.
Signed-off-by: Erik Bråthen Solem <erikbsolem at hotmail.com>
---
libavdevice/avfoundation.m | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/libavdevice/avfoundation.m b/libavdevice/avfoundation.m
index c5a09c6563..779bc767d6 100644
--- a/libavdevice/avfoundation.m
+++ b/libavdevice/avfoundation.m
@@ -763,6 +763,10 @@ static int get_audio_config(AVFormatContext *s)
return 0;
}
+#if ((TARGET_OS_IPHONE && __IPHONE_OS_VERSION_MIN_REQUIRED < 110000) || (TARGET_OS_OSX && __MAC_OS_X_VERSION_MIN_REQUIRED < 101300))
+typedef NSString* AVMediaType;
+#endif
+
static NSArray* getDevicesWithMediaType(AVMediaType mediaType) {
#if ((TARGET_OS_IPHONE && __IPHONE_OS_VERSION_MIN_REQUIRED >= 100000) || (TARGET_OS_OSX && __MAC_OS_X_VERSION_MIN_REQUIRED >= 101500))
NSMutableArray *deviceTypes = nil;
--
2.46.0
More information about the ffmpeg-devel
mailing list