pub trait Decoder<T>where
Self: Sized,{
fn new(data: T, colors: ColorChannels) -> Option<Self>;
fn run(
&mut self,
audio: &mut Option<Audio>,
video: &mut Option<Video>
) -> Option<bool>;
fn get(&self) -> Index;
fn set(&mut self, index: Index);
}
Expand description
A trait for implementing decoding audio, video or both.
Required Methods§
sourcefn new(data: T, colors: ColorChannels) -> Option<Self>
fn new(data: T, colors: ColorChannels) -> Option<Self>
Create a new decoder for this format. None
is returned when the
decoder can’t handle data
’s format: try a different decoder.
sourcefn run(
&mut self,
audio: &mut Option<Audio>,
video: &mut Option<Video>
) -> Option<bool>
fn run(
&mut self,
audio: &mut Option<Audio>,
video: &mut Option<Video>
) -> Option<bool>
Decode a frame. None
is returned if the file is corrupt,
Some(true)
if it succeeded, and Some(false)
if it can’t add
anymore frames because the input file ended. audio
and video
should initially be set to None
.