Skip to main content

Decodable

Trait Decodable 

Source
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§

Source

type Frame

The type of frame passed to the callback when a frame is decoded.

Required Methods§

Source

fn new( codec: VideoCodec, on_decoded_frame: Box<dyn Fn(Self::Frame) + Send + Sync>, ) -> Self
where 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.

Source

fn decode(&self, frame: FrameBuffer)

Sends a raw frame buffer to the decoder for processing.

Implementors§