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
impl WebpDecoder
Sourcepub fn new(params: CodecParameters) -> Self
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.
Sourcepub fn params(&self) -> &CodecParameters
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
impl Debug for WebpDecoder
Source§impl Decoder for WebpDecoder
impl Decoder for WebpDecoder
fn codec_id(&self) -> &CodecId
Source§fn send_packet(&mut self, packet: &Packet) -> Result<()>
fn send_packet(&mut self, packet: &Packet) -> Result<()>
receive_frame in a loop afterwards.Source§fn receive_frame(&mut self) -> Result<Frame>
fn receive_frame(&mut self) -> Result<Frame>
Error::NeedMore when the
decoder needs another packet.Source§fn flush(&mut self) -> Result<()>
fn flush(&mut self) -> Result<()>
receive_frame will drain buffered
frames and eventually return Error::Eof.Source§fn receive_arena_frame(&mut self) -> Result<Arc<FrameInner>, Error>
fn receive_arena_frame(&mut self) -> Result<Arc<FrameInner>, Error>
arena::sync::Frame. Read moreSource§fn reset(&mut self) -> Result<(), Error>
fn reset(&mut self) -> Result<(), Error>
Source§fn set_execution_context(&mut self, _ctx: &ExecutionContext)
fn set_execution_context(&mut self, _ctx: &ExecutionContext)
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.