Skip to main content

AvifEncoder

Struct AvifEncoder 

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

Frame-to-AVIF encoder: every video frame becomes one complete AVIF file packet. See the module docs for the input-format mapping and the option surface.

Implementations§

Source§

impl AvifEncoder

Source

pub fn new(codec_id: CodecId) -> Self

Build an encoder announcing codec_id in its output parameters.

Source

pub fn with_params(params: CodecParameters) -> Self

Build an encoder from an explicit parameter set, reading the options leniently: unknown keys and malformed values are ignored (the historical behaviour of this constructor). Self::try_with_params — what make_encoder and the registry use — refuses them instead. Option parsing happens here (construction time), never on the frame path.

Source

pub fn try_with_params(params: CodecParameters) -> Result<Self>

Build an encoder from a parameter set whose options are parsed strictly against AvifEncoderOptions’s schema: an unknown key, a malformed value or one outside its range is InvalidData.

Source

pub fn from_options(params: CodecParameters, opts: AvifEncoderOptions) -> Self

Build an encoder from a parameter set and already-parsed options (the option bag on params is not read again).

Source

pub fn encode_options(&self) -> EncodeOptions

The still-encoder tuning this encoder codes with (q, alpha_q, the quality mapping, chroma, premultiplied, speed, and the worker threads the next frame runs on: the explicit threads option, else the execution context’s budget).

Trait Implementations§

Source§

impl Encoder for AvifEncoder

Source§

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

The worker budget for the AV1 tile search of every coded item; an explicit threads option wins over it. The bytes never depend on the budget (the tile layout follows the picture size).

Source§

fn codec_id(&self) -> &CodecId

Identifier of the codec this encoder produces.
Source§

fn output_params(&self) -> &CodecParameters

Parameters describing this encoder’s output stream (to feed into a muxer).
Source§

fn send_frame(&mut self, frame: &Frame) -> Result<()>

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

fn receive_packet(&mut self) -> Result<Packet>

Pull the next encoded packet, if any. Returns Error::NeedMore when the encoder needs another frame (or a flush).
Source§

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

Signal end of input: drain internal lookahead so the remaining packets become available via receive_packet.

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.