pub struct Import { /* private fields */ }Expand description
MP3 importer.
Publishes raw MP3 frames to a single moq track. Build it with new,
passing the track producer and the catalog::Reserved
it reserves its rendition from.
Every MP3 frame is independently decodable, so decode marks only the first
frame of each group a keyframe (the rest extend it): frames accumulate into the current group
until the caller cuts. The
import::Track facade cuts once a group holds 100 ms. MP3 carries its
config in band, so the rendition has no out-of-band description.
Implementations§
Source§impl Import
impl Import
Sourcepub fn new<E: CatalogExt>(
track: Producer,
reserved: Reserved<E>,
config: AudioConfig,
) -> Result<Self>
pub fn new<E: CatalogExt>( track: Producer, reserved: Reserved<E>, config: AudioConfig, ) -> Result<Self>
Sourcepub fn finish(self) -> Result<Finished<Wire, AudioConfig>>
pub fn finish(self) -> Result<Finished<Wire, AudioConfig>>
Finish the track, flushing the current group, 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 this 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.
Sourcepub fn discontinuity(&mut self) -> Result<()>
pub fn discontinuity(&mut self) -> Result<()>
Mark a timeline break and restart measurement without lowering advertised values.
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<()>
Publish one MP3 frame, stamping pts or a wall clock when absent.
MP3 is independently decodable, so the frame is marked a keyframe only when it starts a group
(see Producer::needs_keyframe); otherwise it
extends the current group. The caller bounds groups via cut.