Skip to main content

AnimationVideoEncoder

Struct AnimationVideoEncoder 

Source
pub struct AnimationVideoEncoder<E, M, P> { /* private fields */ }
Expand description

A full-canvas animation encoder over a video encoder and a muxer.

Frames get timestamps on the encoder’s clock, starting at zero; a duration that is not a whole number of ticks is refused as UnsupportedOperation::AnimationTiming before the frame is accepted.

Implementations§

Source§

impl<E: VideoEncoder, M: Muxer, P: CaptureFrame> AnimationVideoEncoder<E, M, P>

Source

pub fn new( enc: E, mux: M, capture: P, lag_frames: u32, ) -> Result<Self, AdaptError<<E as VideoEncoder>::Error, <M as Muxer>::Error>>

Encode with enc into mux, converting through capture. lag_frames is the encoder’s lookahead, reported through begin when the muxer streams.

§Errors

AdaptError::Shape when the encoder has no video output configuration yet.

Trait Implementations§

Source§

impl<E, M, P> AnimationFrameEncoder for AnimationVideoEncoder<E, M, P>
where E: VideoEncoder + Send, M: Muxer + Send, P: CaptureFrame + Send,

Source§

type Error = AdaptError<<E as VideoEncoder>::Error, <M as Muxer>::Error>

The codec-specific error type.
Source§

fn reject(op: UnsupportedOperation) -> Self::Error

Convert an UnsupportedOperation into this encoder’s error type. Used by default method implementations.
Source§

fn begin( &mut self, width: u32, height: u32, _descriptor: PixelDescriptor, frame_count: Option<u32>, ) -> Result<AnimationOutputTiming, Self::Error>

Declare the animation before the first frame: its canvas, the descriptor frames will arrive in, and how many frames will follow when the caller knows. Returns when this encoder’s bytes will become available. Read more
Source§

fn pending_output(&self) -> &[u8] ⓘ

Encoded bytes ready to send, not yet consumed; see Encoder::pending_output. Default: empty.
Source§

fn consume_output(&mut self, n: usize)

Mark the first n bytes of pending_output as sent, clamped to its length. Default: no-op.
Source§

fn take_output(&mut self, into: &mut Vec<u8>)

Append every pending byte to into and consume it; see Encoder::take_output. Default: copies.
Source§

fn push_frame( &mut self, pixels: PixelSlice<'_>, duration_ms: u32, pulse: Option<&dyn Pulse>, ) -> Result<(), Self::Error>

Push a complete full-canvas frame. Read more
Source§

fn push_frame_exact( &mut self, pixels: PixelSlice<'_>, duration: FrameDuration, pulse: Option<&dyn Pulse>, ) -> Result<(), Self::Error>

Push a frame with its exact encoded source duration. Read more
Source§

fn finish(self, pulse: Option<&dyn Pulse>) -> Result<EncodeOutput, Self::Error>

Finalize animation. Returns the encoded bytes not already consumed through pending_output. Read more
Source§

fn push_frame_timed( &mut self, pixels: PixelSlice<'_>, duration: FrameDuration, pulse: Option<&dyn Pulse>, ) -> Result<FrameDuration, Self::Error>

Push a frame using the destination’s timing resolution. Read more

Auto Trait Implementations§

§

impl<E, M, P> Freeze for AnimationVideoEncoder<E, M, P>
where E: Freeze, M: Freeze, P: Freeze,

§

impl<E, M, P> RefUnwindSafe for AnimationVideoEncoder<E, M, P>

§

impl<E, M, P> Send for AnimationVideoEncoder<E, M, P>
where E: Send, M: Send, P: Send,

§

impl<E, M, P> Sync for AnimationVideoEncoder<E, M, P>
where E: Sync, M: Sync, P: Sync,

§

impl<E, M, P> Unpin for AnimationVideoEncoder<E, M, P>
where E: Unpin, M: Unpin, P: Unpin,

§

impl<E, M, P> UnsafeUnpin for AnimationVideoEncoder<E, M, P>

§

impl<E, M, P> UnwindSafe for AnimationVideoEncoder<E, M, P>
where E: UnwindSafe, M: UnwindSafe, P: UnwindSafe,

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.