Skip to main content

WebpDecoder

Struct WebpDecoder 

Source
pub struct WebpDecoder { /* private fields */ }
Expand description

WebP Decoder trait impl.

Each send_packet carries one complete RIFF/WEBP file (still image — animations not yet implemented). The matching receive_frame returns a Frame::Video holding interleaved 8-bit RGBA pixels.

The decoder caches the most recently observed image dimensions on its CodecParameters — see Self::params — so consumers can pull width / height / pixel format after the first receive_frame. Before a packet has been decoded the values come from whatever CodecParameters the factory was constructed with (typically empty width / height for a still-image codec).

Implementations§

Source§

impl WebpDecoder

Source

pub fn new(params: CodecParameters) -> Self

Build a decoder whose output CodecParameters start from params. The factory always passes the caller-supplied CodecParameters here; the dimensions and pixel format are re-derived from each successfully decoded frame so the field is authoritative after the first receive_frame.

Source

pub fn params(&self) -> &CodecParameters

Reference to the decoder’s CodecParameters. After the first successful receive_frame the width, height, and pixel_format fields reflect the decoded image; before that they hold the factory-supplied values.

Trait Implementations§

Source§

impl Debug for WebpDecoder

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Decoder for WebpDecoder

Source§

fn codec_id(&self) -> &CodecId

Source§

fn send_packet(&mut self, packet: &Packet) -> Result<()>

Feed one compressed packet. May or may not produce a frame immediately — call receive_frame in a loop afterwards.
Source§

fn receive_frame(&mut self) -> Result<Frame>

Pull the next decoded frame, if any. Returns Error::NeedMore when the decoder needs another packet.
Source§

fn flush(&mut self) -> Result<()>

Signal end-of-stream. After this, receive_frame will drain buffered frames and eventually return Error::Eof.
Source§

fn receive_arena_frame(&mut self) -> Result<Arc<FrameInner>, Error>

Pull the next decoded frame as an arena-backed arena::sync::Frame. Read more
Source§

fn reset(&mut self) -> Result<(), Error>

Discard all carry-over state so the decoder can resume from a new bitstream position without producing stale output. Called by the player after a container seek. Read more
Source§

fn set_execution_context(&mut self, _ctx: &ExecutionContext)

Advisory: announce the runtime environment (today: a thread budget for codec-internal parallelism). Called at most once, before the first send_packet. Default no-op; codecs that want to run slice-/GOP-/tile-parallel override this to capture the budget. Ignoring the hint is always safe — callers must still work with a decoder that runs serial.

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.