Encoder

Struct Encoder 

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

Encodes video.

Implementations§

Source§

impl Encoder

Source

pub fn builder() -> Setup

Creates a new builder with default options.

For more options see Setup::new.

Source

pub fn encode( &mut self, pts: i64, image: Image<'_>, ) -> Result<(Data<'_>, Picture)>

Feeds a frame to the encoder.

§Panics

Panics if there is a mismatch between the image and the encoder regarding width, height or colorspace.

Source

pub unsafe fn encode_drh( &mut self, image: Image<'_>, idr: bool, context: *mut c_void, ) -> Result<Picture>

Feeds a frame to the encoder relying on a nalu_process callback for further processing

§Safety

context must be a valid pointer to pass to the callback assigned to x264_param_t.nalu_process

Source

pub unsafe fn encode_unchecked( &mut self, pts: i64, image: Image<'_>, ) -> Result<(Data<'_>, Picture)>

Feeds a frame to the encoder.

§Unsafety

The caller must ensure that the width, height and colorspace of the image are the same as that of the encoder.

Source

pub fn headers(&mut self) -> Result<Data<'_>>

Gets the video headers, which should be sent first.

Source

pub fn flush(self) -> Flush

Begins flushing the encoder, to handle any delayed frames.

let mut flush = encoder.flush();

while let Some(result) = flush.next() {
    if let Ok((data, picture)) = result {
        // Handle data.
    }
}
Source

pub fn width(&self) -> i32

The width required of any input images.

Source

pub fn height(&self) -> i32

The height required of any input images.

Source

pub fn encoding(&self) -> Encoding

The encoding required of any input images.

Trait Implementations§

Source§

impl Drop for Encoder

Source§

fn drop(&mut self)

Executes the destructor for this 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 = 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.