diff --git a/android.sh b/android.sh index 2687b66d2..7dccba1a0 100755 --- a/android.sh +++ b/android.sh @@ -726,22 +726,14 @@ while [ ! $# -eq 0 ]; do done # DETECT BUILD TYPE -rm -f ${BASEDIR}/android/jni/Android.mk 1>>${BASEDIR}/build.log 2>&1 rm -f ${BASEDIR}/android/app/build.gradle 1>>${BASEDIR}/build.log 2>&1 if [[ ! -z ${BUILD_LTS} ]]; then enable_lts_build BUILD_TYPE_ID+="LTS " - cp ${BASEDIR}/tools/ndk/Android.lts.mk ${BASEDIR}/android/jni/Android.mk 1>>${BASEDIR}/build.log 2>&1 cp ${BASEDIR}/tools/release/android/build.lts.gradle ${BASEDIR}/android/app/build.gradle 1>>${BASEDIR}/build.log 2>&1 else - cp ${BASEDIR}/tools/ndk/Android.mk ${BASEDIR}/android/jni/Android.mk 1>>${BASEDIR}/build.log 2>&1 cp ${BASEDIR}/tools/release/android/build.gradle ${BASEDIR}/android/app/build.gradle 1>>${BASEDIR}/build.log 2>&1 - - if [[ -z ${BUILD_FORCE} ]] && [[ ${ENABLED_ARCHITECTURES[${ARCH_ARM_V7A}]} -eq 1 ]]; then - echo -e "INFO: Disabled arm-v7a architecture which is not included in Main releases.\n" 1>>${BASEDIR}/build.log 2>&1 - disable_arch "arm-v7a" - fi fi if [[ ! -z ${DISPLAY_HELP} ]]; then @@ -770,14 +762,6 @@ echo -e "\nBuilding mobile-ffmpeg ${BUILD_TYPE_ID}library for Android\n" echo -e -n "INFO: Building mobile-ffmpeg ${BUILD_VERSION} ${BUILD_TYPE_ID}library for Android: " 1>>${BASEDIR}/build.log 2>&1 echo -e $(date) 1>>${BASEDIR}/build.log 2>&1 -# PERFORM THIS CHECK ONLY ON LTS -if [[ ! -z ${MOBILE_FFMPEG_LTS_BUILD} ]] && [[ ${ENABLED_ARCHITECTURES[0]} -eq 0 ]] && [[ ${ENABLED_ARCHITECTURES[1]} -eq 1 ]]; then - ENABLED_ARCHITECTURES[ARCH_ARM_V7A]=1 - - echo -e "(*) arm-v7a architecture enabled since arm-v7a-neon will be built\n" - echo -e "(*) arm-v7a architecture enabled since arm-v7a-neon will be built\n" 1>>${BASEDIR}/build.log 2>&1 -fi - print_enabled_architectures print_enabled_libraries print_reconfigure_requested_libraries @@ -834,15 +818,21 @@ done export API=${ORIGINAL_API} -rm -f ${BASEDIR}/android/build/.neon 1>>${BASEDIR}/build.log 2>&1 +rm -f ${BASEDIR}/android/build/.armv7 1>>${BASEDIR}/build.log 2>&1 +rm -f ${BASEDIR}/android/build/.armv7neon 1>>${BASEDIR}/build.log 2>&1 ANDROID_ARCHITECTURES="" -if [[ ${ENABLED_ARCHITECTURES[1]} -eq 1 ]]; then +if [[ ${ENABLED_ARCHITECTURES[0]} -eq 1 ]] || [[ ${ENABLED_ARCHITECTURES[1]} -eq 1 ]]; then ANDROID_ARCHITECTURES+="$(get_android_arch 0) " +fi +if [[ ${ENABLED_ARCHITECTURES[0]} -eq 1 ]]; then mkdir -p ${BASEDIR}/android/build 1>>${BASEDIR}/build.log 2>&1 - cat >"${BASEDIR}/android/build/.neon" <"${BASEDIR}/android/build/.armv7" <>${BASEDIR}/build.log 2>&1 + cat >"${BASEDIR}/android/build/.armv7neon" < externalLibrariesEnabled = getExternalLibraries(); if (externalLibrariesEnabled.contains("tesseract") || externalLibrariesEnabled.contains("x265") || externalLibrariesEnabled.contains("snappy") || externalLibrariesEnabled.contains("openh264") || externalLibrariesEnabled.contains("rubberband")) { - // libc++_shared.so included only when tesseract or x265 is enabled System.loadLibrary("c++_shared"); } - System.loadLibrary("avutil"); - System.loadLibrary("swscale"); - System.loadLibrary("swresample"); - System.loadLibrary("avcodec"); - System.loadLibrary("avformat"); - System.loadLibrary("avfilter"); - System.loadLibrary("avdevice"); + + if (AbiDetect.ARM_V7A.equals(AbiDetect.getNativeAbi())) { + try { + System.loadLibrary("avutil_neon"); + System.loadLibrary("swscale_neon"); + System.loadLibrary("swresample_neon"); + System.loadLibrary("avcodec_neon"); + System.loadLibrary("avformat_neon"); + System.loadLibrary("avfilter_neon"); + System.loadLibrary("avdevice_neon"); + nativeFFmpegLoaded = true; + } catch (final UnsatisfiedLinkError e) { + Log.i(Config.TAG, "NEON supported armeabi-v7a ffmpeg library not found. Loading default armeabi-v7a library.", e); + nativeFFmpegTriedAndFailed = true; + } + } + + if (!nativeFFmpegLoaded) { + System.loadLibrary("avutil"); + System.loadLibrary("swscale"); + System.loadLibrary("swresample"); + System.loadLibrary("avcodec"); + System.loadLibrary("avformat"); + System.loadLibrary("avfilter"); + System.loadLibrary("avdevice"); + } } /* ALL MOBILE-FFMPEG LIBRARIES LOADED AT STARTUP */ @@ -106,30 +127,23 @@ public class Config { FFmpeg.class.getName(); FFprobe.class.getName(); - /* - * NEON supported arm-v7a library has a different name - */ - boolean nativeLibraryLoaded = false; - if (AbiDetect.ARM_V7A.equals(AbiDetect.getNativeAbi())) { - if (AbiDetect.isNativeLTSBuild()) { + boolean nativeMobileFFmpegLoaded = false; + if (!nativeFFmpegTriedAndFailed && AbiDetect.ARM_V7A.equals(AbiDetect.getNativeAbi())) { + try { /* - * IF CPU SUPPORTS ARM-V7A-NEON THE TRY TO LOAD IT FIRST. IF NOT LOAD DEFAULT ARM-V7A + * THE TRY TO LOAD ARM-V7A-NEON FIRST. IF NOT LOAD DEFAULT ARM-V7A */ - try { - System.loadLibrary("mobileffmpeg_armv7a_neon"); - nativeLibraryLoaded = true; - AbiDetect.setArmV7aNeonLoaded(true); - } catch (final UnsatisfiedLinkError e) { - Log.i(Config.TAG, "NEON supported armeabi-v7a library not found. Loading default armeabi-v7a library.", e); - } - } else { + System.loadLibrary("mobileffmpeg_armv7a_neon"); + nativeMobileFFmpegLoaded = true; AbiDetect.setArmV7aNeonLoaded(true); + } catch (final UnsatisfiedLinkError e) { + Log.i(Config.TAG, "NEON supported armeabi-v7a mobileffmpeg library not found. Loading default armeabi-v7a library.", e); } } - if (!nativeLibraryLoaded) { + if (!nativeMobileFFmpegLoaded) { System.loadLibrary("mobileffmpeg"); } @@ -503,7 +517,7 @@ public static String getFFmpegVersion() { * @return MobileFFmpeg version */ public static String getVersion() { - if (AbiDetect.isNativeLTSBuild()) { + if (isLTSBuild()) { return String.format("%s-lts", getNativeVersion()); } else { return getNativeVersion(); diff --git a/android/jni/Android.mk b/android/jni/Android.mk index 6c925c128..77ad32d5c 100644 --- a/android/jni/Android.mk +++ b/android/jni/Android.mk @@ -1,15 +1,32 @@ -LOCAL_PATH := $(call my-dir) -$(call import-add-path, $(LOCAL_PATH)) -FFMPEG_INCLUDES := $(LOCAL_PATH)/../../prebuilt/android-$(TARGET_ARCH)/ffmpeg/include +MY_LOCAL_PATH := $(call my-dir) +$(call import-add-path, $(MY_LOCAL_PATH)) + +MY_ARMV7 := false +MY_ARMV7_NEON := false +ifeq ($(TARGET_ARCH_ABI), armeabi-v7a) + ifeq ("$(shell test -e $(MY_LOCAL_PATH)/../build/.armv7 && echo armv7)","armv7") + MY_ARMV7 := true + endif + ifeq ("$(shell test -e $(MY_LOCAL_PATH)/../build/.armv7neon && echo armv7neon)","armv7neon") + MY_ARMV7_NEON := true + endif +endif +ifeq ($(MY_ARMV7_NEON), true) + FFMPEG_INCLUDES := $(MY_LOCAL_PATH)/../../prebuilt/android-$(TARGET_ARCH)/neon/ffmpeg/include + $(call import-module, cpu-features/neon) +else + FFMPEG_INCLUDES := $(MY_LOCAL_PATH)/../../prebuilt/android-$(TARGET_ARCH)/ffmpeg/include + $(call import-module, cpu-features) +endif MY_ARM_MODE := arm MY_ARM_NEON := false -LOCAL_PATH := app/src/main/cpp +LOCAL_PATH := $(MY_LOCAL_PATH)/../app/src/main/cpp # DEFINE ARCH FLAGS ifeq ($(TARGET_ARCH_ABI), armeabi-v7a) MY_ARCH_FLAGS := ARM_V7A - MY_ARM_NEON := true + MY_ARM_NEON := false endif ifeq ($(TARGET_ARCH_ABI), arm64-v8a) MY_ARCH_FLAGS := ARM64_V8A @@ -27,30 +44,61 @@ LOCAL_ARM_MODE := $(MY_ARM_MODE) LOCAL_MODULE := mobileffmpeg_abidetect LOCAL_SRC_FILES := mobileffmpeg_abidetect.c LOCAL_CFLAGS := -Wall -Wextra -Werror -Wno-unused-parameter -DMOBILE_FFMPEG_${MY_ARCH_FLAGS} -LOCAL_C_INCLUDES += $(FFMPEG_INCLUDES) +LOCAL_C_INCLUDES := $(FFMPEG_INCLUDES) LOCAL_LDLIBS := -llog -lz -landroid LOCAL_STATIC_LIBRARIES := cpu-features LOCAL_ARM_NEON := ${MY_ARM_NEON} include $(BUILD_SHARED_LIBRARY) -include $(CLEAR_VARS) -LOCAL_ARM_MODE := $(MY_ARM_MODE) -LOCAL_MODULE := mobileffmpeg ifeq ($(TARGET_PLATFORM),android-16) - LOCAL_SRC_FILES := mobileffmpeg.c mobileffprobe.c android_lts_support.c mobileffmpeg_exception.c fftools_cmdutils.c fftools_ffmpeg.c fftools_ffprobe.c fftools_ffmpeg_opt.c fftools_ffmpeg_hw.c fftools_ffmpeg_filter.c + MY_SRC_FILES := mobileffmpeg.c mobileffprobe.c android_lts_support.c mobileffmpeg_exception.c fftools_cmdutils.c fftools_ffmpeg.c fftools_ffprobe.c fftools_ffmpeg_opt.c fftools_ffmpeg_hw.c fftools_ffmpeg_filter.c else ifeq ($(TARGET_PLATFORM),android-17) - LOCAL_SRC_FILES := mobileffmpeg.c mobileffprobe.c android_lts_support.c mobileffmpeg_exception.c fftools_cmdutils.c fftools_ffmpeg.c fftools_ffprobe.c fftools_ffmpeg_opt.c fftools_ffmpeg_hw.c fftools_ffmpeg_filter.c + MY_SRC_FILES := mobileffmpeg.c mobileffprobe.c android_lts_support.c mobileffmpeg_exception.c fftools_cmdutils.c fftools_ffmpeg.c fftools_ffprobe.c fftools_ffmpeg_opt.c fftools_ffmpeg_hw.c fftools_ffmpeg_filter.c else - LOCAL_SRC_FILES := mobileffmpeg.c mobileffprobe.c mobileffmpeg_exception.c fftools_cmdutils.c fftools_ffmpeg.c fftools_ffprobe.c fftools_ffmpeg_opt.c fftools_ffmpeg_hw.c fftools_ffmpeg_filter.c + MY_SRC_FILES := mobileffmpeg.c mobileffprobe.c mobileffmpeg_exception.c fftools_cmdutils.c fftools_ffmpeg.c fftools_ffprobe.c fftools_ffmpeg_opt.c fftools_ffmpeg_hw.c fftools_ffmpeg_filter.c endif -LOCAL_CFLAGS := -Wall -Werror -Wno-unused-parameter -Wno-switch -Wno-sign-compare -LOCAL_LDLIBS := -llog -lz -landroid -LOCAL_SHARED_LIBRARIES := libavfilter libavformat libavcodec libavutil libswresample libavdevice libswscale -ifeq ($(APP_STL),c++_shared) - LOCAL_SHARED_LIBRARIES += c++_shared # otherwise NDK will not add the library for packaging + +MY_CFLAGS := -Wall -Werror -Wno-unused-parameter -Wno-switch -Wno-sign-compare +MY_LDLIBS := -llog -lz -landroid + +MY_BUILD_GENERIC_MOBILE_FFMPEG := true + +ifeq ($(MY_ARMV7_NEON), true) + include $(CLEAR_VARS) + LOCAL_PATH := $(MY_LOCAL_PATH)/../app/src/main/cpp + LOCAL_ARM_MODE := $(MY_ARM_MODE) + LOCAL_MODULE := mobileffmpeg_armv7a_neon + LOCAL_SRC_FILES := $(MY_SRC_FILES) + LOCAL_CFLAGS := $(MY_CFLAGS) + LOCAL_LDLIBS := $(MY_LDLIBS) + LOCAL_SHARED_LIBRARIES := libavcodec_neon libavfilter_neon libswscale_neon libavformat_neon libavutil_neon libswresample_neon libavdevice_neon + ifeq ($(APP_STL), c++_shared) + LOCAL_SHARED_LIBRARIES += c++_shared # otherwise NDK will not add the library for packaging + endif + LOCAL_ARM_NEON := true + include $(BUILD_SHARED_LIBRARY) + + $(call import-module, ffmpeg/neon) + + ifneq ($(MY_ARMV7), true) + MY_BUILD_GENERIC_MOBILE_FFMPEG := false + endif endif -LOCAL_ARM_NEON := ${MY_ARM_NEON} -include $(BUILD_SHARED_LIBRARY) -$(call import-module, ffmpeg) -$(call import-module, cpu-features) +ifeq ($(MY_BUILD_GENERIC_MOBILE_FFMPEG), true) + include $(CLEAR_VARS) + LOCAL_PATH := $(MY_LOCAL_PATH)/../app/src/main/cpp + LOCAL_ARM_MODE := $(MY_ARM_MODE) + LOCAL_MODULE := mobileffmpeg + LOCAL_SRC_FILES := $(MY_SRC_FILES) + LOCAL_CFLAGS := $(MY_CFLAGS) + LOCAL_LDLIBS := $(MY_LDLIBS) + LOCAL_SHARED_LIBRARIES := libavfilter libavformat libavcodec libavutil libswresample libavdevice libswscale + ifeq ($(APP_STL), c++_shared) + LOCAL_SHARED_LIBRARIES += c++_shared # otherwise NDK will not add the library for packaging + endif + LOCAL_ARM_NEON := ${MY_ARM_NEON} + include $(BUILD_SHARED_LIBRARY) + + $(call import-module, ffmpeg) +endif diff --git a/android/jni/cpu-features/neon/Android.mk b/android/jni/cpu-features/neon/Android.mk new file mode 100644 index 000000000..e231df6a4 --- /dev/null +++ b/android/jni/cpu-features/neon/Android.mk @@ -0,0 +1,8 @@ +LOCAL_PATH := $(call my-dir)/../../../../prebuilt/android-$(TARGET_ARCH)/neon/cpu-features/lib + +include $(CLEAR_VARS) +LOCAL_ARM_MODE := $(MY_ARM_MODE) +LOCAL_MODULE := cpu-features +LOCAL_SRC_FILES := libndk_compat.a +LOCAL_EXPORT_C_INCLUDES := $(LOCAL_PATH)/../include/ndk_compat +include $(PREBUILT_STATIC_LIBRARY) diff --git a/android/jni/ffmpeg/neon/Android.mk b/android/jni/ffmpeg/neon/Android.mk index 17d4b4856..14d7d9e6a 100644 --- a/android/jni/ffmpeg/neon/Android.mk +++ b/android/jni/ffmpeg/neon/Android.mk @@ -1,53 +1,61 @@ LOCAL_PATH := $(call my-dir)/../../../../prebuilt/android-$(TARGET_ARCH)/neon/ffmpeg/lib MY_ARM_MODE := arm +MY_ARM_NEON := true include $(CLEAR_VARS) LOCAL_ARM_MODE := $(MY_ARM_MODE) +LOCAL_ARM_NEON := ${MY_ARM_NEON} LOCAL_MODULE := libavcodec_neon LOCAL_MODULE_FILENAME := $(LOCAL_MODULE) -LOCAL_SRC_FILES := libavcodec.so +LOCAL_SRC_FILES := libavcodec_neon.so include $(PREBUILT_SHARED_LIBRARY) include $(CLEAR_VARS) LOCAL_ARM_MODE := $(MY_ARM_MODE) +LOCAL_ARM_NEON := ${MY_ARM_NEON} LOCAL_MODULE := libavfilter_neon LOCAL_MODULE_FILENAME := $(LOCAL_MODULE) -LOCAL_SRC_FILES := libavfilter.so +LOCAL_SRC_FILES := libavfilter_neon.so include $(PREBUILT_SHARED_LIBRARY) include $(CLEAR_VARS) LOCAL_ARM_MODE := $(MY_ARM_MODE) +LOCAL_ARM_NEON := ${MY_ARM_NEON} LOCAL_MODULE := libavdevice_neon LOCAL_MODULE_FILENAME := $(LOCAL_MODULE) -LOCAL_SRC_FILES := libavdevice.so +LOCAL_SRC_FILES := libavdevice_neon.so include $(PREBUILT_SHARED_LIBRARY) include $(CLEAR_VARS) LOCAL_ARM_MODE := $(MY_ARM_MODE) +LOCAL_ARM_NEON := ${MY_ARM_NEON} LOCAL_MODULE := libavformat_neon LOCAL_MODULE_FILENAME := $(LOCAL_MODULE) -LOCAL_SRC_FILES := libavformat.so +LOCAL_SRC_FILES := libavformat_neon.so include $(PREBUILT_SHARED_LIBRARY) include $(CLEAR_VARS) LOCAL_ARM_MODE := $(MY_ARM_MODE) +LOCAL_ARM_NEON := ${MY_ARM_NEON} LOCAL_MODULE := libavutil_neon LOCAL_MODULE_FILENAME := $(LOCAL_MODULE) -LOCAL_SRC_FILES := libavutil.so +LOCAL_SRC_FILES := libavutil_neon.so LOCAL_EXPORT_C_INCLUDES := $(LOCAL_PATH)/../include include $(PREBUILT_SHARED_LIBRARY) include $(CLEAR_VARS) LOCAL_ARM_MODE := $(MY_ARM_MODE) +LOCAL_ARM_NEON := ${MY_ARM_NEON} LOCAL_MODULE := libswresample_neon LOCAL_MODULE_FILENAME := $(LOCAL_MODULE) -LOCAL_SRC_FILES := libswresample.so +LOCAL_SRC_FILES := libswresample_neon.so include $(PREBUILT_SHARED_LIBRARY) include $(CLEAR_VARS) LOCAL_ARM_MODE := $(MY_ARM_MODE) +LOCAL_ARM_NEON := ${MY_ARM_NEON} LOCAL_MODULE := libswscale_neon LOCAL_MODULE_FILENAME := $(LOCAL_MODULE) -LOCAL_SRC_FILES := libswscale.so +LOCAL_SRC_FILES := libswscale_neon.so include $(PREBUILT_SHARED_LIBRARY) diff --git a/build/android-common.sh b/build/android-common.sh index 566780ec1..600c18ea1 100755 --- a/build/android-common.sh +++ b/build/android-common.sh @@ -141,11 +141,7 @@ get_target_build() { echo "arm" ;; arm-v7a-neon) - if [[ ! -z ${MOBILE_FFMPEG_LTS_BUILD} ]]; then - echo "arm/neon" - else - echo "arm" - fi + echo "arm/neon" ;; arm64-v8a) echo "arm64" diff --git a/build/android-ffmpeg.sh b/build/android-ffmpeg.sh index 998ba5439..f1d23c82b 100755 --- a/build/android-ffmpeg.sh +++ b/build/android-ffmpeg.sh @@ -42,34 +42,34 @@ export PKG_CONFIG_LIBDIR="${INSTALL_PKG_CONFIG_DIR}" TARGET_CPU="" TARGET_ARCH="" -ASM_FLAGS="" +ARCH_OPTIONS="" case ${ARCH} in arm-v7a) TARGET_CPU="armv7-a" TARGET_ARCH="armv7-a" - ASM_FLAGS=" --disable-neon --enable-asm --enable-inline-asm" + ARCH_OPTIONS=" --disable-neon --enable-asm --enable-inline-asm" ;; arm-v7a-neon) TARGET_CPU="armv7-a" TARGET_ARCH="armv7-a" - ASM_FLAGS=" --enable-neon --enable-asm --enable-inline-asm" + ARCH_OPTIONS=" --enable-neon --enable-asm --enable-inline-asm --build-suffix=_neon" ;; arm64-v8a) TARGET_CPU="armv8-a" TARGET_ARCH="aarch64" - ASM_FLAGS=" --enable-neon --enable-asm --enable-inline-asm" + ARCH_OPTIONS=" --enable-neon --enable-asm --enable-inline-asm" ;; x86) TARGET_CPU="i686" TARGET_ARCH="i686" # asm disabled due to this ticker https://trac.ffmpeg.org/ticket/4928 - ASM_FLAGS=" --disable-neon --disable-asm --disable-inline-asm" + ARCH_OPTIONS=" --disable-neon --disable-asm --disable-inline-asm" ;; x86-64) TARGET_CPU="x86_64" TARGET_ARCH="x86_64" - ASM_FLAGS=" --disable-neon --enable-asm --enable-inline-asm" + ARCH_OPTIONS=" --disable-neon --enable-asm --enable-inline-asm" ;; esac @@ -368,7 +368,7 @@ ${SED_INLINE} 's/static int av_log_level/__thread int av_log_level/g' ${BASEDIR} --cxx="${CXX}" \ --extra-libs="$(pkg-config --libs --static cpu-features)" \ --target-os=android \ - ${ASM_FLAGS} \ + ${ARCH_OPTIONS} \ --enable-cross-compile \ --enable-pic \ --enable-jni \ diff --git a/tools/ndk/Android.lts.mk b/tools/ndk/Android.lts.mk deleted file mode 100644 index b038d204c..000000000 --- a/tools/ndk/Android.lts.mk +++ /dev/null @@ -1,82 +0,0 @@ -LOCAL_PATH := $(call my-dir) -$(call import-add-path, $(LOCAL_PATH)) -FFMPEG_INCLUDES := $(LOCAL_PATH)/../../prebuilt/android-$(TARGET_ARCH)/ffmpeg/include - -MY_ARM_MODE := arm -MY_ARM_NEON := false -LOCAL_PATH := app/src/main/cpp - -# DEFINE ARCH FLAGS -ifeq ($(TARGET_ARCH_ABI), armeabi-v7a) - MY_ARCH_FLAGS := ARM_V7A - MY_ARM_NEON := false -endif -ifeq ($(TARGET_ARCH_ABI), arm64-v8a) - MY_ARCH_FLAGS := ARM64_V8A - MY_ARM_NEON := true -endif -ifeq ($(TARGET_ARCH_ABI), x86) - MY_ARCH_FLAGS := X86 -endif -ifeq ($(TARGET_ARCH_ABI), x86_64) - MY_ARCH_FLAGS := X86_64 -endif - -include $(CLEAR_VARS) -LOCAL_ARM_MODE := $(MY_ARM_MODE) -LOCAL_MODULE := mobileffmpeg_abidetect -LOCAL_SRC_FILES := mobileffmpeg_abidetect.c -LOCAL_CFLAGS := -Wall -Wextra -Werror -Wno-unused-parameter -DMOBILE_FFMPEG_${MY_ARCH_FLAGS} -LOCAL_C_INCLUDES += $(FFMPEG_INCLUDES) -LOCAL_LDLIBS := -llog -lz -landroid -LOCAL_STATIC_LIBRARIES := cpu-features -LOCAL_ARM_NEON := ${MY_ARM_NEON} -include $(BUILD_SHARED_LIBRARY) - -include $(CLEAR_VARS) -LOCAL_ARM_MODE := $(MY_ARM_MODE) -LOCAL_MODULE := mobileffmpeg -ifeq ($(TARGET_PLATFORM),android-16) - LOCAL_SRC_FILES := mobileffmpeg.c mobileffprobe.c android_lts_support.c mobileffmpeg_exception.c fftools_cmdutils.c fftools_ffmpeg.c fftools_ffprobe.c fftools_ffmpeg_opt.c fftools_ffmpeg_hw.c fftools_ffmpeg_filter.c -else ifeq ($(TARGET_PLATFORM),android-17) - LOCAL_SRC_FILES := mobileffmpeg.c mobileffprobe.c android_lts_support.c mobileffmpeg_exception.c fftools_cmdutils.c fftools_ffmpeg.c fftools_ffprobe.c fftools_ffmpeg_opt.c fftools_ffmpeg_hw.c fftools_ffmpeg_filter.c -else - LOCAL_SRC_FILES := mobileffmpeg.c mobileffprobe.c mobileffmpeg_exception.c fftools_cmdutils.c fftools_ffmpeg.c fftools_ffprobe.c fftools_ffmpeg_opt.c fftools_ffmpeg_hw.c fftools_ffmpeg_filter.c -endif -LOCAL_CFLAGS := -Wall -Werror -Wno-unused-parameter -Wno-switch -Wno-sign-compare -LOCAL_LDLIBS := -llog -lz -landroid -LOCAL_SHARED_LIBRARIES := libavfilter libavformat libavcodec libavutil libswresample libavdevice libswscale -ifeq ($(APP_STL),c++_shared) - LOCAL_SHARED_LIBRARIES += c++_shared # otherwise NDK will not add the library for packaging -endif -LOCAL_ARM_NEON := ${MY_ARM_NEON} -include $(BUILD_SHARED_LIBRARY) - -ifeq ($(TARGET_ARCH_ABI), armeabi-v7a) - ifeq ("$(shell test -e $(LOCAL_PATH)/../../../../build/.neon && echo neon)","neon") - - include $(CLEAR_VARS) - LOCAL_ARM_MODE := $(MY_ARM_MODE) - LOCAL_MODULE := mobileffmpeg_armv7a_neon - ifeq ($(TARGET_PLATFORM),android-16) - LOCAL_SRC_FILES := mobileffmpeg.c mobileffprobe.c android_lts_support.c mobileffmpeg_exception.c fftools_cmdutils.c fftools_ffmpeg.c fftools_ffprobe.c fftools_ffmpeg_opt.c fftools_ffmpeg_hw.c fftools_ffmpeg_filter.c - else ifeq ($(TARGET_PLATFORM),android-17) - LOCAL_SRC_FILES := mobileffmpeg.c mobileffprobe.c android_lts_support.c mobileffmpeg_exception.c fftools_cmdutils.c fftools_ffmpeg.c fftools_ffprobe.c fftools_ffmpeg_opt.c fftools_ffmpeg_hw.c fftools_ffmpeg_filter.c - else - LOCAL_SRC_FILES := mobileffmpeg.c mobileffprobe.c mobileffmpeg_exception.c fftools_cmdutils.c fftools_ffmpeg.c fftools_ffprobe.c fftools_ffmpeg_opt.c fftools_ffmpeg_hw.c fftools_ffmpeg_filter.c - endif - LOCAL_CFLAGS := -Wall -Werror -Wno-unused-parameter -Wno-switch -Wno-sign-compare - LOCAL_LDLIBS := -llog -lz -landroid - LOCAL_SHARED_LIBRARIES := libavcodec_neon libavfilter_neon libswscale_neon libavformat libavutil libswresample libavdevice - ifeq ($(APP_STL),c++_shared) - LOCAL_SHARED_LIBRARIES += c++_shared # otherwise NDK will not add the library for packaging - endif - LOCAL_ARM_NEON := true - include $(BUILD_SHARED_LIBRARY) - - $(call import-module, ffmpeg/neon) - endif -endif - -$(call import-module, ffmpeg) -$(call import-module, cpu-features) diff --git a/tools/ndk/Android.mk b/tools/ndk/Android.mk deleted file mode 100644 index 6c925c128..000000000 --- a/tools/ndk/Android.mk +++ /dev/null @@ -1,56 +0,0 @@ -LOCAL_PATH := $(call my-dir) -$(call import-add-path, $(LOCAL_PATH)) -FFMPEG_INCLUDES := $(LOCAL_PATH)/../../prebuilt/android-$(TARGET_ARCH)/ffmpeg/include - -MY_ARM_MODE := arm -MY_ARM_NEON := false -LOCAL_PATH := app/src/main/cpp - -# DEFINE ARCH FLAGS -ifeq ($(TARGET_ARCH_ABI), armeabi-v7a) - MY_ARCH_FLAGS := ARM_V7A - MY_ARM_NEON := true -endif -ifeq ($(TARGET_ARCH_ABI), arm64-v8a) - MY_ARCH_FLAGS := ARM64_V8A - MY_ARM_NEON := true -endif -ifeq ($(TARGET_ARCH_ABI), x86) - MY_ARCH_FLAGS := X86 -endif -ifeq ($(TARGET_ARCH_ABI), x86_64) - MY_ARCH_FLAGS := X86_64 -endif - -include $(CLEAR_VARS) -LOCAL_ARM_MODE := $(MY_ARM_MODE) -LOCAL_MODULE := mobileffmpeg_abidetect -LOCAL_SRC_FILES := mobileffmpeg_abidetect.c -LOCAL_CFLAGS := -Wall -Wextra -Werror -Wno-unused-parameter -DMOBILE_FFMPEG_${MY_ARCH_FLAGS} -LOCAL_C_INCLUDES += $(FFMPEG_INCLUDES) -LOCAL_LDLIBS := -llog -lz -landroid -LOCAL_STATIC_LIBRARIES := cpu-features -LOCAL_ARM_NEON := ${MY_ARM_NEON} -include $(BUILD_SHARED_LIBRARY) - -include $(CLEAR_VARS) -LOCAL_ARM_MODE := $(MY_ARM_MODE) -LOCAL_MODULE := mobileffmpeg -ifeq ($(TARGET_PLATFORM),android-16) - LOCAL_SRC_FILES := mobileffmpeg.c mobileffprobe.c android_lts_support.c mobileffmpeg_exception.c fftools_cmdutils.c fftools_ffmpeg.c fftools_ffprobe.c fftools_ffmpeg_opt.c fftools_ffmpeg_hw.c fftools_ffmpeg_filter.c -else ifeq ($(TARGET_PLATFORM),android-17) - LOCAL_SRC_FILES := mobileffmpeg.c mobileffprobe.c android_lts_support.c mobileffmpeg_exception.c fftools_cmdutils.c fftools_ffmpeg.c fftools_ffprobe.c fftools_ffmpeg_opt.c fftools_ffmpeg_hw.c fftools_ffmpeg_filter.c -else - LOCAL_SRC_FILES := mobileffmpeg.c mobileffprobe.c mobileffmpeg_exception.c fftools_cmdutils.c fftools_ffmpeg.c fftools_ffprobe.c fftools_ffmpeg_opt.c fftools_ffmpeg_hw.c fftools_ffmpeg_filter.c -endif -LOCAL_CFLAGS := -Wall -Werror -Wno-unused-parameter -Wno-switch -Wno-sign-compare -LOCAL_LDLIBS := -llog -lz -landroid -LOCAL_SHARED_LIBRARIES := libavfilter libavformat libavcodec libavutil libswresample libavdevice libswscale -ifeq ($(APP_STL),c++_shared) - LOCAL_SHARED_LIBRARIES += c++_shared # otherwise NDK will not add the library for packaging -endif -LOCAL_ARM_NEON := ${MY_ARM_NEON} -include $(BUILD_SHARED_LIBRARY) - -$(call import-module, ffmpeg) -$(call import-module, cpu-features)