Skip to content

Commit

Permalink
Merge branch 'master' into media-file
Browse files Browse the repository at this point in the history
# Conflicts:
#	.github/workflows/compilability_check.yml
  • Loading branch information
Javernaut committed Nov 11, 2023
2 parents f089f96 + ec66186 commit f2d0404
Show file tree
Hide file tree
Showing 10 changed files with 68 additions and 11 deletions.
6 changes: 3 additions & 3 deletions .github/workflows/compilability_check.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
name: Compilability check
on: [push, pull_request]
on: [ push, pull_request ]
jobs:
build:
runs-on: ubuntu-22.04
Expand All @@ -18,5 +18,5 @@ jobs:
- name: Executing the script
run: |
export ANDROID_SDK_HOME=$ANDROID_HOME
export ANDROID_NDK_HOME=$ANDROID_NDK
./ffmpeg-android-maker.sh -dav1d -android=19 -abis=${{ matrix.abi }}
export ANDROID_NDK_HOME=$ANDROID_NDK_LATEST_HOME
./ffmpeg-android-maker.sh -dav1d -abis=${{ matrix.abi }}
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ The script also produces `ffmpeg` and `ffprobe` executables that can be used in

The main focus of ffmpeg-android-maker is to prepare shared libraries for seamless integration into an Android project. The script prepares the `output` directory that is meant to be used. And it's not the only thing this project does.

By default this script downloads and builds the FFmpeg **6.0**, but the version can be overridden.
By default this script downloads and builds the FFmpeg **6.1**, but the version can be overridden.

The details of how this script is implemented are described in this series of posts:
* [Part 1](https://proandroiddev.com/a-story-about-ffmpeg-in-android-part-i-compilation-898e4a249422)
Expand Down
2 changes: 1 addition & 1 deletion scripts/libfreetype/download.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,4 @@ FREETYPE_VERSION=2.13.2

downloadTarArchive \
"libfreetype" \
"https://nav.dl.sourceforge.net/project/freetype/freetype2/${FREETYPE_VERSION}/freetype-${FREETYPE_VERSION}.tar.gz"
"https://download.savannah.gnu.org/releases/freetype/freetype-${FREETYPE_VERSION}.tar.gz"
38 changes: 38 additions & 0 deletions scripts/libx265/build.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
#!/usr/bin/env bash

# libaom doesn't support building while being in its root directory
CMAKE_BUILD_DIR=libx265_build_${ANDROID_ABI}
rm -rf ${CMAKE_BUILD_DIR}
mkdir ${CMAKE_BUILD_DIR}
cd ${CMAKE_BUILD_DIR}

EXTRA_CMAKE_ARG=""
case $ANDROID_ABI in
arm64-v8a|x86)
# Disabling assembler optimizations for certain ABIs. Not a good solution, but it at least works
EXTRA_CMAKE_ARG="-DENABLE_ASSEMBLY=OFF"
;;
esac

${CMAKE_EXECUTABLE} ../source \
-DANDROID_PLATFORM=${ANDROID_PLATFORM} \
-DANDROID_ABI=${ANDROID_ABI} \
-DCMAKE_TOOLCHAIN_FILE=${ANDROID_NDK_HOME}/build/cmake/android.toolchain.cmake \
-DCMAKE_INSTALL_PREFIX=${INSTALL_DIR} \
-DENABLE_PIC=ON \
-DENABLE_SHARED=OFF \
-DENABLE_CLI=OFF \
$EXTRA_CMAKE_ARG

EXTRA_SED_ARG=""
if [[ "$OSTYPE" == "darwin"* ]]; then
EXTRA_SED_ARG="''"
fi
sed -i $EXTRA_SED_ARG 's/-lpthread/-pthread/' CMakeFiles/cli.dir/link.txt
sed -i $EXTRA_SED_ARG 's/-lpthread/-pthread/' CMakeFiles/x265-shared.dir/link.txt
sed -i $EXTRA_SED_ARG 's/-lpthread/-pthread/' CMakeFiles/x265-static.dir/link.txt

