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

Aman Gupta ffmpeg at tmm1.net
Thu Sep 28 01:19:20 EEST 2017


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
     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"
+}
 
 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
+
 #define VIDEOTOOLBOX_ESDS_EXTRADATA_PADDING  12
 
 static void videotoolbox_buffer_release(void *opaque, uint8_t *data)
-- 
2.13.5 (Apple Git-94)



More information about the ffmpeg-devel mailing list