pub struct TrackStream { /* private fields */ }Expand description
A single-codec importer for a raw byte stream with unknown frame boundaries.
Use this when the caller does not know the frame boundaries (piped Annex-B H.264, an fMP4 reader, …); the importer infers them.
Implementations§
Source§impl TrackStream
impl TrackStream
Sourcepub fn video<E: CatalogExt>(
request: Request,
reserved: Reserved<E>,
init: VideoInit,
) -> Result<Self>
pub fn video<E: CatalogExt>( request: Request, reserved: Reserved<E>, init: VideoInit, ) -> Result<Self>
Create an importer that publishes a single codec onto a reserved track.
The caller reserves the track with
BroadcastProducer::reserve_track;
the importer accepts it here, at the microsecond timescale or a CMAF init’s own. A VideoHint carrying a codec publishes the catalog before the
first frame; any VideoInit::data seeds the stream (as a call to initialize).
Sourcepub fn initialize(&mut self, data: &[u8]) -> Result<()>
pub fn initialize(&mut self, data: &[u8]) -> Result<()>
Initialize the importer with the given buffer and populate the broadcast.
This is not required for self-describing formats like H264.
Sourcepub fn finish(self) -> Result<Finished>
pub fn finish(self) -> Result<Finished>
Finish the importer, publishing the access unit still waiting for a following start code,
and return the Finished track, which keeps it and its catalog rendition published.
A finish that fails ends the track with the cause instead, so it can’t be retried.
Sourcepub fn set_enabled(&mut self, enabled: bool) -> Result<()>
pub fn set_enabled(&mut self, enabled: bool) -> Result<()>
Stop or resume publishing this rendition, advertised as the catalog’s
enabled.
Disable it when its sender cannot be funded (a
rate::Target::Disabled). Once anything was published,
that marks a discontinuity. Every access
unit decoded until it is enabled again is dropped, so the caller may keep writing the
stream, though a dropped keyframe still updates the codec config. Enabled again, it
drops access units until the next keyframe and advertises itself enabled with that
keyframe.
Sourcepub fn abort(self, err: Error)
pub fn abort(self, err: Error)
Abort the track with err instead of finishing it cleanly, so subscribers
see the real cause rather than [moq_net::Error::Dropped]. Consumes the importer.