Skip to main content

ContainerWriter

Trait ContainerWriter 

Source
pub trait ContainerWriter: Send {
    // Required methods
    fn add_track(&mut self, track: &TrackInfo) -> Result<TrackId, MuxError>;
    fn write(&mut self, packet: Packet) -> Result<(), MuxError>;
    fn finish(self: Box<Self>) -> Result<(), MuxError>;
}
Expand description

A muxer: writes tracks’ packets into one file.

Required Methods§

Source

fn add_track(&mut self, track: &TrackInfo) -> Result<TrackId, MuxError>

Adds a track described by track (its id is ignored) and returns the id it gets.

§Errors

A codec the container cannot carry, or a track added after the first packet.

Source

fn write(&mut self, packet: Packet) -> Result<(), MuxError>

Writes packet. Packets of each track arrive in decode order, and the writer interleaves the tracks. A track may run ahead of the others by up to 10 s (Matroska) or 64 MiB of packets (MP4) before the file’s layout degrades: the leading track is then written in one run, and a reader seeking in it finds the other tracks far away.

§Errors

Timestamps that go backward, or a write failure.

Source

fn finish(self: Box<Self>) -> Result<(), MuxError>

Writes the index and closes the file.

§Errors

A write failure.

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§