mirror of
https://github.com/JustinZeus/Wholphin.git
synced 2026-07-08 15:50:16 +02:00
Add experimental MPV player backend (#161)
Experimental MPV player backend Related to #14, #22, & #85 You can switch to MPV in advanced settings and toggle using hardware decoding or not. This uses code and buildscripts from https://github.com/mpv-android/mpv-android, plus other third party libraries to build MPV
This commit is contained in:
parent
d7b333e519
commit
6be2662d4e
84 changed files with 3987 additions and 289 deletions
79
.github/actions/native-build/action.yml
vendored
Normal file
79
.github/actions/native-build/action.yml
vendored
Normal file
|
|
@ -0,0 +1,79 @@
|
|||
name: "Native build"
|
||||
description: "Performs native builds"
|
||||
inputs:
|
||||
cache:
|
||||
description: "Whether to use the cache or not"
|
||||
required: true
|
||||
runs:
|
||||
using: "composite"
|
||||
steps:
|
||||
- name: Load ffmpeg module cache
|
||||
id: cache_ffmpeg_module
|
||||
if: ${{ inputs.cache }}
|
||||
uses: actions/cache/restore@v4
|
||||
with:
|
||||
path: |
|
||||
app/libs
|
||||
key: ${{ runner.os }}-ffmpeg-${{ hashFiles('**/libs.versions.toml', '**/scripts/ffmpeg/build_ffmpeg_decoder.sh') }}
|
||||
- name: Build ffmpeg decoder
|
||||
id: ffmpeg-decoder
|
||||
if: steps.cache_ffmpeg_module.outputs.cache-hit != 'true'
|
||||
shell: bash
|
||||
run: |
|
||||
cd scripts/ffmpeg
|
||||
./build_ffmpeg_decoder.sh "${{ env.ANDROID_SDK_ROOT }}/ndk/${{ env.NDK_VERSION }}"
|
||||
- name: Save ffmpeg module cache
|
||||
id: cache_ffmpeg_module_save
|
||||
uses: actions/cache/save@v4
|
||||
with:
|
||||
path: |
|
||||
app/libs
|
||||
key: ${{ steps.cache_ffmpeg_module.outputs.cache-primary-key }}
|
||||
|
||||
- name: Load libmpv module cache
|
||||
id: cache_libmpv_module
|
||||
if: ${{ inputs.cache }}
|
||||
uses: actions/cache/restore@v4
|
||||
with:
|
||||
path: |
|
||||
app/src/main/libs
|
||||
key: ${{ runner.os }}-libmpv-${{ hashFiles('**/scripts/mpv/*.sh', '**/scripts/mpv/include/*', '**/scripts/mpv/scripts/*', 'app/src/main/jni/*') }}
|
||||
|
||||
- name: Install dependencies
|
||||
if: steps.cache_libmpv_module.outputs.cache-hit != 'true'
|
||||
shell: bash
|
||||
run: |
|
||||
python -m pip install --upgrade pip
|
||||
pip install jsonschema jinja2
|
||||
sudo apt update
|
||||
sudo apt install -y build-essential autoconf pkg-config libtool ninja-build unzip wget meson
|
||||
- name: Get libmpv dependencies
|
||||
if: steps.cache_libmpv_module.outputs.cache-hit != 'true'
|
||||
shell: bash
|
||||
run: |
|
||||
cd scripts/mpv
|
||||
./get_dependencies.sh
|
||||
- name: Build libmpv dependencies
|
||||
if: steps.cache_libmpv_module.outputs.cache-hit != 'true'
|
||||
shell: bash
|
||||
run: |
|
||||
cd scripts/mpv
|
||||
./buildall.sh --clean --arch arm64 mpv
|
||||
./buildall.sh mpv
|
||||
cd ../..
|
||||
env PREFIX32="$(realpath scripts/mpv/prefix/armv7l)" PREFIX64="$(realpath scripts/mpv/prefix/arm64)" ndk-build -C app/src/main -j
|
||||
|
||||
- name: Setup jniLibs
|
||||
shell: bash
|
||||
run: |
|
||||
cd app/src/main
|
||||
mkdir -p jniLibs
|
||||
cp -r libs/* jniLibs
|
||||
#ln -s libs jniLibs
|
||||
- name: Save libmpv module cache
|
||||
id: cache_libmpv_module_save
|
||||
uses: actions/cache/save@v4
|
||||
with:
|
||||
path: |
|
||||
app/src/main/libs
|
||||
key: ${{ steps.cache_libmpv_module.outputs.cache-primary-key }}
|
||||
31
.github/actions/setup/action.yml
vendored
Normal file
31
.github/actions/setup/action.yml
vendored
Normal file
|
|
@ -0,0 +1,31 @@
|
|||
name: Setup
|
||||
description: "Setup the environment"
|
||||
|
||||
runs:
|
||||
using: "composite"
|
||||
steps:
|
||||
# Setup the SDKs
|
||||
- name: Set up Python
|
||||
uses: actions/setup-python@v5
|
||||
with:
|
||||
python-version: '3.12'
|
||||
- name: Setup JDK
|
||||
uses: actions/setup-java@v5
|
||||
with:
|
||||
distribution: zulu
|
||||
java-version: '21'
|
||||
cache: 'gradle'
|
||||
- name: Set versions
|
||||
shell: bash
|
||||
run: |
|
||||
echo "BUILD_TOOLS_VERSION=36.0.0" >> $GITHUB_ENV
|
||||
echo "NDK_VERSION=29.0.14206865" >> $GITHUB_ENV
|
||||
- name: Setup Android SDK
|
||||
uses: android-actions/setup-android@v3
|
||||
with:
|
||||
packages: "tools platform-tools build-tools;${{ env.BUILD_TOOLS_VERSION }} ndk;${{ env.NDK_VERSION }}"
|
||||
- name: Add NDK to path
|
||||
shell: bash
|
||||
run: |
|
||||
echo "Adding to path: ${{ env.ANDROID_SDK_ROOT }}/ndk/${{ env.NDK_VERSION }}:${{ env.ANDROID_SDK_ROOT }}/ndk/${{ env.NDK_VERSION }}/toolchains/llvm/prebuilt/linux-x86_64/bin"
|
||||
echo "${{ env.ANDROID_SDK_ROOT }}/ndk/${{ env.NDK_VERSION }}:${{ env.ANDROID_SDK_ROOT }}/ndk/${{ env.NDK_VERSION }}/toolchains/llvm/prebuilt/linux-x86_64/bin" >> $GITHUB_PATH
|
||||
68
.github/workflows/main.yml
vendored
68
.github/workflows/main.yml
vendored
|
|
@ -15,11 +15,7 @@ concurrency:
|
|||
cancel-in-progress: true
|
||||
|
||||
env:
|
||||
APK_SHORT_NAME: Wholphin-release.apk
|
||||
APK_DEBUG_SHORT_NAME: Wholphin-debug.apk
|
||||
BRANCH_NAME: ${{ github.ref_name }}
|
||||
BUILD_TOOLS_VERSION: 36.0.0
|
||||
NDK_VERSION: "29.0.14206865"
|
||||
|
||||
jobs:
|
||||
build:
|
||||
|
|
@ -31,17 +27,12 @@ jobs:
|
|||
uses: actions/checkout@v5
|
||||
with:
|
||||
fetch-depth: 0 # Need the tags to build
|
||||
# Setup the SDKs
|
||||
- name: Setup JDK
|
||||
uses: actions/setup-java@v5
|
||||
- name: Setup
|
||||
uses: ./.github/actions/setup
|
||||
- name: Native build
|
||||
uses: ./.github/actions/native-build
|
||||
with:
|
||||
distribution: zulu
|
||||
java-version: '21'
|
||||
cache: 'gradle'
|
||||
- name: Setup Android SDK
|
||||
uses: android-actions/setup-android@v3
|
||||
with:
|
||||
packages: "tools platform-tools build-tools;${{ env.BUILD_TOOLS_VERSION }} ndk;${{ env.NDK_VERSION }}"
|
||||
cache: true
|
||||
|
||||
- name: Get version names
|
||||
run: |
|
||||
|
|
@ -56,25 +47,6 @@ jobs:
|
|||
echo "LATEST_TAG=$LATEST_TAG" >> "$GITHUB_ENV"
|
||||
echo "VERSION_NAME=$VERSION_NAME" >> "$GITHUB_ENV"
|
||||
echo "TAG_NAME=$TAG_NAME" >> "$GITHUB_ENV"
|
||||
- name: Load ffmpeg module cache
|
||||
id: cache_ffmpeg_module
|
||||
uses: actions/cache/restore@v4
|
||||
with:
|
||||
path: |
|
||||
app/libs
|
||||
key: ${{ runner.os }}-ffmpeg-${{ hashFiles('**/libs.versions.toml', '**/build_ffmpeg_decoder.sh') }}
|
||||
- name: Build ffmpeg decoder
|
||||
id: ffmpeg-decoder
|
||||
if: steps.cache_ffmpeg_module.outputs.cache-hit != 'true'
|
||||
run: |
|
||||
./build_ffmpeg_decoder.sh "${{ env.ANDROID_SDK_ROOT }}/ndk/${{ env.NDK_VERSION }}"
|
||||
- name: Save ffmpeg module cache
|
||||
id: cache_ffmpeg_module_save
|
||||
uses: actions/cache/save@v4
|
||||
with:
|
||||
path: |
|
||||
app/libs
|
||||
key: ${{ steps.cache_ffmpeg_module.outputs.cache-primary-key }}
|
||||
- name: Build release app
|
||||
id: build
|
||||
env:
|
||||
|
|
@ -84,23 +56,27 @@ jobs:
|
|||
SIGNING_KEY: "${{ secrets.SIGNING_KEY }}"
|
||||
run: |
|
||||
./gradlew clean assembleRelease assembleDebug
|
||||
echo "apk=$(ls app/build/outputs/apk/release/Wholphin-release*.apk)" >> "$GITHUB_OUTPUT"
|
||||
echo "apk_debug=$(ls app/build/outputs/apk/debug/Wholphin-debug*.apk)" >> "$GITHUB_OUTPUT"
|
||||
- name: Verify signature
|
||||
- name: Verify signatures
|
||||
run: |
|
||||
echo "Verify release APK"
|
||||
${{env.ANDROID_SDK_ROOT}}/build-tools/${{ env.BUILD_TOOLS_VERSION }}/apksigner verify --verbose --print-certs "${{ steps.build.outputs.apk }}"
|
||||
echo "Verify debug APK"
|
||||
${{env.ANDROID_SDK_ROOT}}/build-tools/${{ env.BUILD_TOOLS_VERSION }}/apksigner verify --verbose --print-certs "${{ steps.build.outputs.apk_debug }}"
|
||||
- name: Copy APK to ${{ env.APK_SHORT_NAME }}
|
||||
echo "Verify APK signatures"
|
||||
find app/build/outputs/apk -name '*.apk'
|
||||
find app/build/outputs/apk -name '*.apk' -print0 | xargs -t -0 -n1 ${{env.ANDROID_SDK_ROOT}}/build-tools/${{ env.BUILD_TOOLS_VERSION }}/apksigner verify --verbose --print-certs
|
||||
- name: Copy APK to shorter names
|
||||
id: apks
|
||||
run: |
|
||||
cp "${{ steps.build.outputs.apk }}" "${{ env.APK_SHORT_NAME }}"
|
||||
cp "${{ steps.build.outputs.apk_debug }}" "${{ env.APK_DEBUG_SHORT_NAME }}"
|
||||
find app/build/outputs/apk -name '*.apk' -print0 |
|
||||
while IFS= read -r -d '' line; do
|
||||
# Wholphin-release-0.2.9-62-g5c12e03-16-arm64-v8a.apk => Wholphin-arm64-v8a.apk
|
||||
short_name="$(echo $line | sed -E 's/-[0-9]+\.[0-9]+\.[0-9]+-[0-9]+-g[a-fA-F0-9]+-[0-9]+//')"
|
||||
echo "$line => $short_name"
|
||||
cp "$line" "$short_name"
|
||||
done
|
||||
apks=$(find app/build/outputs/apk -name '*.apk' -print0 | tr '\0' ',' | sed 's/,$//')
|
||||
echo "apks=$apks" >> "$GITHUB_OUTPUT"
|
||||
- name: Checksums
|
||||
run: |
|
||||
echo "SHA256 checksums:"
|
||||
sha256sum "${{ steps.build.outputs.apk }}" "${{ env.APK_SHORT_NAME }}"
|
||||
sha256sum "${{ steps.build.outputs.apk_debug }}" "${{ env.APK_DEBUG_SHORT_NAME }}"
|
||||
find app/build/outputs/apk -name '*.apk' -print0 | xargs -0 sha256sum
|
||||
- name: Delete ${{ env.TAG_NAME }} tag and release
|
||||
uses: dev-drprasad/delete-tag-and-release@v1.1
|
||||
with:
|
||||
|
|
@ -125,7 +101,7 @@ jobs:
|
|||
with:
|
||||
allowUpdates: true
|
||||
artifactErrorsFailBuild: true
|
||||
artifacts: "${{ steps.build.outputs.apk_debug }},${{ steps.build.outputs.apk }},${{ env.APK_DEBUG_SHORT_NAME }},${{ env.APK_SHORT_NAME }}"
|
||||
artifacts: "${{ steps.apks.outputs.apks }}"
|
||||
draft: false
|
||||
generateReleaseNotes: false
|
||||
makeLatest: false
|
||||
|
|
|
|||
49
.github/workflows/pr.yml
vendored
49
.github/workflows/pr.yml
vendored
|
|
@ -8,10 +8,7 @@ defaults:
|
|||
shell: bash
|
||||
|
||||
env:
|
||||
BUILD_TOOLS_VERSION: 36.0.0
|
||||
BUILD_DIRS_ARTIFACT: build-dirs
|
||||
NDK_VERSION: "29.0.14206865"
|
||||
|
||||
|
||||
jobs:
|
||||
pre-commit:
|
||||
|
|
@ -36,45 +33,21 @@ jobs:
|
|||
uses: actions/checkout@v5
|
||||
with:
|
||||
fetch-depth: 0 # Need the tags to build
|
||||
- name: Setup JDK
|
||||
uses: actions/setup-java@v5
|
||||
- name: Setup
|
||||
uses: ./.github/actions/setup
|
||||
- name: Native build
|
||||
uses: ./.github/actions/native-build
|
||||
with:
|
||||
distribution: zulu
|
||||
java-version: '21'
|
||||
cache: 'gradle'
|
||||
- name: Setup Android SDK
|
||||
uses: android-actions/setup-android@v3
|
||||
with:
|
||||
packages: "tools platform-tools build-tools;${{ env.BUILD_TOOLS_VERSION }} ndk;${{ env.NDK_VERSION }}"
|
||||
|
||||
- name: Load ffmpeg module cache
|
||||
id: cache_ffmpeg_module
|
||||
uses: actions/cache/restore@v4
|
||||
with:
|
||||
path: |
|
||||
app/libs
|
||||
key: ${{ runner.os }}-ffmpeg-${{ hashFiles('**/libs.versions.toml', '**/build_ffmpeg_decoder.sh') }}
|
||||
- name: Build ffmpeg decoder
|
||||
id: ffmpeg-decoder
|
||||
if: steps.cache_ffmpeg_module.outputs.cache-hit != 'true'
|
||||
run: |
|
||||
./build_ffmpeg_decoder.sh "${{ env.ANDROID_SDK_ROOT }}/ndk/${{ env.NDK_VERSION }}"
|
||||
- name: Save ffmpeg module cache
|
||||
id: cache_ffmpeg_module_save
|
||||
uses: actions/cache/save@v4
|
||||
with:
|
||||
path: |
|
||||
app/libs
|
||||
key: ${{ steps.cache_ffmpeg_module.outputs.cache-primary-key }}
|
||||
|
||||
cache: true
|
||||
- name: Build app
|
||||
id: buildapp
|
||||
run: |
|
||||
./gradlew clean build
|
||||
echo "apk=$(ls app/build/outputs/apk/debug/Wholphin-debug*.apk)" >> "$GITHUB_OUTPUT"
|
||||
./gradlew clean assembleDebug
|
||||
apks=$(find app/build/outputs/apk -name '*.apk' -print0 | tr '\0' ',' | sed 's/,$//')
|
||||
echo "apks=$apks" >> "$GITHUB_OUTPUT"
|
||||
- name: Tar build dirs
|
||||
run: |
|
||||
tar -czf build.tgz */build/.
|
||||
tar -czf build.tgz ./app/.
|
||||
- uses: actions/upload-artifact@v5
|
||||
id: upload-build-dirs
|
||||
with:
|
||||
|
|
@ -83,6 +56,6 @@ jobs:
|
|||
if-no-files-found: error
|
||||
- uses: actions/upload-artifact@v5
|
||||
with:
|
||||
name: Wholphin-debug.apk
|
||||
path: "${{ steps.buildapp.outputs.apk }}"
|
||||
name: APKs
|
||||
path: "${{ steps.buildapp.outputs.apks }}"
|
||||
compression-level: 0
|
||||
|
|
|
|||
48
.github/workflows/release.yml
vendored
48
.github/workflows/release.yml
vendored
|
|
@ -11,8 +11,6 @@ defaults:
|
|||
|
||||
env:
|
||||
APK_SHORT_NAME: Wholphin.apk
|
||||
BUILD_TOOLS_VERSION: 36.0.0
|
||||
NDK_VERSION: "29.0.14206865"
|
||||
|
||||
jobs:
|
||||
publish:
|
||||
|
|
@ -24,24 +22,12 @@ jobs:
|
|||
uses: actions/checkout@v5
|
||||
with:
|
||||
fetch-depth: 0 # Need the tags to build
|
||||
- name: Setup Python
|
||||
uses: actions/setup-python@v5
|
||||
- name: Setup
|
||||
uses: ./.github/actions/setup
|
||||
- name: Native build
|
||||
uses: ./.github/actions/native-build
|
||||
with:
|
||||
python-version: '3.12'
|
||||
- name: Setup JDK
|
||||
uses: actions/setup-java@v5
|
||||
with:
|
||||
distribution: zulu
|
||||
java-version: '21'
|
||||
cache: 'gradle'
|
||||
- name: Setup Android SDK
|
||||
uses: android-actions/setup-android@v3
|
||||
with:
|
||||
packages: "tools platform-tools build-tools;${{ env.BUILD_TOOLS_VERSION }} ndk;${{ env.NDK_VERSION }}"
|
||||
- name: Build ffmpeg decoder
|
||||
id: ffmpeg-decoder
|
||||
run: |
|
||||
./build_ffmpeg_decoder.sh "${{ env.ANDROID_SDK_ROOT }}/ndk/${{ env.NDK_VERSION }}"
|
||||
cache: false
|
||||
- name: Build app
|
||||
id: buildapp
|
||||
env:
|
||||
|
|
@ -51,21 +37,31 @@ jobs:
|
|||
SIGNING_KEY: "${{ secrets.SIGNING_KEY }}"
|
||||
run: |
|
||||
./gradlew clean assembleRelease
|
||||
echo "apk=$(ls app/build/outputs/apk/release/Wholphin-release*.apk)" >> "$GITHUB_OUTPUT"
|
||||
- name: Verify signature
|
||||
- name: Verify signatures
|
||||
run: |
|
||||
${{env.ANDROID_SDK_ROOT}}/build-tools/${{ env.BUILD_TOOLS_VERSION }}/apksigner verify --verbose --print-certs "${{ steps.buildapp.outputs.apk }}"
|
||||
- name: Copy APK to ${{ env.APK_SHORT_NAME }}
|
||||
echo "Verify APK signatures"
|
||||
find app/build/outputs/apk -name '*.apk'
|
||||
find app/build/outputs/apk -name '*.apk' -print0 | xargs -0 -n1 ${{env.ANDROID_SDK_ROOT}}/build-tools/${{ env.BUILD_TOOLS_VERSION }}/apksigner verify --verbose --print-certs
|
||||
- name: Copy APK to shorter names
|
||||
id: apks
|
||||
run: |
|
||||
cp "${{ steps.buildapp.outputs.apk }}" "${{ env.APK_SHORT_NAME }}"
|
||||
find app/build/outputs/apk -name '*.apk' -print0 |
|
||||
while IFS= read -r -d '' line; do
|
||||
# Wholphin-release-0.2.9-62-g5c12e03-16-arm64-v8a.apk => Wholphin-arm64-v8a.apk
|
||||
short_name="$(echo $line | sed -E 's/-release-[0-9]+\.[0-9]+\.[0-9]+-[0-9]+-g[a-fA-F0-9]+-[0-9]+//')"
|
||||
echo "$line => $short_name"
|
||||
#cp "$line" "$short_name"
|
||||
done
|
||||
apks=$(find app/build/outputs/apk -name '*.apk' -print0 | tr '\0' ',' | sed 's/,$//')
|
||||
echo "apks=$apks" >> "$GITHUB_OUTPUT"
|
||||
- name: Checksums
|
||||
run: |
|
||||
echo "SHA256 checksums:"
|
||||
sha256sum "${{ steps.buildapp.outputs.apk }}" "${{ env.APK_SHORT_NAME }}"
|
||||
find app/build/outputs/apk -name '*.apk' -print0 | xargs -0 sha256sum
|
||||
- name: Create GitHub release
|
||||
uses: ncipollo/release-action@v1
|
||||
with:
|
||||
artifacts: "${{ steps.buildapp.outputs.apk }},${{ env.APK_SHORT_NAME }}"
|
||||
artifacts: "${{ steps.apks.outputs.apks }}"
|
||||
makeLatest: true
|
||||
prerelease: false
|
||||
generateReleaseNotes: false
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue