Expand description
Shared source decode pump.
One pump per job (not per rung): demux + decode the source once, run
the rung-agnostic per-frame work (4:4:4 → 4:2:0 downsample + HDR tonemap),
and fan the normalized frame out to N per-rung mpsc channels via cheap
VideoFrame::clone() (the inner Bytes is Arc-backed).
Per-rung scaling + encoding consume from those channels. Eliminating the redundant per-rung decode is the whole point — a 5-rung ladder decodes the source once, not five times. The cost: the slowest rung backpressures the pump (usually the largest rung, whose encoder is slowest).
Structs§
- Clip
Source - One clip of a splice: a decode config, its source bytes, and the source
frame range to keep. The first
start_framedecoded frames are dropped (the trim in-point); decoding stops once the source index reachesend_frame(exclusive — the trim out-point).end_frame = Nonekeeps the clip to its end. A single full-range clip (start_frame = 0,end_frame = None) is a plain, un-spliced transcode. - Decode
Pump Config - Configuration for one decode pump.
Constants§
- DECODE_
BENCH_ FRAMES - Number of frames timed per candidate when benchmarking decoders. Chosen so the measurement amortises driver init yet stays well under a second per candidate even on a modest GPU.
Functions§
- fastest_
decode_ gpu - Benchmark each candidate GPU by decoding a short prefix of
inputon it and return the fastestgpu_index(what--decode-with-fastestpins the pump to). Construction + first-frame latency is excluded — the clock starts after a small warmup — so the number reflects steady-state decode throughput, not driver init. Candidates that fail to construct or decode are skipped; returnsNoneif no candidate produced frames or fewer than two candidates were given (nothing to choose). - run_
shared_ decode_ pump_ blocking - Single-input decode pump (no trim, no concat) — the common case. A thin
wrapper over
run_spliced_decode_pump_blockingwith one whole clip. - run_
spliced_ decode_ pump_ blocking - Spliced decode pump, designed for
tokio::task::spawn_blocking. Decodes each clip in order, drops frames outside the clip’s[start_frame, end_frame)source range (trim), and fans the kept frames out to allsenderscontinuously across clips (concat). Because the muxer numbers output frames by count — not by source PTS — the join is automatically gap-free and the timeline is zero-based, with no PTS rewriting.