Wholphin/scripts/mpv
Ray 8b40e89b8a
Update MPV playback threading model (#481)
There's no user facing changes in this PR

This PR updates `MpvPlayer` to use a threading model more similar to
[ExoPlayer's
model](https://developer.android.com/reference/androidx/media3/exoplayer/ExoPlayer#threading-model).

There's now a dedicated thread looper message queue between the UI
interactions on the main thread and calls to `libmpv`. This is necessary
because previously, the main thread would make the calls into `libmpv`.
`libmpv` uses internal mutex locking for some operations which meant
that the main thread would be blocked momentarily.

Now, the UI issues a command (eg seek to X position) and the command is
added to the thread looper queue and processed on that separate thread.
This uses the standard Android Handler/Looper mechanisms.

Related to #235
2025-12-17 18:24:25 -05:00
..
include Add experimental MPV player backend (#161) 2025-11-16 18:46:25 -05:00
scripts Add experimental MPV player backend (#161) 2025-11-16 18:46:25 -05:00
buildall.sh Add experimental MPV player backend (#161) 2025-11-16 18:46:25 -05:00
get_dependencies.sh Add experimental MPV player backend (#161) 2025-11-16 18:46:25 -05:00
README.md Update MPV playback threading model (#481) 2025-12-17 18:24:25 -05:00

MPV build scripts

This scripts are adapted from ae0d956c5a/buildscripts licensed MIT.

Instructions

cd scripts/mpv
./get_dependencies

export NDK_PATH=... # Such as ~/Library/Android/sdk/ndk/29.0.14206865
# Build arm64
PATH="$PATH:$NDK_PATH/toolchains/llvm/prebuilt/darwin-x86_64/bin" ./buildall.sh --clean --arch arm64 mpv
# Build arm32
PATH="$PATH:$NDK_PATH/toolchains/llvm/prebuilt/darwin-x86_64/bin" ./buildall.sh mpv

cd ../..
env PREFIX32="$(realpath scripts/mpv/prefix/armv7l)" PREFIX64="$(realpath scripts/mpv/prefix/arm64)" "$NDK_PATH/ndk-build" -C app/src/main -j && cp -fr app/src/main/libs/ app/src/main/jnilibs/