Skip to main content

ContainerReader

Trait ContainerReader 

Source
pub trait ContainerReader: Send {
    // Required methods
    fn tracks(&self) -> &[TrackInfo];
    fn seek(
        &mut self,
        track: TrackId,
        pts: i64,
    ) -> Result<Option<i64>, DemuxError>;
    fn next_packet(
        &mut self,
        track: TrackId,
    ) -> Result<Option<Packet>, DemuxError>;

    // Provided methods
    fn default_video(&self) -> Option<usize> { ... }
    fn default_audio(&self) -> Option<usize> { ... }
}
Expand description

A demuxer: the tracks of one file and their packets.

Each track is read on its own, in decode order, as if no other track existed. Hosts open one reader per consumer when they read several tracks at different positions.

Required Methods§

Source

fn tracks(&self) -> &[TrackInfo]

The tracks, in container order.

Source

fn seek(&mut self, track: TrackId, pts: i64) -> Result<Option<i64>, DemuxError>

Positions track so its next packet is the latest keyframe whose presentation time is at or before pts, or its first packet when none is. Returns that keyframe’s pts; None for a track without packets.

§Errors

An unknown track, or a file that cannot be read there.

Source

fn next_packet(&mut self, track: TrackId) -> Result<Option<Packet>, DemuxError>

The next packet of track in decode order; None at its end.

§Errors

An unknown track, damaged data, or a read failure.

Provided Methods§

Source

fn default_video(&self) -> Option<usize>

The index into Self::tracks of the default video track: the first enabled video track flagged default, else the first video track.

Source

fn default_audio(&self) -> Option<usize>

The index into Self::tracks of the default audio track, by the same rule.

Dyn Compatibility§

This trait is dyn compatible.

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

Implementors§