diff --git a/.github/ISSUE_TEMPLATE/bug_report.md b/.github/ISSUE_TEMPLATE/bug_report.md index 1648054..837f9c2 100644 --- a/.github/ISSUE_TEMPLATE/bug_report.md +++ b/.github/ISSUE_TEMPLATE/bug_report.md @@ -23,20 +23,20 @@ Steps to reproduce the behaviour. If applicable, add screenshots to help explain your problem. **Logs** -Post logs here or paste them to [Ghostbin](https://ghostbin.co) and insert the link here. +Post logs here or paste them to [Ghostbin](https://ghostbin.site) and insert the link here. **Environment** - Platform: `Android`/`Flutter`/`iOS`/`Linux`/`macOS`/`ReactNative`/`tvOS` - Architecture: `arm-v7a`, `arm-v7a-neon`, `arm64-v8a`, `x86`, `x86_64`, `armv7`, `armv7s`, `arm64`, `arm64-mac-catalyst`, `arm64-simulator`, `arm64e`, `i386`, `x86-64`, `x86-64-mac-catalyst` -- Version: `v5.1`/`v5.1.LTS` -- Source branch: `main`, `development` -- Xcode version: `13.4.1` -- Cocoapods version: `1.10.3` -- Android Studio version: `4.0` -- Android NDK version: `r25b` -- flutter doctor: ` ` -- react-native info: ` ` +- Version: `` +- Source branch: `` +- Xcode version: `` +- Cocoapods version: `` +- Android Studio version: `` +- Android NDK version: `` +- flutter doctor: `` +- react-native info: `` **Other** Add any other context about the problem here. diff --git a/.github/workflows/android-build-scripts.yml b/.github/workflows/android-build-scripts.yml index 6b6367f..31cf948 100644 --- a/.github/workflows/android-build-scripts.yml +++ b/.github/workflows/android-build-scripts.yml @@ -56,8 +56,8 @@ jobs: - name: print ffbuild logs if: ${{ failure() }} run: '[[ -f ./src/ffmpeg/ffbuild/config.log ]] && tail -50 ./src/ffmpeg/ffbuild/config.log' - build-lts-on-linux: - name: android lts on linux + build-api-16-on-linux: + name: android api 16 on linux runs-on: ubuntu-22.04 strategy: matrix: @@ -80,7 +80,7 @@ jobs: unzip -q -o ndk.zip -d .ndk echo "ANDROID_NDK_ROOT=$PWD/.ndk/$(ls .ndk)" >> $GITHUB_ENV - name: run the build script - run: ./android.sh -d --lts --enable-android-media-codec --enable-android-zlib + run: ./android.sh -d --api-level=16 --enable-android-media-codec --enable-android-zlib - name: print build logs if: ${{ always() }} run: cat build.log @@ -116,8 +116,8 @@ jobs: - name: print ffbuild logs if: ${{ failure() }} run: '[[ -f ./src/ffmpeg/ffbuild/config.log ]] && tail -50 ./src/ffmpeg/ffbuild/config.log' - build-lts-on-macos: - name: android lts on macos + build-api-16-on-macos: + name: android api 16 on macos runs-on: macos-12 strategy: matrix: @@ -138,7 +138,7 @@ jobs: unzip -q -o ndk.zip -d .ndk echo "ANDROID_NDK_ROOT=$PWD/.ndk/$(ls .ndk)" >> $GITHUB_ENV - name: run the build script - run: ./android.sh -d --lts --enable-android-media-codec --enable-android-zlib + run: ./android.sh -d --api-level=16 --enable-android-media-codec --enable-android-zlib - name: print build logs if: ${{ always() }} run: cat build.log diff --git a/.github/workflows/ios-build-scripts.yml b/.github/workflows/ios-build-scripts.yml index 40387ce..19d95e7 100644 --- a/.github/workflows/ios-build-scripts.yml +++ b/.github/workflows/ios-build-scripts.yml @@ -73,8 +73,8 @@ jobs: - name: print ffbuild logs if: ${{ failure() }} run: '[[ -f ./src/ffmpeg/ffbuild/config.log ]] && tail -50 ./src/ffmpeg/ffbuild/config.log' - build-lts-on-macos-monterey: - name: ios lts on monterey + build-min-sdk-10-on-macos-monterey: + name: ios min sdk 10 on monterey runs-on: macos-12 strategy: matrix: @@ -89,7 +89,7 @@ jobs: - name: set up xcode run: echo "export DEVELOPER_DIR=/Applications/Xcode_${{ matrix.xcode }}.app/Contents/Developer" > ~/.xcode.for.ffmpeg.kit.sh - name: run the build script - run: ./ios.sh --lts --enable-ios-audiotoolbox --enable-ios-bzip2 --enable-ios-libiconv --enable-ios-zlib + run: ./ios.sh --target=10 --enable-ios-audiotoolbox --enable-ios-bzip2 --enable-ios-libiconv --enable-ios-zlib - name: print build logs if: ${{ always() }} run: cat build.log diff --git a/.github/workflows/linux-build-scripts.yml b/.github/workflows/linux-build-scripts.yml index a42e980..9107ba3 100644 --- a/.github/workflows/linux-build-scripts.yml +++ b/.github/workflows/linux-build-scripts.yml @@ -41,24 +41,6 @@ jobs: - name: print ffbuild logs if: ${{ failure() }} run: '[[ -f ./src/ffmpeg/ffbuild/config.log ]] && tail -50 ./src/ffmpeg/ffbuild/config.log' - build-lts-on-ubuntu-2204: - name: linux lts on ubuntu 22.04 - runs-on: ubuntu-22.04 - defaults: - run: - shell: bash - steps: - - uses: actions/checkout@v4 - - name: prerequisites - run: sudo apt-get install clang llvm lld libclang-14-dev libstdc++6 nasm autoconf automake libtool pkg-config curl git doxygen rapidjson-dev - - name: run the build script - run: ./linux.sh -d --lts - - name: print build logs - if: ${{ always() }} - run: cat build.log - - name: print ffbuild logs - if: ${{ failure() }} - run: '[[ -f ./src/ffmpeg/ffbuild/config.log ]] && tail -50 ./src/ffmpeg/ffbuild/config.log' build-main-on-ubuntu-2004: name: linux main on ubuntu-20.04 runs-on: ubuntu-20.04 @@ -77,21 +59,3 @@ jobs: - name: print ffbuild logs if: ${{ failure() }} run: '[[ -f ./src/ffmpeg/ffbuild/config.log ]] && tail -50 ./src/ffmpeg/ffbuild/config.log' - build-lts-on-ubuntu-2004: - name: linux lts on ubuntu 20.04 - runs-on: ubuntu-20.04 - defaults: - run: - shell: bash - steps: - - uses: actions/checkout@v4 - - name: prerequisites - run: sudo apt-get install clang llvm lld libclang-11-dev libstdc++6 nasm autoconf automake libtool pkg-config curl git doxygen rapidjson-dev - - name: run the build script - run: ./linux.sh -d --lts - - name: print build logs - if: ${{ always() }} - run: cat build.log - - name: print ffbuild logs - if: ${{ failure() }} - run: '[[ -f ./src/ffmpeg/ffbuild/config.log ]] && tail -50 ./src/ffmpeg/ffbuild/config.log' diff --git a/.github/workflows/macos-build-scripts.yml b/.github/workflows/macos-build-scripts.yml index d76fcfe..483705e 100644 --- a/.github/workflows/macos-build-scripts.yml +++ b/.github/workflows/macos-build-scripts.yml @@ -73,8 +73,8 @@ jobs: - name: print ffbuild logs if: ${{ failure() }} run: '[[ -f ./src/ffmpeg/ffbuild/config.log ]] && tail -50 ./src/ffmpeg/ffbuild/config.log' - build-lts-on-macos-monterey: - name: macos lts on monterey + build-min-sdk-1012-on-macos-monterey: + name: macos min sdk 10.12 on monterey runs-on: macos-12 strategy: matrix: @@ -89,7 +89,7 @@ jobs: - name: set up xcode run: echo "export DEVELOPER_DIR=/Applications/Xcode_${{ matrix.xcode }}.app/Contents/Developer" > ~/.xcode.for.ffmpeg.kit.sh - name: run the build script - run: ./macos.sh --lts --enable-macos-audiotoolbox --enable-macos-bzip2 --enable-macos-coreimage --enable-macos-libiconv --enable-macos-opencl --enable-macos-opengl --enable-macos-videotoolbox --enable-macos-zlib + run: ./macos.sh --target=10.12 --enable-macos-audiotoolbox --enable-macos-bzip2 --enable-macos-coreimage --enable-macos-libiconv --enable-macos-opencl --enable-macos-opengl --enable-macos-videotoolbox --enable-macos-zlib - name: print build logs if: ${{ always() }} run: cat build.log diff --git a/.github/workflows/periodic-builds-android.yml b/.github/workflows/periodic-builds-android.yml index 97b278f..21f5738 100644 --- a/.github/workflows/periodic-builds-android.yml +++ b/.github/workflows/periodic-builds-android.yml @@ -43,8 +43,8 @@ jobs: - name: print ffbuild logs if: ${{ failure() }} run: '[[ -f ./src/ffmpeg/ffbuild/config.log ]] && tail -50 ./src/ffmpeg/ffbuild/config.log' - build-android-lts-on-linux: - name: android lts on linux + build-android-api-16-on-linux: + name: android api 16 on linux runs-on: ubuntu-22.04 strategy: matrix: @@ -74,7 +74,7 @@ jobs: unzip -q -o ndk.zip -d .ndk echo "ANDROID_NDK_ROOT=$PWD/.ndk/$(ls .ndk)" >> $GITHUB_ENV - name: run the build script - run: ./android.sh -l --full --enable-gpl --disable-lib-srt + run: ./android.sh --api-level=16 --full --enable-gpl --disable-lib-srt - name: print build logs if: ${{ always() }} run: cat build.log diff --git a/.github/workflows/periodic-builds-apple.yml b/.github/workflows/periodic-builds-apple.yml index 6b3b19b..0429e89 100644 --- a/.github/workflows/periodic-builds-apple.yml +++ b/.github/workflows/periodic-builds-apple.yml @@ -31,8 +31,8 @@ jobs: - name: print ffbuild logs if: ${{ failure() }} run: '[[ -f ./src/ffmpeg/ffbuild/config.log ]] && tail -50 ./src/ffmpeg/ffbuild/config.log' - build-ios-lts-on-macos-monterey: - name: ios lts on monterey + build-ios-min-sdk-10-on-macos-monterey: + name: ios min sdk 10 on monterey runs-on: macos-12 strategy: matrix: @@ -50,7 +50,7 @@ jobs: - name: set up xcode run: echo "export DEVELOPER_DIR=/Applications/Xcode_${{ matrix.xcode }}.app/Contents/Developer" > ~/.xcode.for.ffmpeg.kit.sh - name: run the build script - run: PATH="/usr/local/opt/bison/bin:$PATH" XML_CATALOG_FILES="/usr/local/etc/xml/catalog" ./ios.sh -l --full --enable-gpl --disable-lib-srt --disable-lib-gnutls --disable-armv7s --disable-arm64e --disable-i386 + run: PATH="/usr/local/opt/bison/bin:$PATH" XML_CATALOG_FILES="/usr/local/etc/xml/catalog" ./ios.sh --target=10 --full --enable-gpl --disable-lib-srt --disable-lib-gnutls --disable-armv7s --disable-arm64e --disable-i386 - name: print build logs if: ${{ always() }} run: cat build.log @@ -83,8 +83,8 @@ jobs: - name: print ffbuild logs if: ${{ failure() }} run: '[[ -f ./src/ffmpeg/ffbuild/config.log ]] && tail -50 ./src/ffmpeg/ffbuild/config.log' - build-macos-lts-on-macos-monterey: - name: macos lts on monterey + build-macos-min-sdk-1012-on-macos-monterey: + name: macos min sdk 10.12 on monterey runs-on: macos-12 strategy: matrix: @@ -102,7 +102,7 @@ jobs: - name: set up xcode run: echo "export DEVELOPER_DIR=/Applications/Xcode_${{ matrix.xcode }}.app/Contents/Developer" > ~/.xcode.for.ffmpeg.kit.sh - name: run the build script - run: PATH="/usr/local/opt/bison/bin:$PATH" XML_CATALOG_FILES="/usr/local/etc/xml/catalog" ./macos.sh -l --full --enable-gpl --disable-lib-srt --disable-lib-gnutls + run: PATH="/usr/local/opt/bison/bin:$PATH" XML_CATALOG_FILES="/usr/local/etc/xml/catalog" ./macos.sh --target=10.12 --full --enable-gpl --disable-lib-srt --disable-lib-gnutls - name: print build logs if: ${{ always() }} run: cat build.log @@ -135,8 +135,8 @@ jobs: - name: print ffbuild logs if: ${{ failure() }} run: '[[ -f ./src/ffmpeg/ffbuild/config.log ]] && tail -50 ./src/ffmpeg/ffbuild/config.log' - build-tvos-lts-on-macos-monterey: - name: tvos lts on monterey + build-tvos-min-sdk-100-on-macos-monterey: + name: tvos min sdk 10.0 on monterey runs-on: macos-12 strategy: matrix: @@ -154,7 +154,7 @@ jobs: - name: set up xcode run: echo "export DEVELOPER_DIR=/Applications/Xcode_${{ matrix.xcode }}.app/Contents/Developer" > ~/.xcode.for.ffmpeg.kit.sh - name: run the build script - run: PATH="/usr/local/opt/bison/bin:$PATH" XML_CATALOG_FILES="/usr/local/etc/xml/catalog" ./tvos.sh -l --full --enable-gpl --disable-lib-srt --disable-lib-gnutls + run: PATH="/usr/local/opt/bison/bin:$PATH" XML_CATALOG_FILES="/usr/local/etc/xml/catalog" ./tvos.sh --target=10.0 --full --enable-gpl --disable-lib-srt --disable-lib-gnutls - name: print build logs if: ${{ always() }} run: cat build.log diff --git a/.github/workflows/tvos-build-scripts.yml b/.github/workflows/tvos-build-scripts.yml index eaee3ab..e6f52ca 100644 --- a/.github/workflows/tvos-build-scripts.yml +++ b/.github/workflows/tvos-build-scripts.yml @@ -73,8 +73,8 @@ jobs: - name: print ffbuild logs if: ${{ failure() }} run: '[[ -f ./src/ffmpeg/ffbuild/config.log ]] && tail -50 ./src/ffmpeg/ffbuild/config.log' - build-lts-on-macos-monterey: - name: tvos lts on monterey + build-min-sdk-100-on-macos-monterey: + name: tvos min sdk 10.0 on monterey runs-on: macos-12 strategy: matrix: @@ -89,7 +89,7 @@ jobs: - name: set up xcode run: echo "export DEVELOPER_DIR=/Applications/Xcode_${{ matrix.xcode }}.app/Contents/Developer" > ~/.xcode.for.ffmpeg.kit.sh - name: run the build script - run: ./tvos.sh --lts --enable-tvos-bzip2 --enable-tvos-audiotoolbox --enable-tvos-libiconv --enable-tvos-zlib + run: ./tvos.sh --target=10.0 --enable-tvos-bzip2 --enable-tvos-audiotoolbox --enable-tvos-libiconv --enable-tvos-zlib - name: print build logs if: ${{ always() }} run: cat build.log diff --git a/android.sh b/android.sh index b8289fe..6253168 100755 --- a/android.sh +++ b/android.sh @@ -17,7 +17,7 @@ source "${BASEDIR}"/scripts/variable.sh source "${BASEDIR}"/scripts/function-${FFMPEG_KIT_BUILD_TYPE}.sh disabled_libraries=() -# SET DEFAULTS SETTINGS +# SET DEFAULT SETTINGS enable_default_android_architectures enable_default_android_libraries enable_main_build @@ -34,18 +34,6 @@ BUILD_FULL="" BUILD_TYPE_ID="" BUILD_VERSION=$(git describe --tags --always 2>>"${BASEDIR}"/build.log) -# PROCESS LTS BUILD OPTION FIRST AND SET BUILD TYPE: MAIN OR LTS -rm -f "${BASEDIR}"/android/ffmpeg-kit-android-lib/build.gradle 1>>"${BASEDIR}"/build.log 2>&1 -cp "${BASEDIR}"/tools/android/build.gradle "${BASEDIR}"/android/ffmpeg-kit-android-lib/build.gradle 1>>"${BASEDIR}"/build.log 2>&1 -for argument in "$@"; do - if [[ "$argument" == "-l" ]] || [[ "$argument" == "--lts" ]]; then - enable_lts_build - BUILD_TYPE_ID+="LTS " - rm -f "${BASEDIR}"/android/ffmpeg-kit-android-lib/build.gradle 1>>"${BASEDIR}"/build.log 2>&1 - cp "${BASEDIR}"/tools/android/build.lts.gradle "${BASEDIR}"/android/ffmpeg-kit-android-lib/build.gradle 1>>"${BASEDIR}"/build.log 2>&1 - fi -done - # PROCESS BUILD OPTIONS while [ ! $# -eq 0 ]; do @@ -82,7 +70,6 @@ while [ ! $# -eq 0 ]; do -s | --speed) optimize_for_speed ;; - -l | --lts) ;; -f | --force) export BUILD_FORCE="1" ;; @@ -209,7 +196,7 @@ if [[ -n ${DISPLAY_HELP} ]]; then fi # SET API LEVEL IN build.gradle -${SED_INLINE} "s/minSdkVersion .*/minSdkVersion ${API}/g" "${BASEDIR}"/android/ffmpeg-kit-android-lib/build.gradle 1>>"${BASEDIR}"/build.log 2>&1 +${SED_INLINE} "s/minSdk .*/minSdk ${API}/g" "${BASEDIR}"/android/ffmpeg-kit-android-lib/build.gradle 1>>"${BASEDIR}"/build.log 2>&1 ${SED_INLINE} "s/versionCode ..0/versionCode ${API}0/g" "${BASEDIR}"/android/ffmpeg-kit-android-lib/build.gradle 1>>"${BASEDIR}"/build.log 2>&1 echo -e "\nBuilding ffmpeg-kit ${BUILD_TYPE_ID}library for Android\n" @@ -305,11 +292,15 @@ fi if [[ ${ENABLED_ARCHITECTURES[ARCH_X86_64]} -eq 1 ]]; then ANDROID_ARCHITECTURES+="$(get_android_arch 4) " fi -if [[ ! -z ${FFMPEG_KIT_LTS_BUILD} ]]; then - mkdir -p "${BASEDIR}"/android/build 1>>"${BASEDIR}"/build.log 2>&1 - append_file "${BASEDIR}"/android/jni/build.mk "LTS_POSTFIX := -lts" +append_file "${BASEDIR}"/android/jni/build.mk "ARMV7_BUILD_PATH := android-arm-${API}" +append_file "${BASEDIR}"/android/jni/build.mk "ARMV7_NEON_BUILD_PATH := android-arm-neon-${API}" +append_file "${BASEDIR}"/android/jni/build.mk "X86_BUILD_PATH := android-x86-${API}" +if [[ $(compare_versions "$API" "21") -lt 0 ]]; then + append_file "${BASEDIR}"/android/jni/build.mk "ARM64_BUILD_PATH := android-arm64-21" + append_file "${BASEDIR}"/android/jni/build.mk "X86_64_BUILD_PATH := android-x86_64-21" else - append_file "${BASEDIR}"/android/jni/build.mk "LTS_POSTFIX := " + append_file "${BASEDIR}"/android/jni/build.mk "ARM64_BUILD_PATH := android-arm64-${API}" + append_file "${BASEDIR}"/android/jni/build.mk "X86_64_BUILD_PATH := android-x86_64-${API}" fi # BUILD FFMPEG-KIT diff --git a/android/ffmpeg-kit-android-lib/build.gradle b/android/ffmpeg-kit-android-lib/build.gradle index 2ca3f3a..b3bda6b 100644 --- a/android/ffmpeg-kit-android-lib/build.gradle +++ b/android/ffmpeg-kit-android-lib/build.gradle @@ -5,7 +5,6 @@ android { namespace 'com.arthenica.ffmpegkit' } compileSdk 34 - ndkVersion "25.2.9519653" defaultConfig { minSdk 24 diff --git a/android/ffmpeg-kit-android-lib/src/main/cpp/ffmpegkit.c b/android/ffmpeg-kit-android-lib/src/main/cpp/ffmpegkit.c index acd84ae..b7d0113 100644 --- a/android/ffmpeg-kit-android-lib/src/main/cpp/ffmpegkit.c +++ b/android/ffmpeg-kit-android-lib/src/main/cpp/ffmpegkit.c @@ -902,8 +902,13 @@ Java_com_arthenica_ffmpegkit_FFmpegKitConfig_getNativeVersion(JNIEnv *env, JNIEXPORT jstring JNICALL Java_com_arthenica_ffmpegkit_FFmpegKitConfig_getNativePackageName( JNIEnv *env, jclass object) { + +#define STRINGIFY(x) #x +#define TOSTRING(x) STRINGIFY(x) +#define FFMPEG_KIT_PACKAGE_STR TOSTRING(FFMPEG_KIT_PACKAGE) + #ifdef FFMPEG_KIT_PACKAGE - return (*env)->NewStringUTF(env, FFMPEG_KIT_PACKAGE); + return (*env)->NewStringUTF(env, FFMPEG_KIT_PACKAGE_STR); #else return (*env)->NewStringUTF(env, ""); #endif diff --git a/android/ffmpeg-kit-android-lib/src/main/cpp/ffmpegkit_abidetect.c b/android/ffmpeg-kit-android-lib/src/main/cpp/ffmpegkit_abidetect.c index b43a249..73fc2c8 100644 --- a/android/ffmpeg-kit-android-lib/src/main/cpp/ffmpegkit_abidetect.c +++ b/android/ffmpeg-kit-android-lib/src/main/cpp/ffmpegkit_abidetect.c @@ -33,7 +33,9 @@ JNINativeMethod abiDetectMethods[] = { {"isNativeLTSBuild", "()Z", (void *)Java_com_arthenica_ffmpegkit_AbiDetect_isNativeLTSBuild}, {"getNativeBuildConf", "()Ljava/lang/String;", - (void *)Java_com_arthenica_ffmpegkit_AbiDetect_getNativeBuildConf}}; + (void *)Java_com_arthenica_ffmpegkit_AbiDetect_getNativeBuildConf}, + {"getNativeMinSdk", "()Ljava/lang/String;", + (void *)Java_com_arthenica_ffmpegkit_AbiDetect_getNativeMinSdk}}; /** * Called when 'abidetect' native library is loaded. @@ -55,7 +57,7 @@ jint JNI_OnLoad(JavaVM *vm, void *reserved) { return JNI_FALSE; } - if ((*env)->RegisterNatives(env, abiDetectClass, abiDetectMethods, 4) < 0) { + if ((*env)->RegisterNatives(env, abiDetectClass, abiDetectMethods, 5) < 0) { LOGE("OnLoad failed to RegisterNatives for class %s.\n", abiDetectClassName); return JNI_FALSE; @@ -152,3 +154,25 @@ Java_com_arthenica_ffmpegkit_AbiDetect_getNativeBuildConf(JNIEnv *env, jclass object) { return (*env)->NewStringUTF(env, FFMPEG_CONFIGURATION); } + +/** + * Returns the minimum Android API level required to run this native library. + * + * @param env pointer to native method interface + * @param object reference to the class on which this method is invoked + * @return the minimum Android API level required to run this native library + */ +JNIEXPORT jstring JNICALL +Java_com_arthenica_ffmpegkit_AbiDetect_getNativeMinSdk( + JNIEnv *env, jclass object) { + +#define STRINGIFY(x) #x +#define TOSTRING(x) STRINGIFY(x) +#define FFMPEG_KIT_MIN_SDK_STR TOSTRING(FFMPEG_KIT_MIN_SDK) + +#ifdef FFMPEG_KIT_MIN_SDK + return (*env)->NewStringUTF(env, FFMPEG_KIT_MIN_SDK_STR); +#else + return (*env)->NewStringUTF(env, ""); +#endif +} diff --git a/android/ffmpeg-kit-android-lib/src/main/cpp/ffmpegkit_abidetect.h b/android/ffmpeg-kit-android-lib/src/main/cpp/ffmpegkit_abidetect.h index 3e96b2f..dab81f4 100644 --- a/android/ffmpeg-kit-android-lib/src/main/cpp/ffmpegkit_abidetect.h +++ b/android/ffmpeg-kit-android-lib/src/main/cpp/ffmpegkit_abidetect.h @@ -76,4 +76,13 @@ Java_com_arthenica_ffmpegkit_AbiDetect_isNativeLTSBuild(JNIEnv *, jclass); JNIEXPORT jstring JNICALL Java_com_arthenica_ffmpegkit_AbiDetect_getNativeBuildConf(JNIEnv *, jclass); +/* + * Class: com_arthenica_ffmpegkit_AbiDetect + * Method: getNativeMinSdk + * Signature: ()Ljava/lang/String; + */ +JNIEXPORT jstring JNICALL +Java_com_arthenica_ffmpegkit_AbiDetect_getNativeMinSdk( +JNIEnv *env, jclass object); + #endif /* FFMPEG_KIT_ABIDETECT_H */ diff --git a/android/ffmpeg-kit-android-lib/src/main/java/com/arthenica/ffmpegkit/AbiDetect.java b/android/ffmpeg-kit-android-lib/src/main/java/com/arthenica/ffmpegkit/AbiDetect.java index c2e0010..adbe0ee 100644 --- a/android/ffmpeg-kit-android-lib/src/main/java/com/arthenica/ffmpegkit/AbiDetect.java +++ b/android/ffmpeg-kit-android-lib/src/main/java/com/arthenica/ffmpegkit/AbiDetect.java @@ -101,4 +101,11 @@ public class AbiDetect { */ native static String getNativeBuildConf(); + /** + *

Returns the minimum Android API level required to run this library. + * + * @return minimum Android API level required to run this library + */ + public native static String getNativeMinSdk(); + } diff --git a/android/ffmpeg-kit-android-lib/src/main/java/com/arthenica/ffmpegkit/FFmpegKitConfig.java b/android/ffmpeg-kit-android-lib/src/main/java/com/arthenica/ffmpegkit/FFmpegKitConfig.java index 93efad7..adb83e2 100644 --- a/android/ffmpeg-kit-android-lib/src/main/java/com/arthenica/ffmpegkit/FFmpegKitConfig.java +++ b/android/ffmpeg-kit-android-lib/src/main/java/com/arthenica/ffmpegkit/FFmpegKitConfig.java @@ -179,7 +179,7 @@ public class FFmpegKitConfig { globalLogRedirectionStrategy = LogRedirectionStrategy.PRINT_LOGS_WHEN_NO_CALLBACKS_DEFINED; safUrlsReusable = new AtomicBoolean(false); - android.util.Log.i(FFmpegKitConfig.TAG, String.format("Loaded ffmpeg-kit-%s-%s-%s-%s.", NativeLoader.loadPackageName(), NativeLoader.loadAbi(), NativeLoader.loadVersion(), NativeLoader.loadBuildDate())); + android.util.Log.i(FFmpegKitConfig.TAG, String.format("Loaded ffmpeg-kit-%s-%s-%s-api%s-%s.", NativeLoader.loadPackageName(), NativeLoader.loadAbi(), NativeLoader.loadVersion(), NativeLoader.loadMinSdk(), NativeLoader.loadBuildDate())); } /** @@ -574,18 +574,17 @@ public class FFmpegKitConfig { * @return FFmpegKit version */ public static String getVersion() { - if (isLTSBuild()) { - return String.format("%s-lts", getNativeVersion()); - } else { - return getNativeVersion(); - } + return getNativeVersion(); } /** *

Returns whether FFmpegKit release is a Long Term Release or not. * * @return true/yes or false/no + * @deprecated as of version 6.1.2, use the {@link AbiDetect#getNativeMinSdk()} method to + * determine the features supported by this version */ + @Deprecated(since = "6.1.2", forRemoval = true) public static boolean isLTSBuild() { return AbiDetect.isNativeLTSBuild(); } diff --git a/android/ffmpeg-kit-android-lib/src/main/java/com/arthenica/ffmpegkit/NativeLoader.java b/android/ffmpeg-kit-android-lib/src/main/java/com/arthenica/ffmpegkit/NativeLoader.java index 163fb55..d12fdb3 100644 --- a/android/ffmpeg-kit-android-lib/src/main/java/com/arthenica/ffmpegkit/NativeLoader.java +++ b/android/ffmpeg-kit-android-lib/src/main/java/com/arthenica/ffmpegkit/NativeLoader.java @@ -76,6 +76,14 @@ public class NativeLoader { } } + static String loadMinSdk() { + if (isTestModeDisabled()) { + return AbiDetect.getNativeMinSdk(); + } else { + return String.format(Locale.getDefault(), "%d", Build.VERSION.SDK_INT); + } + } + static String loadPackageName() { if (isTestModeDisabled()) { return Packages.getPackageName(); @@ -85,25 +93,15 @@ public class NativeLoader { } static String loadVersion() { - final String version = "6.0"; + final String version = "6.1.2"; if (isTestModeDisabled()) { return FFmpegKitConfig.getVersion(); - } else if (loadIsLTSBuild()) { - return String.format("%s-lts", version); } else { return version; } } - static boolean loadIsLTSBuild() { - if (isTestModeDisabled()) { - return AbiDetect.isNativeLTSBuild(); - } else { - return true; - } - } - static int loadLogLevel() { if (isTestModeDisabled()) { return FFmpegKitConfig.getNativeLogLevel(); diff --git a/android/jni/Android.mk b/android/jni/Android.mk index c337443..0401b71 100644 --- a/android/jni/Android.mk +++ b/android/jni/Android.mk @@ -10,40 +10,37 @@ ifeq ($(TARGET_ARCH_ABI), armeabi-v7a) MY_ARMV7_NEON := ${ARMV7_NEON} endif -ifeq ($(TARGET_ARCH_ABI), armeabi-v7a) - ifeq ($(MY_ARMV7_NEON), true) - MY_BUILD_DIR := android-$(TARGET_ARCH)-neon-$(API)$(LTS_POSTFIX) - else - MY_BUILD_DIR := android-$(TARGET_ARCH)-$(API)$(LTS_POSTFIX) - endif -else - MY_BUILD_DIR := android-$(TARGET_ARCH)-$(API)$(LTS_POSTFIX) -endif - -FFMPEG_INCLUDES := $(MY_LOCAL_PATH)/../../prebuilt/$(MY_BUILD_DIR)/ffmpeg/include - +# DEFINE ARCH FLAGS MY_ARM_MODE := arm MY_ARM_NEON := false -LOCAL_PATH := $(MY_LOCAL_PATH)/../ffmpeg-kit-android-lib/src/main/cpp - -# DEFINE ARCH FLAGS ifeq ($(TARGET_ARCH_ABI), armeabi-v7a) MY_ARCH_FLAGS := ARM_V7A MY_ARM_NEON := true + ifeq ($(MY_ARMV7_NEON), true) + MY_BUILD_DIR := $(ARMV7_NEON_BUILD_PATH) + else + MY_BUILD_DIR := $(ARMV7_BUILD_PATH) + endif endif ifeq ($(TARGET_ARCH_ABI), arm64-v8a) MY_ARCH_FLAGS := ARM64_V8A MY_ARM_NEON := true + MY_BUILD_DIR := $(ARM64_BUILD_PATH) endif ifeq ($(TARGET_ARCH_ABI), x86) MY_ARCH_FLAGS := X86 MY_ARM_NEON := true + MY_BUILD_DIR := $(X86_BUILD_PATH) endif ifeq ($(TARGET_ARCH_ABI), x86_64) MY_ARCH_FLAGS := X86_64 MY_ARM_NEON := true + MY_BUILD_DIR := $(X86_64_BUILD_PATH) endif +FFMPEG_INCLUDES := $(MY_LOCAL_PATH)/../../prebuilt/$(MY_BUILD_DIR)/ffmpeg/include +LOCAL_PATH := $(MY_LOCAL_PATH)/../ffmpeg-kit-android-lib/src/main/cpp +# 16 kb page size support for arm64-v8a and x86_64 ifeq ($(TARGET_ARCH_ABI),arm64-v8a) MY_LDFLAGS := -Wl,-z,max-page-size=16384 else ifeq ($(TARGET_ARCH_ABI),x86_64) diff --git a/android/jni/ffmpeg/Android.mk b/android/jni/ffmpeg/Android.mk index 3c07e31..0f95818 100644 --- a/android/jni/ffmpeg/Android.mk +++ b/android/jni/ffmpeg/Android.mk @@ -1,4 +1,16 @@ -LOCAL_PATH := $(call my-dir)/../../../prebuilt/android-$(TARGET_ARCH)-$(API)$(MY_LTS_POSTFIX)/ffmpeg/lib +ifeq ($(TARGET_ARCH_ABI), armeabi-v7a) + MY_BUILD_DIR := $(ARMV7_BUILD_PATH) +endif +ifeq ($(TARGET_ARCH_ABI), arm64-v8a) + MY_BUILD_DIR := $(ARM64_BUILD_PATH) +endif +ifeq ($(TARGET_ARCH_ABI), x86) + MY_BUILD_DIR := $(X86_BUILD_PATH) +endif +ifeq ($(TARGET_ARCH_ABI), x86_64) + MY_BUILD_DIR := $(X86_64_BUILD_PATH) +endif +LOCAL_PATH := $(call my-dir)/../../../prebuilt/$(MY_BUILD_DIR)/ffmpeg/lib MY_ARM_MODE := arm diff --git a/android/jni/ffmpeg/neon/Android.mk b/android/jni/ffmpeg/neon/Android.mk index 8fa7113..d3a187f 100644 --- a/android/jni/ffmpeg/neon/Android.mk +++ b/android/jni/ffmpeg/neon/Android.mk @@ -1,4 +1,4 @@ -LOCAL_PATH := $(call my-dir)/../../../../prebuilt/android-$(TARGET_ARCH)-neon-$(API)$(MY_LTS_POSTFIX)/ffmpeg/lib +LOCAL_PATH := $(call my-dir)/../../../../prebuilt/$(MY_BUILD_DIR)/ffmpeg/lib MY_ARM_MODE := arm MY_ARM_NEON := true diff --git a/apple.sh b/apple.sh index 38c21c8..bc4ee39 100755 --- a/apple.sh +++ b/apple.sh @@ -25,8 +25,7 @@ After that this script should be used to create an umbrella xcframework.\n" echo -e "Options:" echo -e " -h, --help\t\t\tdisplay this help and exit" echo -e " -v, --version\t\t\tdisplay version information and exit" - echo -e " -f, --force\t\t\tignore warnings" - echo -e " -l, --lts\t\t\tinclude lts packages to support iOS 10+, tvOS 10+, macOS 10.12+ devices\n" + echo -e " -f, --force\t\t\tignore warnings\n" echo -e "Architectures:" echo -e " --disable-iphoneos\t\tdo not include iphoneos architecture variant [yes]" @@ -124,7 +123,7 @@ source "${BASEDIR}"/scripts/variable.sh export FFMPEG_KIT_BUILD_TYPE="apple" source "${BASEDIR}"/scripts/function-${FFMPEG_KIT_BUILD_TYPE}.sh -# SET DEFAULTS SETTINGS +# SET DEFAULT SETTINGS enable_default_architecture_variants # SELECT XCODE VERSION USED FOR BUILDING @@ -137,7 +136,8 @@ fi DETECTED_IOS_SDK_VERSION="$(xcrun --sdk iphoneos --show-sdk-version 2>>"${BASEDIR}"/build.log)" DETECTED_TVOS_SDK_VERSION="$(xcrun --sdk appletvos --show-sdk-version 2>>"${BASEDIR}"/build.log)" DETECTED_MACOS_SDK_VERSION="$(xcrun --sdk macosx --show-sdk-version 2>>"${BASEDIR}"/build.log)" -echo -e "INFO: Using iOS SDK: ${DETECTED_IOS_SDK_VERSION}, tvOS SDK: ${DETECTED_TVOS_SDK_VERSION}, macOS SDK: ${DETECTED_MACOS_SDK_VERSION} by Xcode provided at $(xcode-select -p)\n" 1>>"${BASEDIR}"/build.log 2>&1 +XCODE_PATH=$(xcode-select -p 2>>"${BASEDIR}"/build.log) +echo -e "INFO: Using iOS SDK: ${DETECTED_IOS_SDK_VERSION}, tvOS SDK: ${DETECTED_TVOS_SDK_VERSION}, macOS SDK: ${DETECTED_MACOS_SDK_VERSION} by Xcode provided at ${XCODE_PATH}\n" 1>>"${BASEDIR}"/build.log 2>&1 echo -e "INFO: Build options: $*\n" 1>>"${BASEDIR}"/build.log 2>&1 # SET DEFAULT BUILD OPTIONS @@ -152,14 +152,6 @@ if [[ -z ${BUILD_VERSION} ]]; then exit 1 fi -# PROCESS LTS BUILD OPTION FIRST AND SET BUILD TYPE: MAIN OR LTS -for argument in "$@"; do - if [[ "$argument" == "-l" ]] || [[ "$argument" == "--lts" ]]; then - export FFMPEG_KIT_LTS_BUILD="1" - BUILD_TYPE_ID+="LTS " - fi -done - # PROCESS BUILD OPTIONS while [ ! $# -eq 0 ]; do case $1 in @@ -170,7 +162,6 @@ while [ ! $# -eq 0 ]; do display_version exit 0 ;; - -l | --lts) ;; -f | --force) export BUILD_FORCE="1" ;; diff --git a/apple/src/ArchDetect.h b/apple/src/ArchDetect.h index 6725b0d..cb83ded 100644 --- a/apple/src/ArchDetect.h +++ b/apple/src/ArchDetect.h @@ -41,6 +41,13 @@ */ + (NSString *)getArch; +/** + * Returns the minimum skd version required to run this native library + * + * @return the minimum skd version required to run this native library + */ ++ (NSString *)getMinSdk; + @end #endif // FFMPEG_KIT_ARCH_DETECT_H diff --git a/apple/src/ArchDetect.m b/apple/src/ArchDetect.m index b69e588..1a435ea 100644 --- a/apple/src/ArchDetect.m +++ b/apple/src/ArchDetect.m @@ -170,4 +170,12 @@ return arch; } ++ (NSString *)getMinSdk { +#ifdef FFMPEG_KIT_MIN_SDK + return [NSString stringWithUTF8String:FFMPEG_KIT_MIN_SDK]; +#else + return @""; +#endif +} + @end diff --git a/apple/src/FFmpegKit.m b/apple/src/FFmpegKit.m index 26e77c8..4cdf58c 100644 --- a/apple/src/FFmpegKit.m +++ b/apple/src/FFmpegKit.m @@ -31,9 +31,19 @@ [FFmpegKitConfig class]; - NSLog(@"Loaded ffmpeg-kit-%@-%@-%@-%@.\n", [Packages getPackageName], - [ArchDetect getArch], [FFmpegKitConfig getVersion], - [FFmpegKitConfig getBuildDate]); + #if TARGET_OS_MACCATALYST + NSString* osType = @"maccatalyst"; + #elif TARGET_OS_TV + NSString* osType = @"tvos"; + #elif TARGET_OS_IOS + NSString* osType = @"ios"; + #elif TARGET_OS_MAC + NSString* osType = @"macos"; + #endif + + NSLog(@"Loaded ffmpeg-kit-%@-%@-%@-%@%@-%@.\n", [Packages getPackageName], + [ArchDetect getArch], [FFmpegKitConfig getVersion], osType, + [ArchDetect getMinSdk], [FFmpegKitConfig getBuildDate]); } + (FFmpegSession *)executeWithArguments:(NSArray *)arguments { diff --git a/apple/src/FFmpegKitConfig.h b/apple/src/FFmpegKitConfig.h index fdb6499..c0d8779 100644 --- a/apple/src/FFmpegKitConfig.h +++ b/apple/src/FFmpegKitConfig.h @@ -147,7 +147,7 @@ typedef NS_ENUM(NSUInteger, Signal) { * * @return true/yes or false/no */ -+ (int)isLTSBuild; ++ (int)isLTSBuild __attribute__((deprecated("Deprecated as of version 6.1.2. Use AbiDetect.getMinSdk() method to determine the features supported by this version."))); /** * Returns FFmpegKit library build date. diff --git a/apple/src/FFmpegKitConfig.m b/apple/src/FFmpegKitConfig.m index adc64b0..001ae94 100644 --- a/apple/src/FFmpegKitConfig.m +++ b/apple/src/FFmpegKitConfig.m @@ -1033,11 +1033,7 @@ int executeFFprobe(long sessionId, NSArray *arguments) { } + (NSString *)getVersion { - if ([FFmpegKitConfig isLTSBuild] == 1) { - return [NSString stringWithFormat:@"%@-lts", FFmpegKitVersion]; - } else { - return FFmpegKitVersion; - } + return FFmpegKitVersion; } + (int)isLTSBuild { diff --git a/ios.sh b/ios.sh index f1b86df..202b779 100755 --- a/ios.sh +++ b/ios.sh @@ -18,7 +18,7 @@ source "${BASEDIR}"/scripts/variable.sh source "${BASEDIR}"/scripts/function-${FFMPEG_KIT_BUILD_TYPE}.sh disabled_libraries=() -# SET DEFAULTS SETTINGS +# SET DEFAULT SETTINGS enable_default_ios_architectures # SELECT XCODE VERSION USED FOR BUILDING @@ -49,14 +49,6 @@ fi # MAIN BUILDS ENABLED BY DEFAULT enable_main_build -# PROCESS LTS BUILD OPTION FIRST AND SET BUILD TYPE: MAIN OR LTS -for argument in "$@"; do - if [[ "$argument" == "-l" ]] || [[ "$argument" == "--lts" ]]; then - enable_lts_build - BUILD_TYPE_ID+="LTS " - fi -done - # PROCESS BUILD OPTIONS while [ ! $# -eq 0 ]; do case $1 in @@ -92,7 +84,6 @@ while [ ! $# -eq 0 ]; do -s | --speed) optimize_for_speed ;; - -l | --lts) ;; -x | --xcframework) FFMPEG_KIT_XCF_BUILD="1" ;; diff --git a/linux.sh b/linux.sh index 579d1b9..b33e155 100755 --- a/linux.sh +++ b/linux.sh @@ -7,7 +7,7 @@ source "${BASEDIR}"/scripts/variable.sh source "${BASEDIR}"/scripts/function-${FFMPEG_KIT_BUILD_TYPE}.sh disabled_libraries=() -# SET DEFAULTS SETTINGS +# SET DEFAULT SETTINGS enable_default_linux_architectures echo -e "INFO: Build options: $*\n" 1>>"${BASEDIR}"/build.log 2>&1 @@ -55,7 +55,6 @@ while [ ! $# -eq 0 ]; do -s | --speed) optimize_for_speed ;; - -l | --lts) ;; -f | --force) export BUILD_FORCE="1" ;; diff --git a/macos.sh b/macos.sh index 8d7d348..9959f28 100755 --- a/macos.sh +++ b/macos.sh @@ -18,7 +18,7 @@ source "${BASEDIR}"/scripts/variable.sh source "${BASEDIR}"/scripts/function-${FFMPEG_KIT_BUILD_TYPE}.sh disabled_libraries=() -# SET DEFAULTS SETTINGS +# SET DEFAULT SETTINGS enable_default_macos_architectures # SELECT XCODE VERSION USED FOR BUILDING @@ -49,14 +49,6 @@ fi # MAIN BUILDS ENABLED BY DEFAULT enable_main_build -# PROCESS LTS BUILD OPTION FIRST AND SET BUILD TYPE: MAIN OR LTS -for argument in "$@"; do - if [[ "$argument" == "-l" ]] || [[ "$argument" == "--lts" ]]; then - enable_lts_build - BUILD_TYPE_ID+="LTS " - fi -done - # PROCESS BUILD OPTIONS while [ ! $# -eq 0 ]; do case $1 in @@ -89,7 +81,6 @@ while [ ! $# -eq 0 ]; do -s | --speed) optimize_for_speed ;; - -l | --lts) ;; -x | --xcframework) FFMPEG_KIT_XCF_BUILD="1" ;; diff --git a/scripts/apple/ffmpeg.sh b/scripts/apple/ffmpeg.sh index d40c2d7..8c6303b 100755 --- a/scripts/apple/ffmpeg.sh +++ b/scripts/apple/ffmpeg.sh @@ -401,17 +401,34 @@ for library in {0..61}; do CONFIGURE_POSTFIX+=" --enable-opengl" ;; *-videotoolbox) - CONFIGURE_POSTFIX+=" --enable-videotoolbox" - - # DISABLE FILTERS THAT REQUIRE IOS 16.0 OR MACOS 10.8 - if [[ $(compare_versions "$IOS_MIN_VERSION" "16.0") -lt 1 ]]; then - CONFIGURE_POSTFIX+=" --disable-filter=scale_vt" - elif [[ $(compare_versions "$MACOS_MIN_VERSION" "10.8") -lt 1 ]]; then - CONFIGURE_POSTFIX+=" --disable-filter=scale_vt" - elif [[ $(compare_versions "$MAC_CATALYST_MIN_VERSION" "16.0") -lt 1 ]]; then - CONFIGURE_POSTFIX+=" --disable-filter=scale_vt" - elif [[ $(compare_versions "$TVOS_MIN_VERSION" "16.0") -lt 1 ]]; then - CONFIGURE_POSTFIX+=" --disable-filter=scale_vt" + if [[ ${FFMPEG_KIT_BUILD_TYPE} == "ios" ]]; then + CONFIGURE_POSTFIX+=" --enable-videotoolbox" + + # DISABLE FILTERS THAT REQUIRE IOS 16.0 + if [[ $(compare_versions "$IOS_MIN_VERSION" "16.0") -lt 1 ]]; then + CONFIGURE_POSTFIX+=" --disable-filter=scale_vt" + echo -e "WARN: Disabled scale_vt filter as it requires min sdk version >= 16.0 for ios. Currently it is set to $IOS_MIN_VERSION.\n" 1>>"${BASEDIR}"/build.log 2>&1 + elif [[ $(compare_versions "$MAC_CATALYST_MIN_VERSION" "16.0") -lt 1 ]]; then + CONFIGURE_POSTFIX+=" --disable-filter=scale_vt" + echo -e "WARN: Disabled scale_vt filter as it requires min sdk version >= 16.0 for ios. Currently it is set to $MAC_CATALYST_MIN_VERSION.\n" 1>>"${BASEDIR}"/build.log 2>&1 + fi + elif [[ ${FFMPEG_KIT_BUILD_TYPE} == "macos" ]]; then + + if [[ $(compare_versions "$MACOS_MIN_VERSION" "10.13") -ge 1 ]]; then + CONFIGURE_POSTFIX+=" --enable-videotoolbox" + else + CONFIGURE_POSTFIX+=" --disable-videotoolbox" + echo -e "WARN: Disabled videotoolbox as it requires min sdk version >= 10.13 for macos. Currently it is set to $MACOS_MIN_VERSION.\n" 1>>"${BASEDIR}"/build.log 2>&1 + fi + + elif [[ ${FFMPEG_KIT_BUILD_TYPE} == "tvos" ]]; then + CONFIGURE_POSTFIX+=" --enable-videotoolbox" + + # DISABLE FILTERS THAT REQUIRE TVOS 16 + if [[ $(compare_versions "$TVOS_MIN_VERSION" "16.0") -lt 1 ]]; then + CONFIGURE_POSTFIX+=" --disable-filter=scale_vt" + echo -e "WARN: Disabled scale_vt filter as it requires min sdk version >= 16.0 for tvos. Currently it is set to $TVOS_MIN_VERSION.\n" 1>>"${BASEDIR}"/build.log 2>&1 + fi fi ;; *-zlib) diff --git a/scripts/function-android.sh b/scripts/function-android.sh index ee632b9..f641c3e 100755 --- a/scripts/function-android.sh +++ b/scripts/function-android.sh @@ -22,6 +22,10 @@ get_ffmpeg_kit_version() { echo "${FFMPEG_KIT_VERSION}" } +get_min_api_level_flag() { + echo "-DFFMPEG_KIT_MIN_SDK=${API}" +} + display_help() { local COMMAND=$(echo "$0" | sed -e 's/\.\///g') @@ -33,7 +37,7 @@ under the prebuilt folder.\n" echo -e "Usage: ./$COMMAND [OPTION]... [VAR=VALUE]...\n" echo -e "Specify environment variables as VARIABLE=VALUE to override default build options.\n" - display_help_options " -l, --lts\t\t\tbuild lts packages to support API 16+ devices\n --jobs=N\t\t\tnumber of jobs to run [auto]\n --api-level=api\t\toverride Android api level [24]\n --toolchain=path\t\toverride the default (llvm) toolchain path\n --no-ffmpeg-kit-protocols\tdisable custom ffmpeg-kit protocols (saf) [no]" + display_help_options " --jobs=N\t\t\tnumber of jobs to run [auto]\n --api-level=api\t\toverride Android api level [24]\n --toolchain=path\t\toverride the default (llvm) toolchain path\n --no-ffmpeg-kit-protocols\tdisable custom ffmpeg-kit protocols (saf) [no]" display_help_licensing echo -e "Architectures:" @@ -58,18 +62,7 @@ enable_main_build() { export API=24 } -enable_lts_build() { - export FFMPEG_KIT_LTS_BUILD="1" - - # LTS RELEASES USE API LEVEL 16 / Android 4.1 (JELLY BEAN) - export API=16 -} - build_application_mk() { - if [[ -n ${FFMPEG_KIT_LTS_BUILD} ]]; then - local LTS_BUILD_FLAG="-DFFMPEG_KIT_LTS " - fi - if [[ ${ENABLED_LIBRARIES[$LIBRARY_X265]} -eq 1 ]] || [[ ${ENABLED_LIBRARIES[$LIBRARY_TESSERACT]} -eq 1 ]] || [[ ${ENABLED_LIBRARIES[$LIBRARY_OPENH264]} -eq 1 ]] || [[ ${ENABLED_LIBRARIES[$LIBRARY_SNAPPY]} -eq 1 ]] || [[ ${ENABLED_LIBRARIES[$LIBRARY_RUBBERBAND]} -eq 1 ]] || [[ ${ENABLED_LIBRARIES[$LIBRARY_ZIMG]} -eq 1 ]] || [[ ${ENABLED_LIBRARIES[$LIBRARY_SRT]} -eq 1 ]] || [[ ${ENABLED_LIBRARIES[$LIBRARY_CHROMAPRINT]} -eq 1 ]] || [[ ${ENABLED_LIBRARIES[$LIBRARY_LIBILBC]} -eq 1 ]] || [[ -n ${CUSTOM_LIBRARY_USES_CPP} ]]; then local APP_STL="c++_shared" else @@ -81,6 +74,8 @@ build_application_mk() { local USES_FFMPEG_KIT_PROTOCOLS="-DUSES_FFMPEG_KIT_PROTOCOLS" fi + local MIN_API=$(get_min_api_level_flag) + rm -f "${BASEDIR}/android/jni/Application.mk" cat >"${BASEDIR}/android/jni/Application.mk" <>"${BASEDIR}"/build.log)" } diff --git a/scripts/function-ios.sh b/scripts/function-ios.sh index 89c98c5..c92ac23 100755 --- a/scripts/function-ios.sh +++ b/scripts/function-ios.sh @@ -27,7 +27,7 @@ libraries are created under the prebuilt folder.\n" echo -e "Usage: ./$COMMAND [OPTION]...\n" echo -e "Specify environment variables as VARIABLE=VALUE to override default build options.\n" - display_help_options " -x, --xcframework\t\tbuild xcframework bundles instead of framework bundles" " -l, --lts build lts packages to support sdk 10+ devices\n --jobs=N\t\t\t\t\tnumber of jobs to run [auto]" " --target=ios sdk version\t\t\toverride minimum deployment target [12.1]" " --mac-catalyst-target=ios sdk version\toverride minimum deployment target for mac catalyst [14.0]" + display_help_options " -x, --xcframework\t\tbuild xcframework bundles instead of framework bundles" " --jobs=N\t\t\t\t\tnumber of jobs to run [auto]" " --target=ios sdk version\t\t\toverride minimum deployment target [12.1]" " --mac-catalyst-target=ios sdk version\toverride minimum deployment target for mac catalyst [14.0]" display_help_licensing echo -e "Architectures:" @@ -75,35 +75,11 @@ enable_main_build() { fi } -enable_lts_build() { - export FFMPEG_KIT_LTS_BUILD="1" - - if [[ $(compare_versions "$DETECTED_IOS_SDK_VERSION" "10") -le 0 ]]; then - export IOS_MIN_VERSION=$DETECTED_IOS_SDK_VERSION - else - - # XCODE 8.0 HAS IOS SDK 10 - export IOS_MIN_VERSION=10 - fi - - if [[ $(compare_versions "$DETECTED_IOS_SDK_VERSION" "13.0") -le 0 ]]; then - export MAC_CATALYST_MIN_VERSION=$DETECTED_IOS_SDK_VERSION - else - - # MAC CATALYST IS INTRODUCED IN 13.0 - export MAC_CATALYST_MIN_VERSION=13.0 - fi -} - get_common_includes() { echo "-I${SDK_PATH}/usr/include" } get_common_cflags() { - if [[ -n ${FFMPEG_KIT_LTS_BUILD} ]]; then - local LTS_BUILD_FLAG="-DFFMPEG_KIT_LTS " - fi - local BUILD_DATE="-DFFMPEG_KIT_BUILD_DATE=$(date +%Y%m%d 2>>"${BASEDIR}"/build.log)" if [ -z $NO_BITCODE ]; then local BITCODE_FLAGS="-fembed-bitcode" @@ -111,13 +87,13 @@ get_common_cflags() { case ${ARCH} in i386 | x86-64 | arm64-simulator) - echo "-fstrict-aliasing -DIOS ${LTS_BUILD_FLAG}${BUILD_DATE} -Wno-incompatible-function-pointer-types -isysroot ${SDK_PATH}" + echo "-fstrict-aliasing -DIOS $(get_min_sdk_version_flag) ${BUILD_DATE} -Wno-incompatible-function-pointer-types -isysroot ${SDK_PATH}" ;; *-mac-catalyst) - echo "-fstrict-aliasing ${BITCODE_FLAGS} -DMACOSX ${LTS_BUILD_FLAG}${BUILD_DATE} -Wno-incompatible-function-pointer-types -isysroot ${SDK_PATH}" + echo "-fstrict-aliasing ${BITCODE_FLAGS} -DMACOSX $(get_min_sdk_version_flag) ${BUILD_DATE} -Wno-incompatible-function-pointer-types -isysroot ${SDK_PATH}" ;; *) - echo "-fstrict-aliasing ${BITCODE_FLAGS} -DIOS ${LTS_BUILD_FLAG}${BUILD_DATE} -Wno-incompatible-function-pointer-types -isysroot ${SDK_PATH}" + echo "-fstrict-aliasing ${BITCODE_FLAGS} -DIOS $(get_min_sdk_version_flag) ${BUILD_DATE} -Wno-incompatible-function-pointer-types -isysroot ${SDK_PATH}" ;; esac } @@ -274,7 +250,7 @@ get_asmflags() { } get_cxxflags() { - local COMMON_CFLAGS="$(get_common_cflags "$1") $(get_common_includes "$1") $(get_arch_specific_cflags) $(get_min_version_cflags "$1")" + local COMMON_CFLAGS="$(get_common_cflags "$1") $(get_common_includes "$1") $(get_arch_specific_cflags) $(get_min_version_cflags "$1") $(get_min_sdk_version_flag)" if [[ -z ${FFMPEG_KIT_DEBUG} ]]; then local OPTIMIZATION_FLAGS="-Oz" else diff --git a/scripts/function-linux.sh b/scripts/function-linux.sh index 197f1be..0c09dcf 100755 --- a/scripts/function-linux.sh +++ b/scripts/function-linux.sh @@ -25,7 +25,7 @@ libraries are created under the prebuilt folder.\n" echo -e "Usage: ./$COMMAND [OPTION]...\n" echo -e "Specify environment variables as VARIABLE=VALUE to override default build options.\n" - display_help_options " -l, --lts\t\t\tbuild lts packages to support older devices\n --jobs=N\t\t\tnumber of jobs to run [auto]" + display_help_options " --jobs=N\t\t\tnumber of jobs to run [auto]" display_help_licensing echo -e "Architectures:" @@ -83,11 +83,7 @@ libraries are created under the prebuilt folder.\n" } enable_main_build() { - unset FFMPEG_KIT_LTS_BUILD -} - -enable_lts_build() { - export FFMPEG_KIT_LTS_BUILD="1" + local _TMP } install_pkg_config_file() { @@ -113,12 +109,7 @@ install_pkg_config_file() { } get_bundle_directory() { - local LTS_POSTFIX="" - if [[ -n ${FFMPEG_KIT_LTS_BUILD} ]]; then - LTS_POSTFIX="-lts" - fi - - echo "bundle-linux${LTS_POSTFIX}" + echo "bundle-linux" } create_linux_bundle() { @@ -223,11 +214,7 @@ get_common_includes() { } get_common_cflags() { - if [[ -n ${FFMPEG_KIT_LTS_BUILD} ]]; then - local LTS_BUILD_FLAG="-DFFMPEG_KIT_LTS " - fi - - echo "-fstrict-aliasing -fPIC -DLINUX ${LTS_BUILD_FLAG} ${LLVM_CONFIG_CFLAGS}" + echo "-fstrict-aliasing -fPIC -DLINUX ${LLVM_CONFIG_CFLAGS}" } get_arch_specific_cflags() { @@ -513,38 +500,20 @@ EOF } get_build_directory() { - local LTS_POSTFIX="" - if [[ -n ${FFMPEG_KIT_LTS_BUILD} ]]; then - LTS_POSTFIX="-lts" - fi - - echo "linux-$(get_target_cpu)${LTS_POSTFIX}" + echo "linux-$(get_target_cpu)" } detect_clang_version() { - if [[ -n ${FFMPEG_KIT_LTS_BUILD} ]]; then - for clang_version in 6 .. 10; do - if [[ $(command_exists "clang-$clang_version") -eq 0 ]]; then - echo "$clang_version" - return - elif [[ $(command_exists "clang-$clang_version.0") -eq 0 ]]; then - echo "$clang_version.0" - return - fi - done - echo "none" - else - for clang_version in 11 .. 20; do - if [[ $(command_exists "clang-$clang_version") -eq 0 ]]; then - echo "$clang_version" - return - elif [[ $(command_exists "clang-$clang_version.0") -eq 0 ]]; then - echo "$clang_version.0" - return - fi - done - echo "none" - fi + for clang_version in 6 .. 20; do + if [[ $(command_exists "clang-$clang_version") -eq 0 ]]; then + echo "$clang_version" + return + elif [[ $(command_exists "clang-$clang_version.0") -eq 0 ]]; then + echo "$clang_version.0" + return + fi + done + echo "none" } set_toolchain_paths() { diff --git a/scripts/function-macos.sh b/scripts/function-macos.sh index 3eea70e..02e3af0 100755 --- a/scripts/function-macos.sh +++ b/scripts/function-macos.sh @@ -19,7 +19,7 @@ When compilation ends, libraries are created under the prebuilt folder.\n" echo -e "Usage: ./$COMMAND [OPTION]...\n" echo -e "Specify environment variables as VARIABLE=VALUE to override default build options.\n" - display_help_options " -x, --xcframework\t\tbuild xcframework bundles instead of framework bundles" " -l, --lts build lts packages to support sdk 10.12+ devices\n --jobs=N\t\t\t\tnumber of jobs to run [auto]" " --target=macos sdk version\toverride minimum deployment target [10.15]" + display_help_options " -x, --xcframework\t\tbuild xcframework bundles instead of framework bundles" " --jobs=N\t\t\t\tnumber of jobs to run [auto]" " --target=macos sdk version\toverride minimum deployment target [10.15]" display_help_licensing echo -e "Architectures:" @@ -57,35 +57,19 @@ enable_main_build() { fi } -enable_lts_build() { - export FFMPEG_KIT_LTS_BUILD="1" - - if [[ $(compare_versions "$DETECTED_MACOS_SDK_VERSION" "10.12") -le 0 ]]; then - export MACOS_MIN_VERSION=$DETECTED_MACOS_SDK_VERSION - else - - # XCODE 8.0 HAS MACOS SDK 10.12 - export MACOS_MIN_VERSION=10.12 - fi -} - get_common_includes() { echo "-I${SDK_PATH}/usr/include" } get_common_cflags() { - if [[ -n ${FFMPEG_KIT_LTS_BUILD} ]]; then - local LTS_BUILD_FLAG="-DFFMPEG_KIT_LTS " - fi - local BUILD_DATE="-DFFMPEG_KIT_BUILD_DATE=$(date +%Y%m%d 2>>"${BASEDIR}"/build.log)" case ${ARCH} in arm64) - echo "-fstrict-aliasing -DMACOSX ${LTS_BUILD_FLAG}${BUILD_DATE} -Wno-incompatible-function-pointer-types -isysroot ${SDK_PATH}" + echo "-fstrict-aliasing -DMACOSX $(get_min_sdk_version_flag) ${BUILD_DATE} -Wno-incompatible-function-pointer-types -isysroot ${SDK_PATH}" ;; *) - echo "-fstrict-aliasing -DMACOSX ${LTS_BUILD_FLAG}${BUILD_DATE} -Wno-incompatible-function-pointer-types -isysroot ${SDK_PATH}" + echo "-fstrict-aliasing -DMACOSX $(get_min_sdk_version_flag) ${BUILD_DATE} -Wno-incompatible-function-pointer-types -isysroot ${SDK_PATH}" ;; esac } @@ -214,7 +198,7 @@ get_asmflags() { } get_cxxflags() { - local COMMON_CFLAGS="$(get_common_cflags "$1") $(get_common_includes "$1") $(get_arch_specific_cflags) $(get_min_version_cflags "$1")" + local COMMON_CFLAGS="$(get_common_cflags "$1") $(get_common_includes "$1") $(get_arch_specific_cflags) $(get_min_version_cflags "$1") $(get_min_sdk_version_flag)" if [[ -z ${FFMPEG_KIT_DEBUG} ]]; then local OPTIMIZATION_FLAGS="-Oz" else diff --git a/scripts/function-tvos.sh b/scripts/function-tvos.sh index 2ef0741..21bf4be 100755 --- a/scripts/function-tvos.sh +++ b/scripts/function-tvos.sh @@ -20,7 +20,7 @@ set explicitly. When compilation ends, libraries are created under the prebuilt echo -e "Usage: ./$COMMAND [OPTION]...\n" echo -e "Specify environment variables as VARIABLE=VALUE to override default build options.\n" - display_help_options " -x, --xcframework\t\tbuild xcframework bundles instead of framework bundles" " -l, --lts build lts packages to support sdk 10.0+ devices\n --jobs=N\t\t\tnumber of jobs to run [auto]" " --target=tvos sdk version\toverride minimum deployment target [11.0]" + display_help_options " -x, --xcframework\t\tbuild xcframework bundles instead of framework bundles" " --jobs=N\t\t\tnumber of jobs to run [auto]" " --target=tvos sdk version\toverride minimum deployment target [11.0]" display_help_licensing echo -e "Architectures:" @@ -33,9 +33,7 @@ set explicitly. When compilation ends, libraries are created under the prebuilt echo -e " --full\t\t\tenables all non-GPL external libraries" echo -e " --enable-tvos-audiotoolbox\tbuild with built-in Apple AudioToolbox support [no]" echo -e " --enable-tvos-bzip2\t\tbuild with built-in bzip2 support [no]" - if [[ -z ${FFMPEG_KIT_LTS_BUILD} ]]; then - echo -e " --enable-tvos-videotoolbox\tbuild with built-in Apple VideoToolbox support [no]" - fi + echo -e " --enable-tvos-videotoolbox\tbuild with built-in Apple VideoToolbox support [no]" echo -e " --enable-tvos-zlib\t\tbuild with built-in zlib [no]" echo -e " --enable-tvos-libiconv\tbuild with built-in libiconv [no]" @@ -57,27 +55,11 @@ enable_main_build() { fi } -enable_lts_build() { - export FFMPEG_KIT_LTS_BUILD="1" - - if [[ $(compare_versions "$DETECTED_TVOS_SDK_VERSION" "10.0") -le 0 ]]; then - export TVOS_MIN_VERSION=$DETECTED_TVOS_SDK_VERSION - else - - # XCODE 8.0 HAS TVOS SDK 10.0 - export TVOS_MIN_VERSION=10.0 - fi -} - get_common_includes() { echo "-I${SDK_PATH}/usr/include" } get_common_cflags() { - if [[ -n ${FFMPEG_KIT_LTS_BUILD} ]]; then - local LTS_BUILD_FLAG="-DFFMPEG_KIT_LTS " - fi - local BUILD_DATE="-DFFMPEG_KIT_BUILD_DATE=$(date +%Y%m%d 2>>"${BASEDIR}"/build.log)" if [ -z $NO_BITCODE ]; then local BITCODE_FLAGS="-fembed-bitcode" @@ -85,10 +67,10 @@ get_common_cflags() { case ${ARCH} in arm64) - echo "-fstrict-aliasing ${BITCODE_FLAGS} -DTVOS ${LTS_BUILD_FLAG}${BUILD_DATE} -Wno-incompatible-function-pointer-types -isysroot ${SDK_PATH}" + echo "-fstrict-aliasing ${BITCODE_FLAGS} -DTVOS $(get_min_sdk_version_flag) ${BUILD_DATE} -Wno-incompatible-function-pointer-types -isysroot ${SDK_PATH}" ;; x86-64 | arm64-simulator) - echo "-fstrict-aliasing -DTVOS ${LTS_BUILD_FLAG}${BUILD_DATE} -Wno-incompatible-function-pointer-types -isysroot ${SDK_PATH}" + echo "-fstrict-aliasing -DTVOS $(get_min_sdk_version_flag) ${BUILD_DATE} -Wno-incompatible-function-pointer-types -isysroot ${SDK_PATH}" ;; esac } @@ -250,7 +232,7 @@ get_asmflags() { } get_cxxflags() { - local COMMON_CFLAGS="$(get_common_cflags "$1") $(get_common_includes "$1") $(get_arch_specific_cflags) $(get_min_version_cflags "$1")" + local COMMON_CFLAGS="$(get_common_cflags "$1") $(get_common_includes "$1") $(get_arch_specific_cflags) $(get_min_version_cflags "$1") $(get_min_sdk_version_flag)" if [[ -z ${FFMPEG_KIT_DEBUG} ]]; then local OPTIMIZATION_FLAGS="-Oz" else diff --git a/tools/android/build.gradle b/tools/android/build.gradle deleted file mode 100644 index 2ca3f3a..0000000 --- a/tools/android/build.gradle +++ /dev/null @@ -1,65 +0,0 @@ -apply plugin: 'com.android.library' - -android { - if (project.android.hasProperty("namespace")) { - namespace 'com.arthenica.ffmpegkit' - } - compileSdk 34 - ndkVersion "25.2.9519653" - - defaultConfig { - minSdk 24 - targetSdk 34 - versionCode 240612 - versionName "6.1.2" - project.archivesBaseName = "ffmpeg-kit" - consumerProguardFiles "consumer-rules.pro" - } - - buildTypes { - release { - minifyEnabled false - proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro' - } - } - - compileOptions { - sourceCompatibility JavaVersion.VERSION_11 - targetCompatibility JavaVersion.VERSION_11 - } - - sourceSets { - main { - jniLibs.srcDirs = ["../libs"] - } - } - - testOptions { - unitTests.returnDefaultValues = true - unitTests.all { - systemProperty 'enable.ffmpeg.kit.test.mode', 'true' - } - } - - publishing { - singleVariant('release') { - withJavadocJar() - withSourcesJar() - } - } -} - -task javadoc(type: Javadoc) { - title = 'FFmpegKit' - destinationDir = file("${projectDir}/../../docs/android/javadoc") - classpath += project.files(android.getBootClasspath().join(File.pathSeparator)) - source = android.sourceSets.main.java.srcDirs - configurations.implementation.setCanBeResolved(true) - classpath += configurations.implementation -} - -dependencies { - api 'com.arthenica:smart-exception-java:0.2.1' - testImplementation "androidx.test.ext:junit:1.2.1" - testImplementation 'org.json:json:20240303' -} diff --git a/tools/android/build.lts.gradle b/tools/android/build.lts.gradle deleted file mode 100644 index 3b92b34..0000000 --- a/tools/android/build.lts.gradle +++ /dev/null @@ -1,65 +0,0 @@ -apply plugin: 'com.android.library' - -android { - if (project.android.hasProperty("namespace")) { - namespace 'com.arthenica.ffmpegkit' - } - compileSdk 34 - ndkVersion "22.1.7171670" - - defaultConfig { - minSdk 16 - targetSdk 34 - versionCode 160612 - versionName "6.1.2.LTS" - project.archivesBaseName = "ffmpeg-kit" - consumerProguardFiles "consumer-rules.pro" - } - - buildTypes { - release { - minifyEnabled false - proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro' - } - } - - compileOptions { - sourceCompatibility JavaVersion.VERSION_1_8 - targetCompatibility JavaVersion.VERSION_1_8 - } - - sourceSets { - main { - jniLibs.srcDirs = ["../libs"] - } - } - - testOptions { - unitTests.returnDefaultValues = true - unitTests.all { - systemProperty 'enable.ffmpeg.kit.test.mode', 'true' - } - } - - publishing { - singleVariant('release') { - withJavadocJar() - withSourcesJar() - } - } -} - -task javadoc(type: Javadoc) { - title = 'FFmpegKit' - destinationDir = file("${projectDir}/../../docs/android/javadoc") - classpath += project.files(android.getBootClasspath().join(File.pathSeparator)) - source = android.sourceSets.main.java.srcDirs - configurations.implementation.setCanBeResolved(true) - classpath += configurations.implementation -} - -dependencies { - api 'com.arthenica:smart-exception-java:0.2.1' - testImplementation "androidx.test.ext:junit:1.2.1" - testImplementation 'org.json:json:20240303' -} diff --git a/tvos.sh b/tvos.sh index fc7b472..cd36d66 100755 --- a/tvos.sh +++ b/tvos.sh @@ -18,7 +18,7 @@ source "${BASEDIR}"/scripts/variable.sh source "${BASEDIR}"/scripts/function-${FFMPEG_KIT_BUILD_TYPE}.sh disabled_libraries=() -# SET DEFAULTS SETTINGS +# SET DEFAULT SETTINGS enable_default_tvos_architectures # SELECT XCODE VERSION USED FOR BUILDING @@ -49,14 +49,6 @@ fi # MAIN BUILDS ENABLED BY DEFAULT enable_main_build -# PROCESS LTS BUILD OPTION FIRST AND SET BUILD TYPE: MAIN OR LTS -for argument in "$@"; do - if [[ "$argument" == "-l" ]] || [[ "$argument" == "--lts" ]]; then - enable_lts_build - BUILD_TYPE_ID+="LTS " - fi -done - # PROCESS BUILD OPTIONS while [ ! $# -eq 0 ]; do case $1 in @@ -92,7 +84,6 @@ while [ ! $# -eq 0 ]; do -s | --speed) optimize_for_speed ;; - -l | --lts) ;; -x | --xcframework) FFMPEG_KIT_XCF_BUILD="1" ;;