Skip to content
This repository has been archived by the owner on Oct 7, 2021. It is now read-only.

Commit

Permalink
support rubber band external library
Browse files Browse the repository at this point in the history
  • Loading branch information
tanersener committed Mar 1, 2020
1 parent 6d5cb88 commit 0baff68
Show file tree
Hide file tree
Showing 217 changed files with 434,087 additions and 410 deletions.
74 changes: 41 additions & 33 deletions android.sh
Original file line number Diff line number Diff line change
Expand Up @@ -30,34 +30,36 @@ LIBRARY_X264=18
LIBRARY_XVIDCORE=19
LIBRARY_X265=20
LIBRARY_LIBVIDSTAB=21
LIBRARY_LIBILBC=22
LIBRARY_OPUS=23
LIBRARY_SNAPPY=24
LIBRARY_SOXR=25
LIBRARY_LIBAOM=26
LIBRARY_CHROMAPRINT=27
LIBRARY_TWOLAME=28
LIBRARY_SDL=29
LIBRARY_TESSERACT=30
LIBRARY_OPENH264=31
LIBRARY_GIFLIB=32
LIBRARY_JPEG=33
LIBRARY_LIBOGG=34
LIBRARY_LIBPNG=35
LIBRARY_LIBUUID=36
LIBRARY_NETTLE=37
LIBRARY_TIFF=38
LIBRARY_EXPAT=39
LIBRARY_SNDFILE=40
LIBRARY_LEPTONICA=41
LIBRARY_ZLIB=42
LIBRARY_MEDIA_CODEC=43
LIBRARY_RUBBERBAND=22
LIBRARY_LIBILBC=23
LIBRARY_OPUS=24
LIBRARY_SNAPPY=25
LIBRARY_SOXR=26
LIBRARY_LIBAOM=27
LIBRARY_CHROMAPRINT=28
LIBRARY_TWOLAME=29
LIBRARY_SDL=30
LIBRARY_TESSERACT=31
LIBRARY_OPENH264=32
LIBRARY_GIFLIB=33
LIBRARY_JPEG=34
LIBRARY_LIBOGG=35
LIBRARY_LIBPNG=36
LIBRARY_LIBUUID=37
LIBRARY_NETTLE=38
LIBRARY_TIFF=39
LIBRARY_EXPAT=40
LIBRARY_SNDFILE=41
LIBRARY_LEPTONICA=42
LIBRARY_LIBSAMPLERATE=43
LIBRARY_ZLIB=44
LIBRARY_MEDIA_CODEC=45

# ENABLE ARCH
ENABLED_ARCHITECTURES=(1 1 1 1 1)

# ENABLE LIBRARIES
ENABLED_LIBRARIES=(0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0)
ENABLED_LIBRARIES=(0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0)

export BASEDIR=$(pwd)
export MOBILE_FFMPEG_TMPDIR="${BASEDIR}/.tmp"
Expand Down Expand Up @@ -144,6 +146,7 @@ When compilation ends an Android Archive (AAR) file is created with enabled plat
echo -e "GPL libraries:"

