Skip to main content

MultiTitleSource

Trait MultiTitleSource 

Source
pub trait MultiTitleSource: Send {
    // Required methods
    fn title_count(&self) -> usize;
    fn open_title(&mut self, index: usize) -> Result<Box<dyn BytesSource>>;
    fn title_label(&self, index: usize) -> String;

    // Provided methods
    fn title_display_name(&self, index: usize) -> Option<String> { ... }
    fn title_container_hint(&self, index: usize) -> Option<&'static str> { ... }
    fn metadata(&self) -> &[(String, String)] { ... }
}
Expand description

A source that emits N discrete byte streams (“titles”) rather than a single contiguous one.

The motivating shape is BD-ROM: a disc contains many titles (whole movies, behind-the-scenes featurettes, trailers) and each title can be sliced further into chapters. The Blu-ray source driver expresses both shapes through this trait — a URI like bluray:///path?title=1&chapters=2-5 opens a MultiTitleSource whose four titles are chapters 2, 3, 4, 5 of disc-title 1; a URI without ?chapters= opens a MultiTitleSource with a single title (the autoplay title). DVD-Video, multi-edition MKV, and any other format with explicit segment structure plug in the same way.

Downstream callers fan out: each title is opened as its own BytesSource, demuxed independently, and written to its own output path. The CLI’s oxideav remux substitutes Self::title_label into a %s token in the output-path template so each title lands in a separate file. Other front-ends (oxideplay bluray://, a future GUI title-picker, …) can iterate titles the same way.

Sources that don’t have multi-title structure should keep returning a BytesSource — there’s no benefit to wrapping a single-title file in this trait.

Required Methods§

Source

fn title_count(&self) -> usize

Number of titles this source emits. Stable for the lifetime of the source — title discovery happens at open time, not while streaming.

Source

fn open_title(&mut self, index: usize) -> Result<Box<dyn BytesSource>>

Open the title at index (0-based) as a single-stream BytesSource the existing container registry can demux. index must satisfy index < self.title_count(). Calling open_title more than once on the same index is allowed — the returned source is a fresh handle each time.

Source

fn title_label(&self, index: usize) -> String

Stable per-title identifier substituted into a %s token of a templated output path. Examples: "3" for chapter 3, "t01" for title 1, "introduction" for a named edition. Returned values must be filename-safe: ASCII letters / digits / - / _, no path separators, no whitespace, no leading dot. Calling code is free to additionally sanitise; an empty string is rejected.

Provided Methods§

Source

fn title_display_name(&self, index: usize) -> Option<String>

Human-readable display name for the title (e.g. "Kite Uncut — Director's Cut") — used by interactive front-ends to render menus. None when the source carries no name. The default returns None.

Source

fn title_container_hint(&self, index: usize) -> Option<&'static str>

Container-format hint for the title’s byte stream ("mpegts", "matroska", "mp4", …). When Some, callers can skip the format-detector pass and hand the bytes straight to that demuxer. None means “sniff it” — preserves the existing detection path. The default returns None.

Source

fn metadata(&self) -> &[(String, String)]

Source-level metadata as ordered (key, value) pairs (disc label, BDMT <di:name>, region code, …). Default is empty.

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§