Skip to main content

Module streaming

Module streaming 

Source
Expand description

Pull-based streaming demuxer (Squad streaming-migration-55 P1).

Replaces the materialize-everything-upfront demux() shape with a next_video_sample() iterator. Each per-format implementation holds only the reader state it needs to produce ONE sample at a time; nothing accumulates across samples. The legacy demux() is preserved as a thin adapter that drains the iterator into a Vec so existing callers keep working unchanged.

Memory characteristic: peak heap from any one next_video_sample() call is bounded by the sample size + the reader’s internal cursor state (mp4 0.14 keeps stbl indexes in the Mp4Reader; matroska- demuxer keeps its own cluster cursor; the TS / AVI walks track only an offset). Audio passthrough remains buffered per the pinned contract — Squad-18’s pattern is unchanged.

Structs§

DemuxHeader
Header information for a demuxed stream — codec label + the StreamInfo shape every existing caller already consumes. Available immediately after demux_streaming() returns; parsed from the container header before any video samples are pulled.
Sample
One demuxed video sample with its container-level timing.

Traits§

StreamingDemuxer
Pull-based per-format demuxer. The trait is Send so the pipeline can move the demuxer onto its dedicated decode thread (the existing transcode pump pattern).

Functions§

demux_streaming
Magic-byte detect the container and dispatch to a per-format streaming reader. Mirrors demux::detect_container exactly so the streaming and legacy paths agree on every input.