diff --git a/.travis.yml b/.travis.yml index e87acb2..229e041 100644 --- a/.travis.yml +++ b/.travis.yml @@ -8,4 +8,4 @@ before_install: # Keeping track of the NDK version that was used - cat $ANDROID_NDK_HOME/source.properties script: - - bash -e ffmpeg-android-maker.sh --enable-libmp3lame + - bash -e ffmpeg-android-maker.sh --enable-libmp3lame --enable-libaom diff --git a/scripts/libaom/android.cmake b/scripts/libaom/android.cmake new file mode 100644 index 0000000..d6cd101 --- /dev/null +++ b/scripts/libaom/android.cmake @@ -0,0 +1,30 @@ +# Enable NEON for all ARM processors +set(ANDROID_ARM_NEON TRUE) + +# By including this file all necessary variables that point to compiler, linker, etc. +# will be setup. Well, almost all. +# Two variables have to be set before this line though: +# ANDROID_PLATOFORM - the API level to compile against (number) +# ANDROID_ABI - the API of the target platform +include("$ENV{ANDROID_NDK_HOME}/build/cmake/android.toolchain.cmake") + +# AS_EXECUTABLE (AV1 Codec Library's variable) should point to an assembler +# For x86 and x86_64 ABIs it needs yasm +# For armeabi-v7a and arm64-v8a is is ok to use GNU assembler +# When ANDROID_ABI is x86 or _86_64, +# then CMAKE_ASM_NASM_COMPILER variable will point to the yasm compiler (it is set by android.toolchain.cmake) +if(DEFINED CMAKE_ASM_NASM_COMPILER) + set(AS_EXECUTABLE ${CMAKE_ASM_NASM_COMPILER}) +else() + set(AS_EXECUTABLE ${_CMAKE_TOOLCHAIN_PREFIX}as) +endif() + +# AV1 Codec Library doesn't recognise 'i686' as CMAKE_SYSTEM_PROCESSOR +# We have to specify x86 in AOM_TARGET_CPU variable instead +if("${CMAKE_SYSTEM_PROCESSOR}" STREQUAL "i686") + set(AOM_TARGET_CPU x86) +endif() + +# AV1 Codec Library doesn't recognise 'Android' as CMAKE_SYSTEM_NAME +# We should set it to Linux instead +set(CMAKE_SYSTEM_NAME "Linux") diff --git a/scripts/libaom/build.sh b/scripts/libaom/build.sh new file mode 100755 index 0000000..26c19e0 --- /dev/null +++ b/scripts/libaom/build.sh @@ -0,0 +1,22 @@ +# libaom doesn't support building being in its root directory +CMAKE_BUILD_DIR=aom_build_${ANDROID_ABI} +rm -rf ${CMAKE_BUILD_DIR} +mkdir ${CMAKE_BUILD_DIR} +cd ${CMAKE_BUILD_DIR} + +cmake .. \ + -DANDROID_PLATFORM=${ANDROID_PLATFORM} \ + -DANDROID_ABI=${ANDROID_ABI} \ + -DCMAKE_TOOLCHAIN_FILE=${SCRIPTS_DIR}/libaom/android.cmake \ + -DCMAKE_INSTALL_PREFIX=${BUILD_DIR_EXTERNAL}/${ANDROID_ABI} \ + -DCONFIG_PIC=1 \ + -DCONFIG_AV1_ENCODER=0 \ + -DCONFIG_RUNTIME_CPU_DETECT=0 \ + -DENABLE_TESTS=0 \ + -DENABLE_DOCS=0 \ + -DENABLE_TESTDATA=0 \ + -DENABLE_EXAMPLES=0 \ + -DENABLE_TOOLS=0 + +make -j${HOST_NPROC} +make install diff --git a/scripts/libaom/download.sh b/scripts/libaom/download.sh new file mode 100755 index 0000000..9972ad5 --- /dev/null +++ b/scripts/libaom/download.sh @@ -0,0 +1,15 @@ +# Script to download AV1 Codec Library's source code + +# Exports SOURCES_DIR_libaom - path where actual sources are stored + +echo "Using aom master branch" +AOM_SOURCES=aom +if [[ ! -d "$LAME_SOURCES" ]]; then + git clone https://aomedia.googlesource.com/aom +fi + +cd aom +git pull origin master +cd .. + +export SOURCES_DIR_libaom=$(pwd)/${AOM_SOURCES} diff --git a/scripts/parse-arguments.sh b/scripts/parse-arguments.sh index 6c109bc..de95215 100755 --- a/scripts/parse-arguments.sh +++ b/scripts/parse-arguments.sh @@ -35,10 +35,10 @@ do shift ;; # Arguments below enable certain external libraries to build into FFmpeg - # --enable-libaom) - # EXTERNAL_LIBRARIES+=( "libaom" ) - # shift - # ;; + --enable-libaom) + EXTERNAL_LIBRARIES+=( "libaom" ) + shift + ;; # --enable-libdav1d) # EXTERNAL_LIBRARIES+=( "libdav1d" ) # shift