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>
impl<E: VideoEncoder, M: Muxer, P: CaptureFrame> AnimationVideoEncoder<E, M, P>
Sourcepub fn new(
enc: E,
mux: M,
capture: P,
lag_frames: u32,
) -> Result<Self, AdaptError<<E as VideoEncoder>::Error, <M as Muxer>::Error>>
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>
impl<E, M, P> AnimationFrameEncoder for AnimationVideoEncoder<E, M, P>
Source§type Error = AdaptError<<E as VideoEncoder>::Error, <M as Muxer>::Error>
type Error = AdaptError<<E as VideoEncoder>::Error, <M as Muxer>::Error>
The codec-specific error type.
Source§fn reject(op: UnsupportedOperation) -> Self::Error
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>
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] ⓘ
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)
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>)
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>
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>
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>
fn finish(self, pulse: Option<&dyn Pulse>) -> Result<EncodeOutput, Self::Error>
Finalize animation. Returns the encoded bytes not already consumed
through
pending_output. Read moreSource§fn push_frame_timed(
&mut self,
pixels: PixelSlice<'_>,
duration: FrameDuration,
pulse: Option<&dyn Pulse>,
) -> Result<FrameDuration, Self::Error>
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>
impl<E, M, P> RefUnwindSafe for AnimationVideoEncoder<E, M, P>
impl<E, M, P> Send for AnimationVideoEncoder<E, M, P>
impl<E, M, P> Sync for AnimationVideoEncoder<E, M, P>
impl<E, M, P> Unpin for AnimationVideoEncoder<E, M, P>
impl<E, M, P> UnsafeUnpin for AnimationVideoEncoder<E, M, P>
impl<E, M, P> UnwindSafe for AnimationVideoEncoder<E, M, P>
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more