Skip to main content

ToyEncoder

Struct ToyEncoder 

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

Toy encoder: one gray picture per packet, lookahead frames held back, a random-access point every keyint packets.

Implementations§

Source§

impl ToyEncoder

Source

pub fn new( width: u32, height: u32, time_base: TimeBase, lookahead: usize, keyint: u64, ) -> Self

An encoder of width x height grey pictures on time_base, holding lookahead frames and marking every keyint-th packet as a random-access point.

Source

pub fn lookahead(&self) -> usize

Frames held before their packet comes out.

Trait Implementations§

Source§

impl VideoEncoder for ToyEncoder

Source§

type Error = ToyError

The implementation’s error.
Source§

fn send( &mut self, frame: &Frame, stop: Option<&dyn Pulse>, ) -> Result<SendStatus, SessionError<ToyError>>

Offer a frame handle. The encoder clones it to queue (no pixel copy is required by the contract; a backend may copy into padded planes).
Source§

fn receive( &mut self, stop: Option<&dyn Pulse>, ) -> Result<Receive<Packet>, SessionError<ToyError>>

One packet at a time, in decode order, carrying the presentation timestamp of the frame it shows.
Source§

fn end_input(&mut self) -> Result<(), SessionError<ToyError>>

Declare end of input; idempotent. Then receive until EndOfStream.
Source§

fn output_config(&self) -> Option<&CodecConfig>

Codec configuration a muxer needs before the first packet.
Source§

fn output_fidelity(&self) -> Option<Fidelity>

Fidelity guaranteed by this actual prepared encoder for every accepted input frame. None means unqualified, not lossy or lossless. A guarantee must not be inferred from codec identity or an unvalidated request. This describes encoding only; preceding conversion may lose samples. Fixed-configuration operations bind this value with output_config and reject a later change before publishing staged output.

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.