mirror of
https://github.com/JustinZeus/Wholphin.git
synced 2026-07-08 15:50:16 +02:00
Add optional AV1 software decoding via dav1d for ExoPlayer (#721)
## Description Adds the [`dav1d` decoder module](https://github.com/androidx/media/tree/release/libraries/decoder_av1) for ExoPlayer as an option. It can be enabled in advanced settings. Performance will vary between devices. ### Related issues Closes #103 ### Dev notes As with the ffmpeg module, this one is not required to build the entire app so it's easier for developers to get started. This also introduces a customized `DefaultRenderersFactory` for ExoPlayer, but its largely copied from the super class's implementation.
This commit is contained in:
parent
a0329b2c1d
commit
4dd44b935c
9 changed files with 170 additions and 36 deletions
|
|
@ -15,6 +15,7 @@ PROJECT_ROOT="$(realpath "${SCRIPT_DIR}/../../")"
|
|||
ANDROID_ABI=21
|
||||
ENABLED_DECODERS=(dca ac3 eac3 mlp truehd flac alac pcm_mulaw pcm_alaw mp3)
|
||||
FFMPEG_BRANCH="release/6.0"
|
||||
DAV1D_BRANCH="1.5.3"
|
||||
|
||||
# Path configs
|
||||
DIR_PATH="$(pwd)"
|
||||
|
|
@ -22,6 +23,7 @@ TARGET_PATH="$PROJECT_ROOT/app/libs"
|
|||
MEDIA_PATH="$DIR_PATH/ffmpeg_decoder/media"
|
||||
FFMPEG_MODULE_PATH="$MEDIA_PATH/libraries/decoder_ffmpeg/src/main"
|
||||
FFMPEG_PATH="$DIR_PATH/ffmpeg_decoder/ffmpeg"
|
||||
AV1_MODULE_PATH="$MEDIA_PATH/libraries/decoder_av1/src/main"
|
||||
HOST="$(uname -s | tr '[:upper:]' '[:lower:]')"
|
||||
HOST_PLATFORM="$HOST-x86_64"
|
||||
|
||||
|
|
@ -48,16 +50,39 @@ else
|
|||
git clone https://github.com/FFmpeg/FFmpeg --depth 1 --single-branch -b "$FFMPEG_BRANCH" ffmpeg
|
||||
fi
|
||||
|
||||
ln -s "$FFMPEG_PATH" "${FFMPEG_MODULE_PATH}/jni/ffmpeg"
|
||||
[[ ! -d "${FFMPEG_MODULE_PATH}/jni/ffmpeg" ]] && ln -s "$FFMPEG_PATH" "${FFMPEG_MODULE_PATH}/jni/ffmpeg"
|
||||
|
||||
pushd "${FFMPEG_MODULE_PATH}/jni" || exit
|
||||
|
||||
./build_ffmpeg.sh "${FFMPEG_MODULE_PATH}" "${NDK_PATH}" "${HOST_PLATFORM}" "${ANDROID_ABI}" "${ENABLED_DECODERS[@]}"
|
||||
|
||||
# av1 module
|
||||
|
||||
pushd "$AV1_MODULE_PATH/jni" || exit
|
||||
|
||||
if [[ ! -d cpu_features ]]; then
|
||||
git clone https://github.com/google/cpu_features --depth 1 --single-branch cpu_features
|
||||
fi
|
||||
|
||||
pushd "$AV1_MODULE_PATH/jni" || exit
|
||||
|
||||
if [[ -d dav1d ]]; then
|
||||
pushd dav1d || exit
|
||||
git checkout --force "$DAV1D_BRANCH"
|
||||
else
|
||||
git clone https://code.videolan.org/videolan/dav1d --depth 1 --single-branch -b "$DAV1D_BRANCH" dav1d
|
||||
fi
|
||||
|
||||
pushd "$AV1_MODULE_PATH/jni" || exit
|
||||
|
||||
/usr/bin/env bash ./build_dav1d.sh "${AV1_MODULE_PATH}" "${NDK_PATH}" "${HOST_PLATFORM}"
|
||||
|
||||
|
||||
pushd "$MEDIA_PATH" || exit
|
||||
./gradlew :lib-decoder-ffmpeg:assemble
|
||||
./gradlew :lib-decoder-ffmpeg:assemble :lib-decoder-av1:assemble
|
||||
popd || exit
|
||||
|
||||
popd || exit
|
||||
cp "$MEDIA_PATH/libraries/decoder_ffmpeg/buildout/outputs/aar/lib-decoder-ffmpeg-release.aar" "$TARGET_PATH/"
|
||||
cp "$MEDIA_PATH/libraries/decoder_av1/buildout/outputs/aar/lib-decoder-av1-release.aar" "$TARGET_PATH/"
|
||||
popd || exit
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue