# Developer guide

RLC is a Cargo workspace with seven library crates and one desktop application.
Start from the RLC repository root, not the surrounding VLC reference checkout.
Only edit RLC. Read [CONTRIBUTING.md](../CONTRIBUTING.md) for review and licensing.

## Linux development setup

The tested compiler and CI toolchain is Rust **1.100.0**, edition 2021. This is a
validation pin, not an established minimum supported Rust version. Install that
stable toolchain with rustfmt and Clippy through your usual Rust installation.
CI explicitly selects it; locally check `rustc -Vv` and `cargo -V`.

Builders need pkg-config, libclang and its matching resource headers, FFmpeg
avcodec/avformat/avutil/swresample/swscale development libraries, ALSA headers,
libass >= 0.17.5 and fonts. The headless tests also need an `ffmpeg` CLI capable
of lavfi fixture generation. A display, compatible GPU backend and audio device
are required for desktop playback, not for ordinary non-device tests.

Ubuntu 24.04's CI dependency list is in `.github/workflows/ci.yml`. Its libass
baseline is built separately because a distribution's installed version may be
too old. The equivalent builder setup is:

```sh
sudo apt-get update
sudo apt-get install -y ffmpeg libavcodec-dev libavformat-dev libavutil-dev \
  libswresample-dev libswscale-dev libclang-dev pkg-config libasound2-dev \
  fonts-dejavu-core autoconf automake libtool nasm libfontconfig1-dev \
  libfreetype-dev libfribidi-dev libharfbuzz-dev libunibreak-dev
bash tools/build-libass.sh
export PKG_CONFIG_PATH="$PWD/target/native-libass/install/lib/pkgconfig"
export RLC_ASS_INCLUDE="$PWD/target/native-libass/install/include"
export LIBRARY_PATH="$PWD/target/native-libass/install/lib"
export LD_LIBRARY_PATH="$LIBRARY_PATH"
cargo build --locked -p rlc --bins
cargo run --locked -p rlc -- --help
```

On Arch, install the equivalent Rust, clang, pkgconf, FFmpeg, ALSA and libass
packages with development headers; confirm actual versions before using system
libass. The build helper pins the subtitle library commit and installs only under
`target/native-libass/`. It needs network on its first run. It does not install
system packages or claim a complete redistributable native bundle.

For Windows/MSYS2 and macOS/Homebrew build recipes, use the native steps in
`.github/workflows/distribution.yml` and [DISTRIBUTION.md](DISTRIBUTION.md).
Those build definitions have not established runtime compatibility. Do not
pretend the Linux instructions are verified cross-platform setup instructions.

## Validation

```sh
python3 tools/validate.py --output target/validation --stress 20
# Ordinary targeted iteration:
cargo test --locked -p rlc-player --test sync
cargo test --locked -p rlc-subs --test embedded
# Generated public API documentation:
RUSTDOCFLAGS='-D warnings' cargo doc --locked --workspace --no-deps
```

The harness runs formatting, warning-denied Clippy and workspace tests both
normally and with VAAPI enabled; it captures exact commands, source fingerprints,
log hashes and failures. It does not run the dependency audit, packaging checks,
interactive playback or fuzz campaigns. Default tests generate local media under
`target/` and skip four device/private-input/stress opt-ins described in the audit.
Run relevant opt-ins deliberately, with known test media and a bounded runtime.
A passing harness does not mean production readiness.

```sh
# Requires working audio; use an isolated test environment.
cargo test --locked -p rlc-player --test playback -- --ignored --test-threads=1
# Reads a file you choose; never commit it or its identifying logs.
RLC_TEST_MEDIA=/path/to/local.mp4 cargo test --locked -p rlc-player --test real_media -- --ignored
# Packaging generators and ownership/relocation regressions:
python3 -m unittest discover -s packaging/tests -v
```

The separate dependency job uses pinned cargo-deny and cargo-audit versions from
CI. The strict unmaintained-dependency policy currently fails; follow
[the audit](PRODUCTION_READINESS.md) rather than treating it as an environmental
error or disabling the gate. Nightly cargo-fuzz and Linux mutation/soak tooling
are documented in the audit and each tool's `--help`; do not treat a saved-input
replay as a passing sustained fuzz campaign.

## Documentation and infrastructure checks

Use Python >= 3.12. Keep helper dependencies and downloaded tools inside `target/`:

```sh
python3 -m venv target/infrastructure/venv
target/infrastructure/venv/bin/python -m pip install --no-cache-dir -r tools/requirements-infrastructure.txt
python3 tools/fetch_actionlint.py
target/infrastructure/venv/bin/python tools/check_infrastructure.py
target/infrastructure/venv/bin/python -m unittest discover -s tools/tests -v
```

On Windows the venv interpreter is `target/infrastructure/venv/Scripts/python.exe`.
The fetcher selects a checksum-pinned actionlint build for the builder's platform.
Node is used for the workflow JavaScript regression test; locally it is skipped
if Node is absent, while CI requires Node and runs it.
The checker validates local Markdown targets, issue/discussion forms, label and
milestone references, CODEOWNERS, workflow pins/permissions and actionlint syntax.
It does not contact or modify GitHub. It does not validate every GitHub server-side
schema, external URL or workflow behavior; see [verification limits](INFRASTRUCTURE.md).

## Working safely with native builds

Use the development loader environment above for development. A distribution
prefix built by `packaging/native/build.sh` is separate and deliberately disables
FFmpeg components; exposing its libraries to the system's `ffmpeg` CLI can cause
symbol errors. Do not put that prefix in a global loader configuration. See
[TROUBLESHOOTING.md](TROUBLESHOOTING.md).

Use generated fixtures for reproducible tests. Media supplied by users remains
private unless explicitly licensed for redistribution. Store build results,
measurements, fuzz inputs and logs under ignored `target/`; scrub sensitive paths
before sharing. Keep the existing audit's failing evidence intact. Re-run checks
appropriate to code you change and document every material validation gap.
