mirror of https://git.ffmpeg.org/ffmpeg.git
avfoundation: Fix version checks
<OS>_VERSION_MAX_ALLOWED indicates what version is available in the SDK, while <OS>_VERSION_MIN_REQUIRED is the version we can assume is available, i.e. similar to what is set with e.g. -miphoneos-version-min on the command line. This fixes build errors like these: src/libavdevice/avfoundation.m:788:37: error: 'AVCaptureDeviceTypeContinuityCamera' is only available on macOS 14.0 or newer [-Werror,-Wunguarded-availability-new] [deviceTypes addObject: AVCaptureDeviceTypeContinuityCamera]; ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/System/Library/Frameworks/AVFoundation.framework/Headers/AVCaptureDevice.h:551:38: note: 'AVCaptureDeviceTypeContinuityCamera' has been marked as being introduced in macOS 14.0 here, but the deployment target is macOS 13.0.0 AVF_EXPORT AVCaptureDeviceType const AVCaptureDeviceTypeContinuityCamera API_AVAILABLE(macos(14.0), ios(17.0), macCatalyst(17.0), tvos(17.0)) API_UNAVAILABLE(visionos) API_UNAVAILABLE(watchos); ^ Alternatively, we could use these more modern APIs, if enclosed in suitable @available() checks.
This commit is contained in:
parent
ce0c178a40
commit
081d69b78d
|
@ -762,41 +762,41 @@ static int get_audio_config(AVFormatContext *s)
|
||||||
}
|
}
|
||||||
|
|
||||||
static NSArray* getDevicesWithMediaType(AVMediaType mediaType) {
|
static NSArray* getDevicesWithMediaType(AVMediaType mediaType) {
|
||||||
#if ((TARGET_OS_IPHONE && __IPHONE_OS_VERSION_MAX_ALLOWED >= 100000) || (TARGET_OS_OSX && __MAC_OS_X_VERSION_MAX_ALLOWED >= 101500))
|
#if ((TARGET_OS_IPHONE && __IPHONE_OS_VERSION_MIN_REQUIRED >= 100000) || (TARGET_OS_OSX && __MAC_OS_X_VERSION_MIN_REQUIRED >= 101500))
|
||||||
NSMutableArray *deviceTypes = nil;
|
NSMutableArray *deviceTypes = nil;
|
||||||
if (mediaType == AVMediaTypeVideo) {
|
if (mediaType == AVMediaTypeVideo) {
|
||||||
deviceTypes = [NSMutableArray arrayWithArray:@[AVCaptureDeviceTypeBuiltInWideAngleCamera]];
|
deviceTypes = [NSMutableArray arrayWithArray:@[AVCaptureDeviceTypeBuiltInWideAngleCamera]];
|
||||||
#if (TARGET_OS_IPHONE && __IPHONE_OS_VERSION_MAX_ALLOWED >= 100000)
|
#if (TARGET_OS_IPHONE && __IPHONE_OS_VERSION_MIN_REQUIRED >= 100000)
|
||||||
[deviceTypes addObject: AVCaptureDeviceTypeBuiltInDualCamera];
|
[deviceTypes addObject: AVCaptureDeviceTypeBuiltInDualCamera];
|
||||||
[deviceTypes addObject: AVCaptureDeviceTypeBuiltInTelephotoCamera];
|
[deviceTypes addObject: AVCaptureDeviceTypeBuiltInTelephotoCamera];
|
||||||
#endif
|
#endif
|
||||||
#if (TARGET_OS_IPHONE && __IPHONE_OS_VERSION_MAX_ALLOWED >= 110100)
|
#if (TARGET_OS_IPHONE && __IPHONE_OS_VERSION_MIN_REQUIRED >= 110100)
|
||||||
[deviceTypes addObject: AVCaptureDeviceTypeBuiltInTrueDepthCamera];
|
[deviceTypes addObject: AVCaptureDeviceTypeBuiltInTrueDepthCamera];
|
||||||
#endif
|
#endif
|
||||||
#if (TARGET_OS_IPHONE && __IPHONE_OS_VERSION_MAX_ALLOWED >= 130000)
|
#if (TARGET_OS_IPHONE && __IPHONE_OS_VERSION_MIN_REQUIRED >= 130000)
|
||||||
[deviceTypes addObject: AVCaptureDeviceTypeBuiltInTripleCamera];
|
[deviceTypes addObject: AVCaptureDeviceTypeBuiltInTripleCamera];
|
||||||
[deviceTypes addObject: AVCaptureDeviceTypeBuiltInDualWideCamera];
|
[deviceTypes addObject: AVCaptureDeviceTypeBuiltInDualWideCamera];
|
||||||
[deviceTypes addObject: AVCaptureDeviceTypeBuiltInUltraWideCamera];
|
[deviceTypes addObject: AVCaptureDeviceTypeBuiltInUltraWideCamera];
|
||||||
#endif
|
#endif
|
||||||
#if (TARGET_OS_OSX && __MAC_OS_X_VERSION_MAX_ALLOWED >= 130000)
|
#if (TARGET_OS_OSX && __MAC_OS_X_VERSION_MIN_REQUIRED >= 130000)
|
||||||
[deviceTypes addObject: AVCaptureDeviceTypeDeskViewCamera];
|
[deviceTypes addObject: AVCaptureDeviceTypeDeskViewCamera];
|
||||||
#endif
|
#endif
|
||||||
#if (TARGET_OS_IPHONE && __IPHONE_OS_VERSION_MAX_ALLOWED >= 150400)
|
#if (TARGET_OS_IPHONE && __IPHONE_OS_VERSION_MIN_REQUIRED >= 150400)
|
||||||
[deviceTypes addObject: AVCaptureDeviceTypeBuiltInLiDARDepthCamera];
|
[deviceTypes addObject: AVCaptureDeviceTypeBuiltInLiDARDepthCamera];
|
||||||
#endif
|
#endif
|
||||||
#if (TARGET_OS_IPHONE && __IPHONE_OS_VERSION_MAX_ALLOWED >= 170000 || (TARGET_OS_OSX && __MAC_OS_X_VERSION_MAX_ALLOWED >= 140000))
|
#if (TARGET_OS_IPHONE && __IPHONE_OS_VERSION_MIN_REQUIRED >= 170000 || (TARGET_OS_OSX && __MAC_OS_X_VERSION_MIN_REQUIRED >= 140000))
|
||||||
[deviceTypes addObject: AVCaptureDeviceTypeContinuityCamera];
|
[deviceTypes addObject: AVCaptureDeviceTypeContinuityCamera];
|
||||||
#endif
|
#endif
|
||||||
} else if (mediaType == AVMediaTypeAudio) {
|
} else if (mediaType == AVMediaTypeAudio) {
|
||||||
#if (TARGET_OS_IPHONE && __IPHONE_OS_VERSION_MAX_ALLOWED >= 170000 || (TARGET_OS_OSX && __MAC_OS_X_VERSION_MAX_ALLOWED >= 140000))
|
#if (TARGET_OS_IPHONE && __IPHONE_OS_VERSION_MIN_REQUIRED >= 170000 || (TARGET_OS_OSX && __MAC_OS_X_VERSION_MIN_REQUIRED >= 140000))
|
||||||
deviceTypes = [NSMutableArray arrayWithArray:@[AVCaptureDeviceTypeMicrophone]];
|
deviceTypes = [NSMutableArray arrayWithArray:@[AVCaptureDeviceTypeMicrophone]];
|
||||||
#else
|
#else
|
||||||
deviceTypes = [NSMutableArray arrayWithArray:@[AVCaptureDeviceTypeBuiltInMicrophone]];
|
deviceTypes = [NSMutableArray arrayWithArray:@[AVCaptureDeviceTypeBuiltInMicrophone]];
|
||||||
#endif
|
#endif
|
||||||
} else if (mediaType == AVMediaTypeMuxed) {
|
} else if (mediaType == AVMediaTypeMuxed) {
|
||||||
#if (TARGET_OS_IPHONE && __IPHONE_OS_VERSION_MAX_ALLOWED >= 170000 || (TARGET_OS_OSX && __MAC_OS_X_VERSION_MAX_ALLOWED >= 140000))
|
#if (TARGET_OS_IPHONE && __IPHONE_OS_VERSION_MIN_REQUIRED >= 170000 || (TARGET_OS_OSX && __MAC_OS_X_VERSION_MIN_REQUIRED >= 140000))
|
||||||
deviceTypes = [NSMutableArray arrayWithArray:@[AVCaptureDeviceTypeExternal]];
|
deviceTypes = [NSMutableArray arrayWithArray:@[AVCaptureDeviceTypeExternal]];
|
||||||
#elif (TARGET_OS_OSX && __MAC_OS_X_VERSION_MAX_ALLOWED < 140000)
|
#elif (TARGET_OS_OSX && __MAC_OS_X_VERSION_MIN_REQUIRED < 140000)
|
||||||
deviceTypes = [NSMutableArray arrayWithArray:@[AVCaptureDeviceTypeExternalUnknown]];
|
deviceTypes = [NSMutableArray arrayWithArray:@[AVCaptureDeviceTypeExternalUnknown]];
|
||||||
#else
|
#else
|
||||||
return nil;
|
return nil;
|
||||||
|
|
Loading…
Reference in New Issue