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

Marvin Scholz epirat07 at gmail.com
Sun Nov 14 02:38:24 EET 2021


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?

Additionally a more reliable/correct way for the SDK preprocessor check 
would be:

#if (!TARGET_OS_IPHONE && MAC_OS_X_VERSION_MAX_ALLOWED >= 110000)

>      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
> https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
>
> To unsubscribe, visit link above, or email
> ffmpeg-devel-request at ffmpeg.org with subject "unsubscribe".


More information about the ffmpeg-devel mailing list