pub struct PrerollContext { /* private fields */ }Expand description
Shared completion state for one preroll pass.
Implementations§
Source§impl PrerollContext
impl PrerollContext
Sourcepub fn new(terminals: impl IntoIterator<Item = ElementId>) -> Self
pub fn new(terminals: impl IntoIterator<Item = ElementId>) -> Self
Creates a preroll that completes once every supplied terminal ID is marked ready (or EOS-equivalent).
Sourcepub fn for_seek(
terminals: impl IntoIterator<Item = ElementId>,
target: Duration,
) -> Self
pub fn for_seek( terminals: impl IntoIterator<Item = ElementId>, target: Duration, ) -> Self
Creates a seek preroll whose decoded timing gates should discard
samples before target while decoding forward from the landed
keyframe.
Sourcepub fn target(&self) -> Option<Duration>
pub fn target(&self) -> Option<Duration>
Exact requested position for seek preroll, or None for ordinary
first-sample preroll.
Sourcepub fn mark_ready(&self, terminal: ElementId)
pub fn mark_ready(&self, terminal: ElementId)
Marks one expected terminal’s first valid sample as ready.
Sourcepub fn mark_eos(&self, terminal: ElementId)
pub fn mark_eos(&self, terminal: ElementId)
EOS means this terminal cannot produce a sample and therefore must not leave the whole preroll waiting forever.
Sourcepub fn mark_departed(&self, terminal: ElementId)
pub fn mark_departed(&self, terminal: ElementId)
Stops expecting a terminal that has left the graph.
The expected set is fixed when the seek starts, but the topology is
not: detaching a Tee branch mid-seek removes its terminal without
removing the obligation to hear from it, and the wait would run to its
timeout for a sample nobody is left to produce. Like EOS, this is
“cannot produce one”, not “produced one”.
Sourcepub fn is_ready(&self, terminal: ElementId) -> bool
pub fn is_ready(&self, terminal: ElementId) -> bool
Whether this one terminal has already taken its preroll sample.
A terminal stops accepting as soon as it is ready, not when the whole preroll is. Waiting for the others would let a branch that reached the target first keep consuming for as long as the slowest branch takes — which is how the two streams end up at different positions when preroll finally completes.
Sourcepub fn is_complete(&self) -> bool
pub fn is_complete(&self) -> bool
Returns whether every expected terminal has completed this preroll.