pub struct Republish { /* private fields */ }Expand description
Imports one program of a multiplex as a broadcast on origin, republishing the path under a
new identity each time the source changes.
The single-program sibling of Programs. Each identity is created hidden
and announced once its catalog first goes out: a relay queries a broadcast’s tracks the moment
it is announced, so one announced any sooner would be asked for tracks it cannot serve yet.
A change of source is a Step: the source’s clock moving onto another timeline, or its PAT
naming another program, as Import::decode judges it. decode then
finishes the identity before the step, withdrawing it, and opens the next under a new
identity, returning the step as Republished. Nothing crosses it but the measured mux rate:
the new catalog records it from its first media rather than holding for a fresh measurement
window, since the multiplex is the same. The new identity waits for the source’s own PAT, PMT
and next keyframe.
Implementations§
Source§impl Republish
impl Republish
Sourcepub fn new(
origin: Producer,
name: impl Into<Path>,
identity: Identity,
config: Config,
) -> Result<Self, Error>
pub fn new( origin: Producer, name: impl Into<Path>, identity: Identity, config: Config, ) -> Result<Self, Error>
Import the multiplex onto name, its catalogs built from config, publishing the first
identity as identity and each after it under a fresh one. The first is created now, so
its catalog can be filled before any input.
Pass Identity::random unless the identity is shared, such as
across a run’s broadcasts; see RouteOptions::with_identity.
Sourcepub fn with_program(self, program: u16) -> Self
pub fn with_program(self, program: u16) -> Self
Import only the program with this PAT program number; see Import::with_program.
Sourcepub fn broadcast(&self) -> &Producer
pub fn broadcast(&self) -> &Producer
The current identity’s broadcast, such as for a track of the caller’s own.
Sourcepub fn catalog(&self) -> &Producer<Ext>
pub fn catalog(&self) -> &Producer<Ext>
The current identity’s catalog. Sections set before the importer declares a track ride
the first catalog; set them again on each new identity after Republished.
Sourcepub fn decode(&mut self, data: &[u8]) -> Result<Option<Republished>, Error>
pub fn decode(&mut self, data: &[u8]) -> Result<Option<Republished>, Error>
Demux a chunk of the multiplex into the current identity, announcing it once its catalog goes out. A trailing partial packet is retained for the next call.
A change of source finishes the identity there and opens the next, returning
Republished before the next reads anything: the rest of data is held for it, read at
the start of the next call. Call again, with no data if there is none, until it returns
None. A failure to finish the identity before the step returns that failure, with the
next identity current.
Sourcepub fn stats(&self) -> Snapshot
pub fn stats(&self) -> Snapshot
What every elementary stream of the current identity has delivered; see Import::stats.
Sourcepub fn finish(self) -> Result<Finished, Error>
pub fn finish(self) -> Result<Finished, Error>
Finish the current identity’s media tracks, then its catalog while it still lists them,
and return the Finished broadcast.
Input still held after a Republished, or while a step was judged, is read first,
republishing again at any step in it. Fails when the input ended before the identity
declared a track, so nothing was announced. A finish that fails aborts every track with
the cause.