[FFmpeg-devel] [PATCH 11/15] lavc/videotoolbox: call VTRegisterSupplementalVideoDecoderIfAvailable

Ridley Combs rcombs at rcombs.me
Sun Nov 14 04:40:43 EET 2021



> On Nov 13, 2021, at 18:38, Marvin Scholz <epirat07 at gmail.com> wrote:
> 
> On 13 Nov 2021, at 22:09, rcombs wrote:
> 
>> This is required for VP9 to work.
>> ---
>> libavcodec/videotoolbox.c | 7 +++++++
>> 1 file changed, 7 insertions(+)
>> 
>> diff --git a/libavcodec/videotoolbox.c b/libavcodec/videotoolbox.c
>> index 18cc589d2a..0666446dbd 100644
>> --- a/libavcodec/videotoolbox.c
>> +++ b/libavcodec/videotoolbox.c
>> @@ -32,6 +32,7 @@
>> #include "h264dec.h"
>> #include "hevcdec.h"
>> #include "mpegvideo.h"
>> +#include <Availability.h>
>> #include <TargetConditionals.h>
>> 
>> #ifndef kVTVideoDecoderSpecification_RequireHardwareAcceleratedVideoDecoder
>> @@ -864,6 +865,12 @@ static int videotoolbox_start(AVCodecContext *avctx)
>>         break;
>>     }
>> 
>> +#ifdef __MAC_10_11
>> +    if (__builtin_available(macOS 10.11, *)) {
>> +        VTRegisterSupplementalVideoDecoderIfAvailable(videotoolbox->cm_codec_type);
>> +    }
>> +#endif
>> +
> 
> The VTRegisterSupplementalVideoDecoderIfAvailable is available since macOS 11 according to the
> header annotations:
> 
> VT_EXPORT void VTRegisterSupplementalVideoDecoderIfAvailable( CMVideoCodecType codecType ) API_AVAILABLE(macosx(11.0)) API_UNAVAILABLE(ios, watchos, tvos);
> 
> I guess you meant to check for macOS 11 here but accidentally used 10.11?

Ah, good catch! Fixed.

> 
> Additionally a more reliable/correct way for the SDK preprocessor check would be:
> 
> #if (!TARGET_OS_IPHONE && MAC_OS_X_VERSION_MAX_ALLOWED >= 110000)

How's this, using AvailabilityMacros.h?

#if defined(MAC_OS_VERSION_11_0) && !TARGET_OS_IPHONE && (MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_VERSION_11_0)

(And same for the 10.9 check)

> 
>>     decoder_spec = videotoolbox_decoder_config_create(videotoolbox->cm_codec_type, avctx);
>> 
>>     if (!decoder_spec) {
>> -- 
>> 2.33.1
>> 
>> _______________________________________________
>> ffmpeg-devel mailing list
>> ffmpeg-devel at ffmpeg.org <mailto:ffmpeg-devel at ffmpeg.org>
>> https://ffmpeg.org/mailman/listinfo/ffmpeg-devel <https://ffmpeg.org/mailman/listinfo/ffmpeg-devel>
>> 
>> To unsubscribe, visit link above, or email
>> ffmpeg-devel-request at ffmpeg.org <mailto:ffmpeg-devel-request at ffmpeg.org> with subject "unsubscribe".
> _______________________________________________
> ffmpeg-devel mailing list
> ffmpeg-devel at ffmpeg.org <mailto:ffmpeg-devel at ffmpeg.org>
> https://ffmpeg.org/mailman/listinfo/ffmpeg-devel <https://ffmpeg.org/mailman/listinfo/ffmpeg-devel>
> 
> To unsubscribe, visit link above, or email
> ffmpeg-devel-request at ffmpeg.org <mailto:ffmpeg-devel-request at ffmpeg.org> with subject "unsubscribe".



More information about the ffmpeg-devel mailing list