export FFMPEG_EXTRA_LD_FLAGS="${FFMPEG_EXTRA_LD_FLAGS} -lm -lc++"

${MAKE_EXECUTABLE} -j${HOST_NPROC}
${MAKE_EXECUTABLE} install
9 changes: 9 additions & 0 deletions scripts/libx265/download.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
#!/usr/bin/env bash

source ${SCRIPTS_DIR}/common-functions.sh

LIBX265_VERSION=3.5

downloadTarArchive \
"libx265" \
"https://bitbucket.org/multicoreware/x265_git/downloads/x265_${LIBX265_VERSION}.tar.gz"
5 changes: 5 additions & 0 deletions scripts/mbedtls/android.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
include("$ENV{ANDROID_NDK_HOME}/build/cmake/android.toolchain.cmake")

if("${CMAKE_SYSTEM_PROCESSOR}" STREQUAL "i686")
set(CMAKE_C_FLAGS "-mpclmul -msse2 -maes")
endif()
2 changes: 1 addition & 1 deletion scripts/mbedtls/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ cd ${CMAKE_BUILD_DIR}
${CMAKE_EXECUTABLE} .. \
-DANDROID_PLATFORM=${ANDROID_PLATFORM} \
-DANDROID_ABI=${ANDROID_ABI} \
-DCMAKE_TOOLCHAIN_FILE=${ANDROID_NDK_HOME}/build/cmake/android.toolchain.cmake \
-DCMAKE_TOOLCHAIN_FILE=${SCRIPTS_DIR}/mbedtls/android.cmake \
-DCMAKE_INSTALL_PREFIX=${INSTALL_DIR} \
-DENABLE_TESTING=0

Expand Down
2 changes: 1 addition & 1 deletion scripts/mbedtls/download.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

source ${SCRIPTS_DIR}/common-functions.sh

export MBEDTLS_VERSION=3.4.1
export MBEDTLS_VERSION=3.5.1
downloadTarArchive \
"mbedtls" \
"https://github.com/Mbed-TLS/mbedtls/archive/refs/tags/v${MBEDTLS_VERSION}.tar.gz" \
Expand Down
9 changes: 7 additions & 2 deletions scripts/parse-arguments.sh
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@
# Can be overridden with specific arguments.
# See the end of this file for more description.
ABIS_TO_BUILD=()
API_LEVEL=19
API_LEVEL=21
SOURCE_TYPE=TAR
SOURCE_VALUE=6.0
SOURCE_VALUE=6.1
EXTERNAL_LIBRARIES=()
FFMPEG_GPL_ENABLED=false

Expand All @@ -32,6 +32,7 @@ SUPPORTED_LIBRARIES_FREE=(
# All GPL libraries that are supported
SUPPORTED_LIBRARIES_GPL=(
"libx264"
"libx265"
)

for argument in "$@"; do
Expand Down Expand Up @@ -113,6 +114,10 @@ for argument in "$@"; do
EXTERNAL_LIBRARIES+=("libx264")
FFMPEG_GPL_ENABLED=true
;;
--enable-libx265 | -x265)
EXTERNAL_LIBRARIES+=("libx265")
FFMPEG_GPL_ENABLED=true
;;
--enable-mbedtls | -mbedtls)
EXTERNAL_LIBRARIES+=("mbedtls")
;;
Expand Down
4 changes: 2 additions & 2 deletions tools/docker/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ FROM --platform=linux/amd64 ubuntu:22.04
# Arguments that can be overridden in 'docker build' command:
# Versions of Android SDK and NDK. The CMake is installed via NDK.
ARG VERSION_SDK=10406996
ARG VERSION_NDK=25.2.9519653
ARG VERSION_NDK=26.1.10909125
ARG VERSION_CMAKE=3.22.1

# Package to install via pip3
Expand All @@ -25,7 +25,7 @@ RUN apt-get --allow-releaseinfo-change update && apt-get install -y --no-install
python3-wheel \
ninja-build \
build-essential \
openjdk-8-jdk-headless \
openjdk-17-jdk-headless \
curl \
unzip \
bash \
Expand Down

0 comments on commit f2d0404

Please sign in to comment.