# Lumen libmpv for Windows (D193)

The Windows `libmpv-2.dll` Lumen ships is built here, not downloaded from
media-kit. Their 2023 build compiled FFmpeg with a decoder allowlist that
left out TrueHD and MLP (every Atmos remux), and their recipe cannot be
reproduced: the release tag is a marker commit and their later snapshot
floats several dependencies on `master`.

Ours: upstream [shinchiro/mpv-winbuild-cmake](https://github.com/shinchiro/mpv-winbuild-cmake)
(maintained, green daily), patched by `lgpl_full.py` to the same LGPL
posture media-kit used (`--disable-gpl --disable-nonfree --enable-version3`,
mpv `-Dgpl=false`), GPL-only components removed (x264, x265, davs2,
rubberband, dvdnav/dvdread), and **no decoder allowlist** — every LGPL
FFmpeg decoder, the Windows twin of the Android "full" jars.

Pins: mpv `v0.41.0`, FFmpeg `n9.0.1`; the upstream recipe commit is
recorded in `out/recipe.commit` and `out/BUILD_INFO` next to the archive.

## Building

One-time host (a disposable WSL distro on a drive with ~20 GB free):

    wsl --import lumen-build D:\wsl\lumen-build <ubuntu-24.04 wsl rootfs.tar.gz> --version 2
    wsl -d lumen-build -u root -- bash /mnt/d/wsl/provision.sh   # apt list in provision.sh

provision.sh installs the upstream README's Ubuntu package list plus
`rst2pdf`, a current `meson` from PyPI (apt's 1.3.2 is too old for
fontconfig/mpv on master), `glad2` (libplacebo generates its GL loader
with `python3 -m glad`; upstream's Arch container has it system-wide),
and `ffmpeg` for the test fixture. No Docker. Install these BEFORE the
first build: upgrading meson mid-build invalidates every meson package
that was configured but not yet installed (D:\wsl\reset-stale-meson.sh
recovers from that).

Build (4-5 h on 4 cores; the gcc cross toolchain is built once and cached):

    wsl -d lumen-build -u root -- bash /mnt/d/BIONICS/Strello/tools/libmpv/build-libmpv.sh

Result: `tools/libmpv/out/mpv-dev-x86_64-<date>-git-<hash>.7z` containing
`libmpv-2.dll`. `vendor.ps1` copies it into
`third_party/libmpv-win32/` (with its MD5) where the forked
`media_kit_libs_windows_video` CMake picks it up instead of downloading.

## Verifying

- `probe_decoders.py` asks the DLL for its `decoder-list` and checks the
  codecs that matter (truehd, mlp, dts, eac3, …, hevc, av1, prores, ffv1).
- `fixtures/truehd_stereo.mkv` is a synthetic TrueHD file (FFmpeg's
  encoder); `probe_playback.py` loads it through the DLL with `ao=null`
  and asserts audio decodes with no "Failed to initialize a decoder".
