pub trait SampleProvider: Send {
// Required methods
fn len(&self) -> usize;
fn is_random_access(&self, decode_index: usize) -> bool;
fn presentation_index(&self, decode_index: usize) -> FrameIndex;
fn read(&self, decode_index: usize) -> Result<Cow<'_, [u8]>>;
// Provided method
fn is_empty(&self) -> bool { ... }
}Expand description
Supplies ExactFrameReader with compressed video samples by decode
index, so a reader does not have to own every sample of a track up front.
An owned Vec<EncodedVideoSample> implements this directly and is what
ExactFrameReader::new wraps, so that constructor and its callers are
unchanged. ExactFrameReader::from_provider accepts any other
implementation, such as one that reads through a container track’s index
and a crate::io::ByteSource on demand, holding only the index and a
bounded cache of compressed bytes rather than the whole track.
len, is_random_access and presentation_index answer from the index
alone and must not read sample data; only Self::read may do that, and
only for the one sample it is asked for.
Implementations used from a decode thread must be Send, matching
VideoDecoder’s own requirement.
Required Methods§
fn is_random_access(&self, decode_index: usize) -> bool
fn presentation_index(&self, decode_index: usize) -> FrameIndex
Provided Methods§
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".