2 branches
Tree Top files
Code
Clone with HTTPS:
Clone with SSH:
56 years ago
..
README.md 2.9 KB

The Android mpv kit

The headers vendetta's mpv module compiles against on Android live here (include/mpv/), copied from mpv's own source tree (client API 2.6). The shared library is not in tree, because an NDK-built libmpv.so is large and architecture-specific; a build provides its own, in one of two ways:

  1. Link and package from one tree — the layout the mpv-android build scripts produce, per-ABI directories under lib/:

    libvendetta/mpv/android/
    ├── include/mpv/{client.h,render.h,render_gl.h}   (in tree)
    └── lib/<abi>/{libmpv.so,libav*.so,...}            (you provide)
    

    The link needs one flat copy: lib/libmpv.so → the ABI you are building, because vab compiles the V sources once and gives every architecture the same link flags, so a per-arch -L cannot be spelled (and lld errors on the first incompatible libmpv.so it finds rather than searching on):

    ln -sf arm64-v8a/libmpv.so libvendetta/mpv/android/lib/libmpv.so
    

    vab walks the --libs dir and stages every .so into the APK's ABI folder matching its path (lib/arm64-v8a/… and friends stage themselves); the flat symlink has no ABI in its path and is skipped:

    vab --name Vendetta \
        --libs /abs/path/to/vendetta/libvendetta/mpv/android/lib src
    

    The --libs path must be absolute: vab changes working directory during the build, and a relative dir then walks empty — silently, no libs, no error.

  2. Link and package from separate dirs — keep the flat link copy in android/lib/ and hand vab a directory tree holding the runtime copies for every architecture the APK carries (the same per-ABI subdirectory layout, anywhere on disk).

Where to get libmpv.so for Android:

  • Build mpv yourself with the mpv-android build scripts (build/mpv-android, --no-archive leaves build/mpv-android/app/src/main/jniLibs/<abi>/libmpv.so behind). The resulting build needs the same NDK the app links with, or at least a compatible API level (the headers here are from the mpv checkout the build scripts use).
  • Any prebuilt libmpv for Android (the mpv-android releases do not ship one as a bare .so; third-party packs exist) whose client API is 2.x and whose symbol set covers the ~54 functions mpv.def in ../win64/lib lists — the render API surface is the same on every platform.

The GL story on Android, for reference: mpv renders through the render API (MPV_RENDER_API_TYPE_OPENGL) into the texture vendetta's surface owns, and resolves every GL entry point through the get_proc_address callback, which on Android asks eglGetProcAddress (mpv.android_gl_proc). The context is the GLES 3 one sokol's Android backend creates and makes current; the render context takes no display parameter, and the surface's own texture work links GLESv3 directly (<GLES3/gl3.h>).