Skip to main content

WebmMuxer

Struct WebmMuxer 

Source
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>

Source

pub async fn new( sink: S, configs: Vec<Mp4TrackConfig>, max_samples_per_track: usize, ) -> Result<Self>

Source

pub fn track_count(&self) -> usize

Source

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.

Source

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.

Source

pub async fn finish(self) -> Result<S>

Auto Trait Implementations§

§

impl<S> Freeze for WebmMuxer<S>
where S: Freeze,

§

impl<S> RefUnwindSafe for WebmMuxer<S>
where S: RefUnwindSafe,

§

impl<S> Send for WebmMuxer<S>
where S: Send,

§

impl<S> Sync for WebmMuxer<S>
where S: Sync,

§

impl<S> Unpin for WebmMuxer<S>
where S: Unpin,

§

impl<S> UnsafeUnpin for WebmMuxer<S>
where S: UnsafeUnpin,

§

impl<S> UnwindSafe for WebmMuxer<S>
where S: UnwindSafe,

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.