pub trait VideoEncodeBackend: Send {
// Required methods
fn name(&self) -> &str;
fn hardware(&self) -> bool;
fn timescale(&self) -> u32;
fn submit(
&mut self,
pts: i64,
planes: &[PlaneBuffer],
keyframe: bool,
) -> Result<Submit, EncodeError>;
fn receive(&mut self, wait: bool) -> Result<EncodePoll, EncodeError>;
fn finish_input(&mut self) -> Result<(), EncodeError>;
fn codec_private(&self) -> Option<Bytes>;
fn applied_rate_control(&self) -> AppliedRateControl;
// Provided method
fn settle(&mut self) -> Result<(), EncodeError> { ... }
}Expand description
One video encoder session, used from one thread at a time.
A session the platform takes away fails the encoder unless the backend can resume it in place
with the same configuration record, as VideoToolbox can and Android MediaCodec cannot.
Required Methods§
Sourcefn submit(
&mut self,
pts: i64,
planes: &[PlaneBuffer],
keyframe: bool,
) -> Result<Submit, EncodeError>
fn submit( &mut self, pts: i64, planes: &[PlaneBuffer], keyframe: bool, ) -> Result<Submit, EncodeError>
Sourcefn receive(&mut self, wait: bool) -> Result<EncodePoll, EncodeError>
fn receive(&mut self, wait: bool) -> Result<EncodePoll, EncodeError>
Takes an encoded packet, in decode order. With wait, blocks briefly for one. Once it
answers EncodePoll::Drained it keeps answering it.
§Errors
A failed encoder.
Sourcefn finish_input(&mut self) -> Result<(), EncodeError>
fn finish_input(&mut self) -> Result<(), EncodeError>
Sourcefn codec_private(&self) -> Option<Bytes>
fn codec_private(&self) -> Option<Bytes>
The decoder configuration record (avcC, hvcC, av1C), once the first packet is out.
Sourcefn applied_rate_control(&self) -> AppliedRateControl
fn applied_rate_control(&self) -> AppliedRateControl
Which form of the rate control the encoder runs.
Provided Methods§
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".