pub trait Decodable: Send + Sync {
type Frame;
// Required methods
fn new(
codec: VideoCodec,
on_decoded_frame: Box<dyn Fn(Self::Frame) + Send + Sync>,
) -> Self
where Self: Sized;
fn decode(&self, frame: FrameBuffer);
}Expand description
A trait that abstracts over the platform-specific decoder implementation
(e.g., std::thread on native, Web Workers + WebCodecs in WASM).
Required Associated Types§
Required Methods§
Sourcefn new(
codec: VideoCodec,
on_decoded_frame: Box<dyn Fn(Self::Frame) + Send + Sync>,
) -> Selfwhere
Self: Sized,
fn new(
codec: VideoCodec,
on_decoded_frame: Box<dyn Fn(Self::Frame) + Send + Sync>,
) -> Selfwhere
Self: Sized,
Creates a new decoder and starts its underlying thread or worker.
The on_decoded_frame callback will be invoked whenever a frame is successfully decoded.
Sourcefn decode(&self, frame: FrameBuffer)
fn decode(&self, frame: FrameBuffer)
Sends a raw frame buffer to the decoder for processing.