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

Hendrik Leppkes h.leppkes at gmail.com
Sun Nov 14 10:41:59 EET 2021


On Sun, Nov 14, 2021 at 3:40 AM Ridley Combs <rcombs at rcombs.me> wrote:
>
>
>
> > 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)
>

MAX_ALLOWED seems like the wrong variable to use for me. Shouldn't
this be MAC_OS_X_VERSION_MIN_REQUIRED (or, both), so that I can still
target 10.15 or whatever with -mmacosx-version-min=10.15 without
linking in unavailable functions?

- Hendrik


More information about the ffmpeg-devel mailing list