[FFmpeg-devel] [PATCH] videotoolbox: Add SDK ifdefs for use of kVTVideoDecoderReferenceMissingErr
Martin Storsjö
martin at martin.st
Tue Mar 25 12:46:24 EET 2025
On Tue, 25 Mar 2025, Zhao Zhili wrote:
>
>> 在 2025年3月25日,下午6:01,Martin Storsjö <martin at martin.st> 写道:
>>
>> This error constant was only added in the macOS 12 and iOS 15
>> SDKs.
>>
>> If building with an older SDK, assume that the error doesn't
>> match this constant.
>>
>> This fixes build errors with older SDKs after
>> c6214b0d691566c7cb0f2ff5be08a24c3534e5bb.
>>
>> As this constant is declared unconditionally (without any target
>> version guards) in the headers, one can't reproduce this issue
>> while building with a newer SDK and targeting an older version
>> with -mmacosx-version-min=.
>>
>> Technically, checking just one of MAC_OS_VERSION_12_0 and
>> __IPHONE_15_0 is enough; the macOS SDKs and iOS SDKs share these
>> files, so files from a similar point in time do have the same
>> defines. Therefore, we don't really need to expand this with
>> checks for tvOS, watchOS and other OS variants.
>> ---
>> libavcodec/videotoolbox.c | 5 +++++
>> 1 file changed, 5 insertions(+)
>>
>> diff --git a/libavcodec/videotoolbox.c b/libavcodec/videotoolbox.c
>> index aaa6129576..7f7b910b26 100644
>> --- a/libavcodec/videotoolbox.c
>> +++ b/libavcodec/videotoolbox.c
>> @@ -728,8 +728,13 @@ static void videotoolbox_decoder_callback(void *opaque,
>> }
>>
>> if (!image_buffer) {
>> +#if defined(MAC_OS_VERSION_12_0) || defined(__IPHONE_15_0)
>> + // kVTVideoDecoderReferenceMissingErr was defined in the macOS 12/iOS 15 SDK
>> if (status != kVTVideoDecoderReferenceMissingErr)
>> vtctx->reconfig_needed = true;
>> +#else
>> + vtctx->reconfig_needed = true;
>> +#endif
>
> I used its numeric value initially, but after checking the doc,
>
> kVTVideoDecoderReferenceMissingErr
> iOS 6.0+
> iPadOS 6.0+
> Mac Catalyst 13.0+
> macOS 10.8+
> tvOS 10.2+
> visionOS 1.0+
>
> I replaced it with the enum.
>
> Now I wondering what does this macOS 10.8 mean.
>
> Anyway, can we use the numeric value here?
Can you link to which docs declare this to be available since macOS 10.8?
Anyway, I'm ok wth just using a numeric value instead, but then we should
probably add a comment saying what the value refers to, and that it is
only available since macOS 12 SDKs.
// Martin
More information about the ffmpeg-devel
mailing list