Files
MattJackson 19b646e012 mux: StreamSelection primitive + apply sites for per-title stream selection
The demux pipeline is declaration-driven off DiscTitle.streams (build_demux_state,
DiscStream::new, and the MKV writer all key off that list), so 'which streams to
keep' is already a pipeline capability with no public knob. This adds the knob:

- mux/select.rs: StreamSelection { audio, subtitle: PidFilter::All | Only(Vec<u16>) }
  + apply(&mut DiscTitle): keep Video always, keep Audio/Subtitle whose PID the
  filter lists, prune the rest (and the parallel codec_privates in lockstep);
  error SelectionPidUnknown on a listed PID absent from the title (fail loud, not
  a silently-missing track). Pure; 6 unit tests. Re-exported at crate root.
- Error::SelectionPidUnknown (E6014).
- MuxOptions gains  (+ derives Default now) applied in mux_stream's
  Iso/Session arms before the highway/DiscStream builds demux state (and before
  probe_and_remap's DVD AC-3 PID rewrite). InputOptions gains  applied
  in input()'s iso arm right after the title-index bounds check.

PIDs not languages -- language->PID is caller/engine policy. Default All/All is a
no-op (apply gated on !is_all()), so the no-selection path is byte-identical:
nothing below the title-finalization line changes (ts/ps/demux_thread/
pipelined_stream/mkv/disc untouched). All 2488 lib tests pass on 1.86.

Design: freemkv-private/audit/engine-split/STREAM-SELECTION-DESIGN.md (Fable).
2026-07-28 13:14:40 -07:00
..
2026-06-21 21:06:07 -07:00

libfreemkv Documentation

Technical documentation for libfreemkv, the open source optical drive library.

Start Here

Disc to Rip: End-to-End Flow — How the library goes from a disc in the drive to decrypted content. Read this first.

Reference

Document What it covers
Architecture Module map, design principles, error codes, platform support
Drive Access Drive, SCSI transport, profiles, unlock, why raw mode is needed
Rip Recovery Three-layer recovery model: Disc::patch, single-shot Drive::read, DiscStream batch halving
AACS Encryption Key resolution (4 paths), content decryption, bus encryption, SCSI handshake
UDF Filesystem UDF 2.50 with metadata partitions, pointer chain, how files are read from disc
MPLS Playlists Playlist format, play items, STN stream table, coding types
CLPI Clip Info EP map (coarse + fine entries), timestamp-to-sector mapping, extent calculation
API Design Stream API design, PES pipeline, input/output resolution

Reading Order

If you want to understand the whole library:

  1. Disc to Rip — the big picture
  2. Architecture — how modules fit together
  3. Drive Access — how we talk to hardware
  4. UDFMPLSCLPI — how disc content is structured
  5. AACS — how encryption works and how we break it

API Documentation

Generated API docs are on docs.rs/libfreemkv.