From 5c5896e2254ae5df9ed98b86590b7b453640bf18 Mon Sep 17 00:00:00 2001 From: Andrey Filipenkov Date: Sat, 27 Nov 2021 16:06:55 +0300 Subject: [PATCH] fix building with VideoToolbox when deployment target is less than 11 --- scripts/apple/ffmpeg.sh | 7 +++++++ scripts/function-ios.sh | 5 ----- scripts/function.sh | 2 +- 3 files changed, 8 insertions(+), 6 deletions(-) diff --git a/scripts/apple/ffmpeg.sh b/scripts/apple/ffmpeg.sh index 0287335..7e57b3a 100755 --- a/scripts/apple/ffmpeg.sh +++ b/scripts/apple/ffmpeg.sh @@ -444,6 +444,13 @@ ${SED_INLINE} 's/static int av_log_level/__thread int av_log_level/g' "${BASEDIR FFMPEG_VERSION="v$(get_user_friendly_ffmpeg_version)" ${SED_INLINE} "s/\$version/$FFMPEG_VERSION/g" "${BASEDIR}"/src/"${LIB_NAME}"/ffbuild/version.sh 1>>"${BASEDIR}"/build.log 2>&1 || exit 1 +# 5. Add iOS/tvOS availability checks for videotoolbox +${SED_INLINE} -E \ + -e 's/__builtin_available\(macOS 10\.11, \*\)/__builtin_available(macOS 10.11, iOS 9.0, tvOS 9.0, *)/g' \ + -e 's/__builtin_available\(macOS 10\.12, \*\)/__builtin_available(macOS 10.12, iOS 10.0, tvOS 10.0, *)/g' \ + -e 's/__builtin_available\(macOS 10\.13, \*\)/__builtin_available(macOS 10.13, iOS 11.0, tvOS 11.0, *)/g' \ + "${BASEDIR}"/src/${LIB_NAME}/libavutil/hwcontext_videotoolbox.c 1>>"${BASEDIR}"/build.log 2>&1 || exit 1 + ################################################################### ./configure \ diff --git a/scripts/function-ios.sh b/scripts/function-ios.sh index d7b8d35..f1c7664 100755 --- a/scripts/function-ios.sh +++ b/scripts/function-ios.sh @@ -71,11 +71,6 @@ enable_lts_build() { # MAC CATALYST IS INTRODUCED IN 13.0 export MAC_CATALYST_MIN_VERSION=13.0 - - # IOS SDK 9.3 SUPPORTS VIDEOTOOLBOX - # HOWEVER, THE LATEST FFMPEG VERSION USES SDK 11.0 APIS - # THEREFORE, VIDEOTOOLBOX IS DISABLED IN LTS RELEASES - ENABLED_LIBRARIES[LIBRARY_VIDEOTOOLBOX]=0 } get_common_includes() { diff --git a/scripts/function.sh b/scripts/function.sh index 85b23c4..b75f838 100755 --- a/scripts/function.sh +++ b/scripts/function.sh @@ -267,7 +267,7 @@ is_library_supported_on_platform() { # ONLY IOS, MACOS AND TVOS MAIN 52) - if [[ ${FFMPEG_KIT_BUILD_TYPE} == "ios" ]] && [[ $1 == "ios-videotoolbox" ]] && [[ -z ${FFMPEG_KIT_LTS_BUILD} ]]; then + if [[ ${FFMPEG_KIT_BUILD_TYPE} == "ios" ]] && [[ $1 == "ios-videotoolbox" ]]; then echo "0" elif [[ ${FFMPEG_KIT_BUILD_TYPE} == "macos" ]] && [[ $1 == "macos-videotoolbox" ]]; then echo "0"