pub struct Vp8Decoder { /* private fields */ }Expand description
oxideav_core::Decoder impl driving [Vp8DecoderState].
Each send_packet queues one compressed packet; receive_frame
consumes queued packets and feeds them to
Vp8DecoderState::decode_frame, which threads reference frames
and entropy carry-state across calls. Both key frames and
interframes decode end-to-end; the only DecodeError::Unsupported
returned now is “interframe arrived before any key frame” (a
stream-mis-feed error, not a missing feature).
§Invisible frames
A frame whose §9.1 show_frame bit is 0 is “not for display”: it
is decoded (its §9.7 / §9.8 reference-slot side effects apply) but
no picture is returned for it — receive_frame moves on to the
next queued packet, and answers Error::NeedMore when that was
the last one. Only shown pictures reach the caller.
§Stream parameters
Decoder::output_params answers the resolved description of
the pictures this decoder returns: the §9.1 visible width /
height (the cropped size of the emitted planes, not the
macroblock-aligned one), PixelFormat::Yuv420P, and the §9.2
color_space as the colour signal’s matrix. Before the first
picture it answers from the key frame already decoded, else from
the first queued key frame’s headers.
Only a key frame can change that description (§9.1 / §9.2 are
key-frame-only fields). When the first shown picture of a new
description is about to be returned, the decoder bumps
Decoder::output_params_generation and returns one
Frame::StreamParams event carrying the new output_params()
first; the picture follows on the next call. No event is
returned for the first description, for a key frame that repeats
the current one, or for an invisible key frame (the event waits
for the first shown picture of the new size). Decoder::reset
keeps the description of the last picture returned, so a seek
into a segment of a different size announces it the same way.
The §9.1 upscale codes and the §9.2 clamping_type bit do not
change the emitted planes and are not part of the description;
Vp8Decoder::upscale / Vp8Decoder::clamping_type expose
them.
The decoder runs serially; it keeps the default no-op
Decoder::set_execution_context.
Implementations§
Source§impl Vp8Decoder
impl Vp8Decoder
Sourcepub fn new(codec_id: CodecId) -> Self
pub fn new(codec_id: CodecId) -> Self
Build a fresh decoder bound to the supplied codec id. The id is
reported verbatim by Decoder::codec_id. The internal
Vp8DecoderState starts empty — the first packet fed to
send_packet / receive_frame must be a key frame.
Sourcepub fn with_limits(codec_id: CodecId, limits: DecoderLimits) -> Self
pub fn with_limits(codec_id: CodecId, limits: DecoderLimits) -> Self
Build a decoder that enforces limits.max_pixels_per_frame as
the §9.1 declared-frame-size cap. Any key frame whose declared
width × height exceeds the cap is refused with
Error::ResourceExhausted before the decoder allocates its
macroblock grid. Constructed by make_decoder from the
CodecParameters::limits the
registry threads in. The cap survives Decoder::reset.
Sourcepub fn upscale(&self) -> Option<(ScaleCode, ScaleCode)>
pub fn upscale(&self) -> Option<(ScaleCode, ScaleCode)>
§9.1 (horizontal_scale, vertical_scale) upscale codes of the
most recently decoded key frame — a display hint that does not
change the emitted planes. None before any key frame.
Sourcepub fn clamping_type(&self) -> Option<bool>
pub fn clamping_type(&self) -> Option<bool>
§9.2 clamping_type bit of the most recently decoded key
frame (Some(true) = the encoder guarantees in-range pixels).
None before any key frame.
Trait Implementations§
Source§impl Debug for Vp8Decoder
impl Debug for Vp8Decoder
Source§impl Decoder for Vp8Decoder
impl Decoder for Vp8Decoder
Source§fn set_execution_context(&mut self, ctx: &ExecutionContext)
fn set_execution_context(&mut self, ctx: &ExecutionContext)
Take the thread budget for each frame’s decode from the framework (serial unless one is announced). The pictures do not depend on it.
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. Read moreSource§fn flush(&mut self) -> Result<()>
fn flush(&mut self) -> Result<()>
receive_frame will drain buffered
frames and eventually return Error::Eof.Source§fn reset(&mut self) -> Result<()>
fn reset(&mut self) -> Result<()>
Source§fn output_pixel_format(&self) -> Option<PixelFormat>
fn output_pixel_format(&self) -> Option<PixelFormat>
extradata, from a negotiated hardware session, or from the
decoder’s fixed output policy. Some is a fact about the
frames to come and takes precedence over the container’s
CodecParameters::pixel_format
(a stream label is a claim the container made; the decoder is
the one producing the planes). None — the default — means
“not known yet: trust the stream parameters”, and a decoder
whose output depends on the first packet (an untagged file that
decides its layout per picture) answers None until it has
seen one and the real layout afterwards. Read moreSource§fn output_params(&self) -> Option<CodecParameters>
fn output_params(&self) -> Option<CodecParameters>
Frames deliberately do not
repeat (a VideoFrame /
AudioFrame carries no width, height,
format or rate: the shape does not change 60 times a second, so
it is stated once, here, and re-stated only when it changes). Read moreSource§fn output_params_generation(&self) -> u64
fn output_params_generation(&self) -> u64
output_params:
an integer that changes whenever the output description changes
mid-stream (a resolution switch at a keyframe, a new pixel
format at a new sequence header, a sample-rate change in a
chained stream). Consumers keep the last value they saw and
compare one integer after each successful receive_frame;
only when it differs do they re-read output_params(). Frames
carry nothing extra. Read moreSource§fn receive_arena_frame(&mut self) -> Result<Arc<FrameInner>, Error>
fn receive_arena_frame(&mut self) -> Result<Arc<FrameInner>, Error>
arena::sync::Frame. Read more