echo -e " --enable-libvidstab\t\tbuild with libvidstab [no]"
echo -e " --enable-rubberband\t\tbuild with rubber band [no]"
echo -e " --enable-x264\t\t\tbuild with x264 [no]"
echo -e " --enable-x265\t\t\tbuild with x265 [no]"
echo -e " --enable-xvidcore\t\tbuild with xvidcore [no]\n"
Expand Down Expand Up @@ -208,7 +211,7 @@ reconf_library() {
local RECONF_VARIABLE=$(echo "RECONF_$1" | sed "s/\-/\_/g")
local library_supported=0

for library in {1..42}
for library in {1..44}
do
library_name=$(get_library_name $((library - 1)))

Expand All @@ -228,7 +231,7 @@ rebuild_library() {
local REBUILD_VARIABLE=$(echo "REBUILD_$1" | sed "s/\-/\_/g")
local library_supported=0

for library in {1..42}
for library in {1..44}
do
library_name=$(get_library_name $((library - 1)))

Expand Down Expand Up @@ -348,6 +351,11 @@ set_library() {
opus)
ENABLED_LIBRARIES[LIBRARY_OPUS]=$2
;;
rubberband)
ENABLED_LIBRARIES[LIBRARY_RUBBERBAND]=$2
ENABLED_LIBRARIES[LIBRARY_SNDFILE]=$2
ENABLED_LIBRARIES[LIBRARY_LIBSAMPLERATE]=$2
;;
sdl)
ENABLED_LIBRARIES[LIBRARY_SDL]=$2
;;
Expand Down Expand Up @@ -390,7 +398,7 @@ set_library() {
xvidcore)
ENABLED_LIBRARIES[LIBRARY_XVIDCORE]=$2
;;
expat | giflib | jpeg | leptonica | libogg | libpng | libsndfile | libuuid)
expat | giflib | jpeg | leptonica | libogg | libsamplerate | libsndfile | libuuid)
# THESE LIBRARIES ARE NOT ENABLED DIRECTLY
;;
nettle)
Expand Down Expand Up @@ -477,7 +485,7 @@ print_enabled_libraries() {
let enabled=0;

# FIRST BUILT-IN LIBRARIES
for library in {42..43}
for library in {44..45}
do
if [[ ${ENABLED_LIBRARIES[$library]} -eq 1 ]]; then
if [[ ${enabled} -ge 1 ]]; then
Expand All @@ -489,7 +497,7 @@ print_enabled_libraries() {
done

# THEN EXTERNAL LIBRARIES
for library in {0..31}
for library in {0..32}
do
if [[ ${ENABLED_LIBRARIES[$library]} -eq 1 ]]; then
if [[ ${enabled} -ge 1 ]]; then
Expand Down Expand Up @@ -554,7 +562,7 @@ build_application_mk() {
local LTS_BUILD_FLAG="-DMOBILE_FFMPEG_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 ]]; then
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 ]]; then
local APP_STL="c++_shared"
else
local APP_STL="none"
Expand Down Expand Up @@ -649,9 +657,9 @@ do
rebuild_library ${BUILD_LIBRARY}
;;
--full)
for library in {0..43}
for library in {0..45}
do
if [[ $library -ne 18 ]] && [[ $library -ne 19 ]] && [[ $library -ne 20 ]] && [[ $library -ne 21 ]]; then
if [[ $library -ne 18 ]] && [[ $library -ne 19 ]] && [[ $library -ne 20 ]] && [[ $library -ne 21 ]] && [[ $library -ne 22 ]]; then
enable_library $(get_library_name $library)
fi
done
Expand Down Expand Up @@ -728,7 +736,7 @@ print_reconfigure_requested_libraries
print_rebuild_requested_libraries

# CHECKING GPL LIBRARIES
for gpl_library in {18..21}
for gpl_library in {18,19,20,21,22}
do
if [[ ${ENABLED_LIBRARIES[$gpl_library]} -eq 1 ]]; then
library_name=$(get_library_name ${gpl_library})
Expand Down Expand Up @@ -769,7 +777,7 @@ do
. ${BASEDIR}/build/main-android.sh "${ENABLED_LIBRARIES[@]}" || exit 1

