[FFmpeg-devel] [PATCH v2 2/2] avcodec/videotoolbox: fix hevc hwaccel build on older macOS

James Almer jamrial at gmail.com
Thu Sep 28 01:52:13 EEST 2017


On 9/27/2017 7:19 PM, Aman Gupta wrote:
> From: Aman Gupta <aman at tmm1.net>
> 
> ---
>  configure                 | 5 ++++-
>  libavcodec/videotoolbox.c | 4 ++++
>  2 files changed, 8 insertions(+), 1 deletion(-)
> 
> diff --git a/configure b/configure
> index d353e9d824..aae23bf38f 100755
> --- a/configure
> +++ b/configure
> @@ -2073,6 +2073,7 @@ TOOLCHAIN_FEATURES="
>  
>  TYPES_LIST="
>      CONDITION_VARIABLE_Ptr
> +    kCMVideoCodecType_HEVC

Remove this line and read below.

>      socklen_t
>      struct_addrinfo
>      struct_group_source_req
> @@ -5809,8 +5810,10 @@ enabled avfoundation && {
>      check_lib avfoundation CoreGraphics/CoreGraphics.h               CGGetActiveDisplayList "-framework CoreGraphics" ||
>      check_lib avfoundation ApplicationServices/ApplicationServices.h CGGetActiveDisplayList "-framework ApplicationServices"; }
>  
> -enabled videotoolbox &&
> +enabled videotoolbox && {
>      check_lib coreservices CoreServices/CoreServices.h UTGetOSTypeFromString "-framework CoreServices"
> +    check_func_headers CoreMedia/CMFormatDescription.h kCMVideoCodecType_HEVC "-framework CoreMedia"

Look how DXVA_PicParams_HEVC is checked and try to do the same instead.

> +}
>  
>  check_struct "sys/time.h sys/resource.h" "struct rusage" ru_maxrss
>  
> diff --git a/libavcodec/videotoolbox.c b/libavcodec/videotoolbox.c
> index c96200cbdb..e62452c078 100644
> --- a/libavcodec/videotoolbox.c
> +++ b/libavcodec/videotoolbox.c
> @@ -40,6 +40,10 @@
>  #  define kVTVideoDecoderSpecification_RequireHardwareAcceleratedVideoDecoder CFSTR("RequireHardwareAcceleratedVideoDecoder")
>  #endif
>  
> +#if !HAVE_KCMVIDEOCODECTYPE_HEVC
> +enum { kCMVideoCodecType_HEVC = 'hvc1' };
> +#endif

The correct thing to do is adding kCMVideoCodecType_HEVC to
hevc_videotoolbox_hwaccel_deps in configure, and not forcing it on SDKs
that don't support it since, i assume, no computer with MacOS 10.8 will
be able to play hevc videos anyway.

> +
>  #define VIDEOTOOLBOX_ESDS_EXTRADATA_PADDING  12
>  
>  static void videotoolbox_buffer_release(void *opaque, uint8_t *data)
> 



More information about the ffmpeg-devel mailing list