pub struct Track { /* private fields */ }Expand description
A single-codec importer for whole frames.
Use this when the caller already has whole frames (the typical case for files
and reassembled network input). Each decode call takes one
complete frame.
Video groups by its own keyframes. Audio is independently decodable per frame, so it has no
boundary of its own: this closes a group on the frame that brings it to
Join::DEFAULT of audio, so the relay sees it finish at once
and keeps one group (one QUIC stream) per span rather than one per packet. Frames forward as they
are written either way. cut still closes a group early,
and the next span starts from the frame after.
Implementations§
Source§impl Track
impl Track
Sourcepub fn audio<E: CatalogExt>(
request: Request,
reserved: Reserved<E>,
init: AudioInit,
) -> Result<Self>
pub fn audio<E: CatalogExt>( request: Request, reserved: Reserved<E>, init: AudioInit, ) -> Result<Self>
Create an importer that publishes a single audio codec onto a reserved track.
The caller reserves the track (by name) with
BroadcastProducer::reserve_track; the
importer accepts it here, at the microsecond timescale or a CMAF init’s own. The rendition is
published from the init bytes, since audio has no in-band config to wait for.
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 video codec onto a reserved track.
The caller reserves the track as in audio. A video format resolves its
rendition in band, publishing up front when VideoInit::hint already carries enough
(see VideoHint).
Sourcepub fn decode<B: IntoBytes>(
&mut self,
frame: B,
pts: Option<Timestamp>,
) -> Result<()>
pub fn decode<B: IntoBytes>( &mut self, frame: B, pts: Option<Timestamp>, ) -> Result<()>
Decode one whole frame.
Sourcepub fn finish(self) -> Result<Finished>
pub fn finish(self) -> Result<Finished>
Finish the importer, flushing any buffered data, 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 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.
Sourcepub fn cut(&mut self, end: Option<Timestamp>) -> Result<()>
pub fn cut(&mut self, end: Option<Timestamp>) -> Result<()>
Cut the current group at end without finishing the track.
Audio closes its own groups once they hold their span; this closes one early, and the next span starts from the frame after.
Sourcepub fn discontinuity(&mut self) -> Result<()>
pub fn discontinuity(&mut self) -> Result<()>
Mark a timeline break, clearing partial frames and restarting handoff measurement.
Publishes a marker without lowering advertised values; resumed timestamps must continue forward.
Sourcepub fn set_enabled(&mut self, enabled: bool) -> Result<()>
pub fn set_enabled(&mut self, enabled: bool) -> Result<()>
Advertise whether this video rendition is being produced, as the catalog’s
enabled.
Disable it when the sender stops for lack of bandwidth (a
rate::Target::Disabled) and mark the
discontinuity, so viewers select a lower rendition instead
of waiting for frames. Enable it again with the keyframe that resumes it. Audio has
no lower rendition to fall back to, so an audio track refuses with
Error::WrongKind.