# CLEAR FLAGS
for library in {1..44}
for library in {1..46}
do
library_name=$(get_library_name $((library - 1)))
unset $(echo "OK_${library_name}" | sed "s/\-/\_/g")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ public class Config {
/* LOAD NOT-LOADED LIBRARIES ON API < 21 */
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.LOLLIPOP) {
final List<String> externalLibrariesEnabled = getExternalLibraries();
if (externalLibrariesEnabled.contains("tesseract") || externalLibrariesEnabled.contains("x265") || externalLibrariesEnabled.contains("snappy") || externalLibrariesEnabled.contains("openh264")) {
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");
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ class Packages {
supportedExternalLibraries.add("opencore-amr");
supportedExternalLibraries.add("openh264");
supportedExternalLibraries.add("opus");
supportedExternalLibraries.add("rubberband");
supportedExternalLibraries.add("sdl2");
supportedExternalLibraries.add("shine");
supportedExternalLibraries.add("snappy");
Expand Down
2 changes: 1 addition & 1 deletion build/android-chromaprint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ fi
# ENABLE COMMON FUNCTIONS
. ${BASEDIR}/build/android-common.sh

# PREPARING PATHS & DEFINING ${INSTALL_PKG_CONFIG_DIR}
# PREPARE PATHS & DEFINE ${INSTALL_PKG_CONFIG_DIR}
LIB_NAME="chromaprint"
set_toolchain_clang_paths ${LIB_NAME}

Expand Down
65 changes: 39 additions & 26 deletions build/android-common.sh
Original file line number Diff line number Diff line change
Expand Up @@ -40,28 +40,30 @@ get_library_name() {
19) echo "xvidcore" ;;
20) echo "x265" ;;
21) echo "libvidstab" ;;
22) echo "libilbc" ;;
23) echo "opus" ;;
24) echo "snappy" ;;
25) echo "soxr" ;;
26) echo "libaom" ;;
27) echo "chromaprint" ;;
28) echo "twolame" ;;
29) echo "sdl" ;;
30) echo "tesseract" ;;
31) echo "openh264" ;;
32) echo "giflib" ;;
33) echo "jpeg" ;;
34) echo "libogg" ;;
35) echo "libpng" ;;
36) echo "libuuid" ;;
37) echo "nettle" ;;
38) echo "tiff" ;;
39) echo "expat" ;;
40) echo "libsndfile" ;;
41) echo "leptonica" ;;
42) echo "android-zlib" ;;
43) echo "android-media-codec" ;;
22) echo "rubberband" ;;
23) echo "libilbc" ;;
24) echo "opus" ;;
25) echo "snappy" ;;
26) echo "soxr" ;;
27) echo "libaom" ;;
28) echo "chromaprint" ;;
29) echo "twolame" ;;
30) echo "sdl" ;;
31) echo "tesseract" ;;
32) echo "openh264" ;;
33) echo "giflib" ;;
34) echo "jpeg" ;;
35) echo "libogg" ;;
36) echo "libpng" ;;
37) echo "libuuid" ;;
38) echo "nettle" ;;
39) echo "tiff" ;;
40) echo "expat" ;;
41) echo "libsndfile" ;;
42) echo "leptonica" ;;
43) echo "libsamplerate" ;;
44) echo "android-zlib" ;;
45) echo "android-media-codec" ;;
esac
}

Expand Down Expand Up @@ -282,7 +284,6 @@ get_size_optimization_cflags() {
}

get_app_specific_cflags() {

local APP_FLAGS=""
case $1 in
xvidcore)
Expand All @@ -291,15 +292,18 @@ get_app_specific_cflags() {
ffmpeg)
APP_FLAGS="-Wno-unused-function -DBIONIC_IOCTL_NO_SIGNEDNESS_OVERLOAD"
;;
kvazaar)
APP_FLAGS="-std=gnu99 -Wno-unused-function"
;;
rubberband)
APP_FLAGS="-std=c99 -Wno-unused-function"
;;
shine)
APP_FLAGS="-Wno-unused-function"
;;
soxr | snappy | libwebp)
APP_FLAGS="-std=gnu99 -Wno-unused-function -DPIC"
;;
kvazaar)
APP_FLAGS="-std=gnu99 -Wno-unused-function"
;;
*)
APP_FLAGS="-std=c99 -Wno-unused-function"
;;
Expand Down Expand Up @@ -352,6 +356,9 @@ get_cxxflags() {
x265)
echo "-std=c++11 -fno-exceptions ${OPTIMIZATION_FLAGS}"
;;
rubberband)
echo "-std=c++11 ${OPTIMIZATION_FLAGS}"
;;
*)
echo "-std=c++11 -fno-exceptions -fno-rtti ${OPTIMIZATION_FLAGS}"
;;
Expand Down Expand Up @@ -930,6 +937,12 @@ download_gpl_library_source() {
GPL_LIB_ORIG_DIR="xvidcore"
GPL_LIB_DEST_DIR="xvidcore"
;;
rubberband)
GPL_LIB_URL="https://breakfastquay.com/files/releases/rubberband-1.8.2.tar.bz2"
GPL_LIB_FILE="rubberband-1.8.2.tar.bz2"
GPL_LIB_ORIG_DIR="rubberband-1.8.2"
GPL_LIB_DEST_DIR="rubberband"
;;
esac

local GPL_LIB_SOURCE_PATH="${BASEDIR}/src/${GPL_LIB_DEST_DIR}"
Expand Down
4 changes: 2 additions & 2 deletions build/android-expat.sh
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ fi
# ENABLE COMMON FUNCTIONS
. ${BASEDIR}/build/android-common.sh

