pub struct WebmMuxer<S> { /* private fields */ }Expand description
A seekable WebM muxer that writes payload bytes immediately.
Track declarations are the same Mp4TrackConfig values
crate::mp4::Mp4Muxer takes, so one encoder configuration feeds either
container. Samples from every track are written in one nondecreasing
presentation-time order, because a WebM Cluster interleaves its tracks
rather than storing each in a run of its own.
Implementations§
Source§impl<S: ByteSink> WebmMuxer<S>
impl<S: ByteSink> WebmMuxer<S>
pub async fn new( sink: S, configs: Vec<Mp4TrackConfig>, max_samples_per_track: usize, ) -> Result<Self>
pub fn track_count(&self) -> usize
Sourcepub async fn write_sample(
&mut self,
track: usize,
sample: EncodedSample,
) -> Result<()>
pub async fn write_sample( &mut self, track: usize, sample: EncodedSample, ) -> Result<()>
Writes one sample. A video random-access sample starts a new Cluster
and gets a cue point, so every Cluster opens on one; in a file without
video, a Cluster opens every few seconds and its first audio block is
cued instead. An audio sample is held back until a later sample or
Self::finish writes it, so its track’s last block can carry the
end padding Self::set_audio_gapless declares.
Sourcepub fn set_audio_gapless(
&mut self,
track: usize,
gapless: AudioGapless,
) -> Result<()>
pub fn set_audio_gapless( &mut self, track: usize, gapless: AudioGapless, ) -> Result<()>
Declares an audio track’s gapless trim and ends the track. The
priming must be the delay its codec configuration already declares - an
Opus stream’s pre-skip, zero for Vorbis - and the padding is written as
the track’s last block’s DiscardPadding, so it has to be set after the
track’s last sample and before a sample of another track is written past
that sample’s time.