-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit bc88e9e
Showing
5 changed files
with
280 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
#!/bin/bash | ||
set -eux | ||
|
||
echo "Build AV1" | ||
|
||
|
||
AV1_MODULE_PATH="${MEDIA3_PATH}/libraries/decoder_av1/src/main" | ||
GD_PATH="${MEDIA3_PATH}/libraries/decoder_av1/build.gradle" | ||
|
||
#Fetch cpu_features library: | ||
|
||
cd "${AV1_MODULE_PATH}/jni" | ||
git clone --depth=1 https://github.com/google/cpu_features | ||
|
||
#Fetch libgav1: | ||
cd "${AV1_MODULE_PATH}/jni" | ||
git clone --depth=1 https://chromium.googlesource.com/codecs/libgav1 | ||
|
||
#Fetch Abseil: | ||
cd "${AV1_MODULE_PATH}/jni/libgav1" && \ | ||
git clone https://github.com/abseil/abseil-cpp.git third_party/abseil-cpp | ||
|
||
cat "${GD_PATH}" | ||
|
||
echo " | ||
android { | ||
namespace 'androidx.media3.decoder.av1' | ||
publishing { | ||
singleVariant('release') { | ||
withSourcesJar() | ||
} | ||
} | ||
} | ||
ext { | ||
releaseArtifactId = 'media3-decode-av1' | ||
releaseName = 'Media3 av1 module' | ||
} | ||
apply from: '../../publish.gradle' | ||
">>"${GD_PATH}" | ||
|
||
cat "${GD_PATH}" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,123 @@ | ||
#!/bin/bash | ||
set -eux | ||
|
||
echo "Build FFmpeg" | ||
echo $ANDROID_NDK_HOME | ||
echo $NDK_PATH | ||
|
||
FFMPEG_MODULE_PATH="${MEDIA3_PATH}/libraries/decoder_ffmpeg/src/main" | ||
GD_PATH="${MEDIA3_PATH}/libraries/decoder_ffmpeg/build.gradle" | ||
|
||
cat "${GD_PATH}" | ||
|
||
echo " | ||
android { | ||
namespace 'androidx.media3.decoder.ffmpeg' | ||
publishing { | ||
singleVariant('release') { | ||
withSourcesJar() | ||
} | ||
} | ||
} | ||
ext { | ||
releaseArtifactId = 'media3-decode-ffmpeg' | ||
releaseName = 'Media3 ffmpeg module' | ||
} | ||
apply from: '../../publish.gradle' | ||
">>"${GD_PATH}" | ||
|
||
cat "${GD_PATH}" | ||
|
||
|
||
|
||
HOST_PLATFORM="linux-x86_64" | ||
ENABLED_DECODERS=(vorbis opus flac alac pcm_mulaw pcm_alaw mp3 aac ac3 eac3 dca mlp truehd) | ||
|
||
cd "${FFMPEG_MODULE_PATH}/jni" | ||
|
||
git clone --depth=1 -b release/4.2 git://source.ffmpeg.org/ffmpeg | ||
cd ffmpeg | ||
FFMPEG_PATH="$(pwd)" | ||
pwd | ||
JOBS=$(nproc 2> /dev/null || sysctl -n hw.ncpu 2> /dev/null || echo 4) | ||
echo "Using $JOBS jobs for make" | ||
COMMON_OPTIONS=" | ||
--target-os=android | ||
--enable-static | ||
--disable-shared | ||
--disable-doc | ||
--disable-programs | ||
--disable-everything | ||
--disable-avdevice | ||
--disable-avformat | ||
--disable-swscale | ||
--disable-postproc | ||
--disable-avfilter | ||
--disable-symver | ||
--disable-avresample | ||
--enable-swresample | ||
--extra-ldexeflags=-pie | ||
" | ||
TOOLCHAIN_PREFIX="${NDK_PATH}/toolchains/llvm/prebuilt/${HOST_PLATFORM}/bin" | ||
for decoder in "${ENABLED_DECODERS[@]}" | ||
do | ||
COMMON_OPTIONS="${COMMON_OPTIONS} --enable-decoder=${decoder}" | ||
done | ||
cd "${FFMPEG_PATH}" | ||
./configure \ | ||
--libdir=android-libs/armeabi-v7a \ | ||
--arch=arm \ | ||
--cpu=armv7-a \ | ||
--cross-prefix="${TOOLCHAIN_PREFIX}/armv7a-linux-androideabi16-" \ | ||
--nm="${TOOLCHAIN_PREFIX}/llvm-nm" \ | ||
--ar="${TOOLCHAIN_PREFIX}/llvm-ar" \ | ||
--ranlib="${TOOLCHAIN_PREFIX}/llvm-ranlib" \ | ||
--strip="${TOOLCHAIN_PREFIX}/llvm-strip" \ | ||
--extra-cflags="-march=armv7-a -mfloat-abi=softfp" \ | ||
--extra-ldflags="-Wl,--fix-cortex-a8" \ | ||
${COMMON_OPTIONS} | ||
make -j$JOBS | ||
make install-libs | ||
make clean | ||
./configure \ | ||
--libdir=android-libs/arm64-v8a \ | ||
--arch=aarch64 \ | ||
--cpu=armv8-a \ | ||
--cross-prefix="${TOOLCHAIN_PREFIX}/aarch64-linux-android21-" \ | ||
--nm="${TOOLCHAIN_PREFIX}/llvm-nm" \ | ||
--ar="${TOOLCHAIN_PREFIX}/llvm-ar" \ | ||
--ranlib="${TOOLCHAIN_PREFIX}/llvm-ranlib" \ | ||
--strip="${TOOLCHAIN_PREFIX}/llvm-strip" \ | ||
${COMMON_OPTIONS} | ||
make -j$JOBS | ||
make install-libs | ||
make clean | ||
./configure \ | ||
--libdir=android-libs/x86 \ | ||
--arch=x86 \ | ||
--cpu=i686 \ | ||
--cross-prefix="${TOOLCHAIN_PREFIX}/i686-linux-android16-" \ | ||
--nm="${TOOLCHAIN_PREFIX}/llvm-nm" \ | ||
--ar="${TOOLCHAIN_PREFIX}/llvm-ar" \ | ||
--ranlib="${TOOLCHAIN_PREFIX}/llvm-ranlib" \ | ||
--strip="${TOOLCHAIN_PREFIX}/llvm-strip" \ | ||
--disable-asm \ | ||
${COMMON_OPTIONS} | ||
make -j$JOBS | ||
make install-libs | ||
make clean | ||
./configure \ | ||
--libdir=android-libs/x86_64 \ | ||
--arch=x86_64 \ | ||
--cpu=x86_64 \ | ||
--cross-prefix="${TOOLCHAIN_PREFIX}/x86_64-linux-android21-" \ | ||
--nm="${TOOLCHAIN_PREFIX}/llvm-nm" \ | ||
--ar="${TOOLCHAIN_PREFIX}/llvm-ar" \ | ||
--ranlib="${TOOLCHAIN_PREFIX}/llvm-ranlib" \ | ||
--strip="${TOOLCHAIN_PREFIX}/llvm-strip" \ | ||
--disable-asm \ | ||
${COMMON_OPTIONS} | ||
make -j$JOBS | ||
make install-libs | ||
make clean |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
#!/bin/bash | ||
set -eux | ||
|
||
echo $ANDROID_NDK_HOME | ||
echo $NDK_PATH | ||
|
||
chmod +x ${ROOT_DIR}/.github/scripts/build-ffmpeg.sh | ||
chmod +x ${ROOT_DIR}/.github/scripts/build-av1.sh | ||
|
||
git clone --depth=1 -b release https://github.com/androidx/media | ||
cd media | ||
export MEDIA3_PATH="$(pwd)" | ||
|
||
|
||
${ROOT_DIR}/.github/scripts/build-ffmpeg.sh | ||
${ROOT_DIR}/.github/scripts/build-av1.sh | ||
cd ${MEDIA3_PATH} | ||
./gradlew publishToMavenLocal | ||
|
||
|
||
cd ${ROOT_DIR} | ||
mkdir -p repo | ||
mv ~/.m2/repository/* repo | ||
git add repo/** |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,90 @@ | ||
# This is a basic workflow to help you get started with Actions | ||
|
||
name: CI | ||
|
||
# Controls when the workflow will run | ||
on: | ||
# Triggers the workflow on push or pull request events but only for the "main" branch | ||
push: | ||
branches: [ "main" ] | ||
pull_request: | ||
branches: [ "main" ] | ||
|
||
# Allows you to run this workflow manually from the Actions tab | ||
workflow_dispatch: | ||
|
||
# A workflow run is made up of one or more jobs that can run sequentially or in parallel | ||
jobs: | ||
# This workflow contains a single job called "build" | ||
build: | ||
# The type of runner that the job will run on | ||
runs-on: ubuntu-latest | ||
|
||
# Steps represent a sequence of tasks that will be executed as part of the job | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v4 | ||
with: | ||
fetch-depth: 1 | ||
- uses: actions/setup-java@v4 | ||
with: | ||
distribution: temurin | ||
java-version: 17 | ||
|
||
- name: Set up Gradle | ||
uses: gradle/gradle-build-action@v2 | ||
|
||
|
||
# Set up NDK | ||
- uses: nttld/setup-ndk@v1 | ||
id: setup-ndk | ||
with: | ||
ndk-version: r21e | ||
local-cache: true | ||
add-to-path: true | ||
# Build FFmpeg | ||
- name: Build FFmpeg | ||
env: | ||
ANDROID_NDK_HOME: ${{steps.setup-ndk.outputs.ndk-path }} | ||
NDK_PATH: ${{ steps.setup-ndk.outputs.ndk-path }} | ||
ROOT_DIR: ${{ github.workspace }} | ||
run: | | ||
echo "build ffmpeg" | ||
source ${{ github.workspace }}/.github/scripts/build.sh | ||
cd ${{ github.workspace }}/media | ||
./gradlew publishToMavenLocal | ||
echo "Build Success" | ||
# Runs a set of commands using the runners shell | ||
- name: Upload FFmpeg Static Libs | ||
uses: actions/upload-artifact@v3 | ||
with: | ||
name: "ffmpeg" | ||
path: ${{ github.workspace }}/media/libraries/decoder_ffmpeg/src/main/jni/ffmpeg/android-libs | ||
|
||
- name: Upload library | ||
uses: actions/upload-artifact@v3 | ||
with: | ||
name: aar-library | ||
path: ~/.m2 | ||
- name: Create Pull Request | ||
uses: peter-evans/create-pull-request@v5 | ||
continue-on-error: true | ||
with: | ||
token: ${{ secrets.GITHUB_TOKEN }} | ||
branch: repo | ||
commit-message: build aar | ||
title: Automated Build | ||
body: This is an auto-generated PR . | ||
delete-branch: true | ||
add-paths: | | ||
**.aar | ||
**.jar | ||
repo/** | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
# media3libs |