* [FFmpeg-devel] [PATCH] avfoundation: Fix version checks
@ 2023-12-15 10:11 Martin Storsjö
2023-12-15 10:35 ` Thilo Borgmann via ffmpeg-devel
2023-12-15 11:07 ` Zhao Zhili
0 siblings, 2 replies; 6+ messages in thread
From: Martin Storsjö @ 2023-12-15 10:11 UTC (permalink / raw)
To: ffmpeg-devel; +Cc: Thilo Borgmann, xufuji456
<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.
---
libavdevice/avfoundation.m | 20 ++++++++++----------
1 file changed, 10 insertions(+), 10 deletions(-)
diff --git a/libavdevice/avfoundation.m b/libavdevice/avfoundation.m
index c1432ec80f..a0ef87edff 100644
--- a/libavdevice/avfoundation.m
+++ b/libavdevice/avfoundation.m
@@ -762,41 +762,41 @@ static int get_audio_config(AVFormatContext *s)
}
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;
if (mediaType == AVMediaTypeVideo) {
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: AVCaptureDeviceTypeBuiltInTelephotoCamera];
#endif
- #if (TARGET_OS_IPHONE && __IPHONE_OS_VERSION_MAX_ALLOWED >= 110100)
+ #if (TARGET_OS_IPHONE && __IPHONE_OS_VERSION_MIN_REQUIRED >= 110100)
[deviceTypes addObject: AVCaptureDeviceTypeBuiltInTrueDepthCamera];
#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: AVCaptureDeviceTypeBuiltInDualWideCamera];
[deviceTypes addObject: AVCaptureDeviceTypeBuiltInUltraWideCamera];
#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];
#endif
- #if (TARGET_OS_IPHONE && __IPHONE_OS_VERSION_MAX_ALLOWED >= 150400)
+ #if (TARGET_OS_IPHONE && __IPHONE_OS_VERSION_MIN_REQUIRED >= 150400)
[deviceTypes addObject: AVCaptureDeviceTypeBuiltInLiDARDepthCamera];
#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];
#endif
} 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]];
#else
deviceTypes = [NSMutableArray arrayWithArray:@[AVCaptureDeviceTypeBuiltInMicrophone]];
#endif
} 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]];
- #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]];
#else
return nil;
--
2.39.3 (Apple Git-145)
_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
To unsubscribe, visit link above, or email
ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [FFmpeg-devel] [PATCH] avfoundation: Fix version checks
2023-12-15 10:11 [FFmpeg-devel] [PATCH] avfoundation: Fix version checks Martin Storsjö
@ 2023-12-15 10:35 ` Thilo Borgmann via ffmpeg-devel
2023-12-15 11:07 ` Zhao Zhili
1 sibling, 0 replies; 6+ messages in thread
From: Thilo Borgmann via ffmpeg-devel @ 2023-12-15 10:35 UTC (permalink / raw)
To: ffmpeg-devel; +Cc: Thilo Borgmann
Am 15.12.23 um 11:11 schrieb Martin Storsjö:
> <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.
> ---
> libavdevice/avfoundation.m | 20 ++++++++++----------
> 1 file changed, 10 insertions(+), 10 deletions(-)
Pushed, thanks!
-Thilo
_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
To unsubscribe, visit link above, or email
ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [FFmpeg-devel] [PATCH] avfoundation: Fix version checks
2023-12-15 10:11 [FFmpeg-devel] [PATCH] avfoundation: Fix version checks Martin Storsjö
2023-12-15 10:35 ` Thilo Borgmann via ffmpeg-devel
@ 2023-12-15 11:07 ` Zhao Zhili
2023-12-15 11:32 ` Martin Storsjö via ffmpeg-devel
1 sibling, 1 reply; 6+ messages in thread
From: Zhao Zhili @ 2023-12-15 11:07 UTC (permalink / raw)
To: FFmpeg development discussions and patches; +Cc: Marvin Scholz
> On Dec 15, 2023, at 18:11, Martin Storsjö <martin@martin.st> wrote:
>
> <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.
> ^
I think we need some utils for version check on Apple’s multiple target OS. It’s hard
to get it right and very lengthy to write. Ping Marvin since he is expert on this
subject.
And can we setup a group of CI for these platforms?
_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
To unsubscribe, visit link above, or email
ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [FFmpeg-devel] [PATCH] avfoundation: Fix version checks
2023-12-15 11:07 ` Zhao Zhili
@ 2023-12-15 11:32 ` Martin Storsjö via ffmpeg-devel
2023-12-15 11:41 ` Thilo Borgmann via ffmpeg-devel
0 siblings, 1 reply; 6+ messages in thread
From: Martin Storsjö via ffmpeg-devel @ 2023-12-15 11:32 UTC (permalink / raw)
To: FFmpeg development discussions and patches
Cc: Martin Storsjö, Marvin Scholz
On Fri, 15 Dec 2023, Zhao Zhili wrote:
>
>> On Dec 15, 2023, at 18:11, Martin Storsjö <martin@martin.st> wrote:
>>
>> <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.
>> ^
>
> I think we need some utils for version check on Apple’s multiple target OS. It’s hard
> to get it right and very lengthy to write. Ping Marvin since he is expert on this
> subject.
>
> And can we setup a group of CI for these platforms?
That would be good.
We do have a mac mini running fate tests; it would probably be good to add
test configurations that build for both macOS and iOS, for both whatever
the latest version in the installed SDK is, and with an old deployment
target (those builds often get broken).
(And then, someone would need to check the FATE status as well.)
// Martin
_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
To unsubscribe, visit link above, or email
ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [FFmpeg-devel] [PATCH] avfoundation: Fix version checks
2023-12-15 11:32 ` Martin Storsjö via ffmpeg-devel
@ 2023-12-15 11:41 ` Thilo Borgmann via ffmpeg-devel
2023-12-15 11:57 ` Zhao Zhili
0 siblings, 1 reply; 6+ messages in thread
From: Thilo Borgmann via ffmpeg-devel @ 2023-12-15 11:41 UTC (permalink / raw)
To: ffmpeg-devel; +Cc: Thilo Borgmann
Am 15.12.23 um 12:32 schrieb Martin Storsjö via ffmpeg-devel:
> On Fri, 15 Dec 2023, Zhao Zhili wrote:
>
>>
>>> On Dec 15, 2023, at 18:11, Martin Storsjö <martin@martin.st> wrote:
>>>
>>> <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.
>>> ^
>>
>> I think we need some utils for version check on Apple’s multiple target OS. It’s hard
>> to get it right and very lengthy to write. Ping Marvin since he is expert on this
>> subject.
>>
>> And can we setup a group of CI for these platforms?
>
> That would be good.
>
> We do have a mac mini running fate tests; it would probably be good to add test configurations that build for both macOS and iOS, for both whatever the latest version in the installed SDK is, and with an old deployment target (those builds often get broken).
>
> (And then, someone would need to check the FATE status as well.)
That would be great!
Fate on the M1 discovered the other bug about the availability macro in audiotoolbox only because it used the 11.3 SDK on a 12.0 OS.
Marvin knows this OS specific stuff way better than me, it would be great if he wanted to set it up more sophisticated :)
-Thilo
_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
To unsubscribe, visit link above, or email
ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [FFmpeg-devel] [PATCH] avfoundation: Fix version checks
2023-12-15 11:41 ` Thilo Borgmann via ffmpeg-devel
@ 2023-12-15 11:57 ` Zhao Zhili
0 siblings, 0 replies; 6+ messages in thread
From: Zhao Zhili @ 2023-12-15 11:57 UTC (permalink / raw)
To: FFmpeg development discussions and patches
> On Dec 15, 2023, at 19:41, Thilo Borgmann via ffmpeg-devel <ffmpeg-devel@ffmpeg.org> wrote:
>
> Am 15.12.23 um 12:32 schrieb Martin Storsjö via ffmpeg-devel:
>> On Fri, 15 Dec 2023, Zhao Zhili wrote:
>>>
>>>> On Dec 15, 2023, at 18:11, Martin Storsjö <martin@martin.st> wrote:
>>>>
>>>> <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.
>>>> ^
>>>
>>> I think we need some utils for version check on Apple’s multiple target OS. It’s hard
>>> to get it right and very lengthy to write. Ping Marvin since he is expert on this
>>> subject.
>>>
>>> And can we setup a group of CI for these platforms?
>> That would be good.
>> We do have a mac mini running fate tests; it would probably be good to add test configurations that build for both macOS and iOS, for both whatever the latest version in the installed SDK is, and with an old deployment target (those builds often get broken).
>> (And then, someone would need to check the FATE status as well.)
>
> That would be great!
> Fate on the M1 discovered the other bug about the availability macro in audiotoolbox only because it used the 11.3 SDK on a 12.0 OS.
>
> Marvin knows this OS specific stuff way better than me, it would be great if he wanted to set it up more sophisticated :)
Two other similar bugs:
https://trac.ffmpeg.org/ticket/10690
https://trac.ffmpeg.org/ticket/10695
It’s easy to workaround by !TARGET_OS_IPHONE, but I want to enable it for as many platforms as possible.
I haven’t got the time to read Marvin’s article and figure out how to do it properly yet.
>
> -Thilo
>
> _______________________________________________
> ffmpeg-devel mailing list
> ffmpeg-devel@ffmpeg.org
> https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
>
> To unsubscribe, visit link above, or email
> ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".
_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
To unsubscribe, visit link above, or email
ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2023-12-15 11:57 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-12-15 10:11 [FFmpeg-devel] [PATCH] avfoundation: Fix version checks Martin Storsjö
2023-12-15 10:35 ` Thilo Borgmann via ffmpeg-devel
2023-12-15 11:07 ` Zhao Zhili
2023-12-15 11:32 ` Martin Storsjö via ffmpeg-devel
2023-12-15 11:41 ` Thilo Borgmann via ffmpeg-devel
2023-12-15 11:57 ` Zhao Zhili
Git Inbox Mirror of the ffmpeg-devel mailing list - see https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
This inbox may be cloned and mirrored by anyone:
git clone --mirror https://master.gitmailbox.com/ffmpegdev/0 ffmpegdev/git/0.git
# If you have public-inbox 1.1+ installed, you may
# initialize and index your mirror using the following commands:
public-inbox-init -V2 ffmpegdev ffmpegdev/ https://master.gitmailbox.com/ffmpegdev \
ffmpegdev@gitmailbox.com
public-inbox-index ffmpegdev
Example config snippet for mirrors.
AGPL code for this site: git clone https://public-inbox.org/public-inbox.git