pub struct Encoder { /* private fields */ }Expand description
An OpenH264 encoder.
Implementations§
source§impl Encoder
impl Encoder
sourcepub fn with_config(config: EncoderConfig) -> Result<Self, Error>
pub fn with_config(config: EncoderConfig) -> Result<Self, Error>
Create an encoder with the provided configuration.
sourcepub fn encode<T: YUVSource>(
&mut self,
yuv_source: &T
) -> Result<EncodedBitStream<'_>, Error>
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.
sourcepub fn encode_at<T: YUVSource>(
&mut self,
yuv_source: &T,
timestamp: Timestamp
) -> Result<EncodedBitStream<'_>, Error>
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.
sourcepub unsafe fn raw_api(&mut self) -> &mut EncoderRawAPI
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.