Struct openh264::encoder::Encoder

source ·
pub struct Encoder { /* private fields */ }
Expand description

An OpenH264 encoder.

Implementations§

source§

impl Encoder

source

pub fn with_config(config: EncoderConfig) -> Result<Self, Error>

Create an encoder with the provided configuration.

source

pub fn encode<T: YUVSource>( &mut self, yuv_source: &T ) -> Result<EncodedBitStream<'_>, Error>

Encodes a YUV source and returns the encoded bitstream.

The returned bitstream consists of one or more NAL units or packets. The first packets contain initialization information. Subsequent packages then contain, amongst others, keyframes (“I frames”) or delta frames. The interval at which they are produced depends on the encoder settings.

§Panics

Panics if the source image dimension don’t match the configured format.

source

pub fn encode_at<T: YUVSource>( &mut self, yuv_source: &T, timestamp: Timestamp ) -> Result<EncodedBitStream<'_>, Error>

Encodes a YUV source and returns the encoded bitstream.

The returned bitstream consists of one or more NAL units or packets. The first packets contain initialization information. Subsequent packages then contain, amongst others, keyframes (“I frames”) or delta frames. The interval at which they are produced depends on the encoder settings.

§Panics

Panics if the source image dimension don’t match the configured format.

Panics if the provided timestamp as milliseconds is out of range of i64.

source

pub unsafe fn raw_api(&mut self) -> &mut EncoderRawAPI

Obtain the raw API for advanced use cases.

When resorting to this call, please consider filing an issue / PR.

§Safety

You must not set parameters the encoder relies on, we recommend checking the source.

Trait Implementations§

source§

impl Drop for Encoder

source§

fn drop(&mut self)

Executes the destructor for this type. Read more
source§

impl Send for Encoder

source§

impl Sync for Encoder

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>,

§

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>,

§

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.