Skip to main content

Decoder

Struct Decoder 

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

A VP8 decoder.

Feed it whole frames in order with Decoder::decode. It starts at a keyframe and, after any error, waits for the next keyframe (DecodeError::NeedKeyframe).

Implementations§

Source§

impl Decoder

Source

pub fn new() -> Self

A decoder waiting for its first keyframe.

Source

pub fn set_max_pixels(&mut self, max_pixels: u64)

Sets the largest frame (width times height) the decoder accepts. A larger keyframe fails with Unsupported instead of allocating. The default, DEFAULT_MAX_PIXELS, allows 4096x2304.

Source

pub fn reset(&mut self)

Forgets the stream: the next frame must be a keyframe.

Source

pub fn last_frame_info(&self) -> Option<FrameInfo>

The header of the last frame decoded successfully.

Source

pub fn dimensions(&self) -> Option<(u32, u32)>

The current coded size, after at least one keyframe.

Source

pub fn color_space_reserved(&self) -> bool

The colour space bit of the last keyframe: false for BT.601 (the only one RFC 6386 defines).

Source

pub fn decode( &mut self, data: &[u8], ) -> Result<Option<Picture<'_>>, DecodeError>

Decodes one frame. Returns the picture to display, or None for a frame that is not shown (it only updates reference frames). The picture borrows the decoder until the next call.

Trait Implementations§

Source§

impl Default for Decoder

Source§

fn default() -> Self

Returns the “default value” for a type. Read more

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 = !

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

fn try_from(value: U) -> Result<T, !>

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.