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 file_duration(&self) -> Option<MediaTime> { ... }
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§
Sourcefn seek(&mut self, track: TrackId, pts: i64) -> Result<Option<i64>, DemuxError>
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.
Sourcefn next_packet(&mut self, track: TrackId) -> Result<Option<Packet>, DemuxError>
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§
Sourcefn file_duration(&self) -> Option<MediaTime>
fn file_duration(&self) -> Option<MediaTime>
The file’s own duration when its header states one apart from its tracks (a Matroska
segment’s Duration), as FFmpeg reports it.
Sourcefn default_video(&self) -> Option<usize>
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.
Sourcefn default_audio(&self) -> Option<usize>
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".