# PREPARING PATHS & DEFINING ${INSTALL_PKG_CONFIG_DIR}
# PREPARE PATHS & DEFINE ${INSTALL_PKG_CONFIG_DIR}
LIB_NAME="expat"
set_toolchain_clang_paths ${LIB_NAME}

Expand All @@ -37,7 +37,7 @@ cd ${BASEDIR}/src/${LIB_NAME} || exit 1

make distclean 2>/dev/null 1>/dev/null

# RECONFIGURING IF REQUESTED
# RECONFIGURE IF REQUESTED
if [[ ${RECONF_expat} -eq 1 ]]; then
autoreconf_library ${LIB_NAME}
fi
Expand Down
13 changes: 9 additions & 4 deletions build/android-ffmpeg.sh
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ fi
# ENABLE COMMON FUNCTIONS
. ${BASEDIR}/build/android-common.sh

# PREPARING PATHS & DEFINING ${INSTALL_PKG_CONFIG_DIR}
# PREPARE PATHS & DEFINE ${INSTALL_PKG_CONFIG_DIR}
LIB_NAME="ffmpeg"
set_toolchain_clang_paths ${LIB_NAME}

Expand Down Expand Up @@ -76,7 +76,7 @@ esac
CONFIGURE_POSTFIX=""
HIGH_PRIORITY_INCLUDES=""

for library in {1..44}
for library in {1..46}
do
if [[ ${!library} -eq 1 ]]; then
ENABLED_LIBRARY=$(get_library_name $((library - 1)))
Expand Down Expand Up @@ -194,6 +194,11 @@ do
LDFLAGS+=" $(pkg-config --libs --static opus)"
CONFIGURE_POSTFIX+=" --enable-libopus"
;;
rubberband)
CFLAGS+=" $(pkg-config --cflags rubberband)"
LDFLAGS+=" $(pkg-config --libs --static rubberband)"
CONFIGURE_POSTFIX+=" --enable-librubberband --enable-gpl"
;;
shine)
CFLAGS+=" $(pkg-config --cflags shine)"
LDFLAGS+=" $(pkg-config --libs --static shine)"
Expand Down Expand Up @@ -285,9 +290,9 @@ do
else

# THE FOLLOWING LIBRARIES SHOULD BE EXPLICITLY DISABLED TO PREVENT AUTODETECT
if [[ ${library} -eq 30 ]]; then
if [[ ${library} -eq 31 ]]; then
CONFIGURE_POSTFIX+=" --disable-sdl2"
elif [[ ${library} -eq 43 ]]; then
elif [[ ${library} -eq 45 ]]; then
CONFIGURE_POSTFIX+=" --disable-zlib"
fi
fi
Expand Down
4 changes: 2 additions & 2 deletions build/android-fontconfig.sh
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ fi
# ENABLE COMMON FUNCTIONS
. ${BASEDIR}/build/android-common.sh

# PREPARING PATHS & DEFINING ${INSTALL_PKG_CONFIG_DIR}
# PREPARE PATHS & DEFINE ${INSTALL_PKG_CONFIG_DIR}
LIB_NAME="fontconfig"
set_toolchain_clang_paths ${LIB_NAME}

Expand All @@ -38,7 +38,7 @@ cd ${BASEDIR}/src/${LIB_NAME} || exit 1

make distclean 2>/dev/null 1>/dev/null

# RECONFIGURING IF REQUESTED
# RECONFIGURE IF REQUESTED
if [[ ${RECONF_fontconfig} -eq 1 ]]; then
autoreconf_library ${LIB_NAME}
fi
Expand Down
2 changes: 1 addition & 1 deletion build/android-freetype.sh
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ fi
# ENABLE COMMON FUNCTIONS
. ${BASEDIR}/build/android-common.sh

# PREPARING PATHS & DEFINING ${INSTALL_PKG_CONFIG_DIR}
# PREPARE PATHS & DEFINE ${INSTALL_PKG_CONFIG_DIR}
LIB_NAME="freetype"
set_toolchain_clang_paths ${LIB_NAME}

Expand Down
Loading

0 comments on commit 0baff68

Please sign in to comment.