pub struct SwAudioEncoderOptions {
pub codec: AudioCodec,
pub sample_rate: u32,
pub channels: u16,
pub time_base: Rational,
pub bit_rate: usize,
}Expand description
Construction-time options for SwAudioEncoder::new. sample_rate/
channels/time_base must already be known — same convention as
crate::elements::SwEncoder’s own width/height/time_base —
rather than inferred from the first frame, since avcodec_open2 needs
them set before this can be opened at all. What’s actually fed to
this element doesn’t have to match sample_rate/channels exactly —
see SwAudioEncoder’s own docs on why.
Fields§
§codec: AudioCodecCompressed audio codec to open.
sample_rate: u32Encoder output sample rate, in hertz. A codec that accepts only
certain rates rejects the rest at construction with
SwAudioEncoderError::UnsupportedSampleRate —
AudioCodec::Opus takes 48/24/16/12/8 kHz and nothing else,
where AudioCodec::Aac takes any.
channels: u16Encoder output channel count.
time_base: RationalMust match the pts unit of whatever frames this receives — e.g.
crate::elements::TestAudioSource::time_base/
crate::elements::AudioMixer::time_base.
bit_rate: usizeTarget encoded bit rate, in bits per second.
Trait Implementations§
Source§impl Clone for SwAudioEncoderOptions
impl Clone for SwAudioEncoderOptions
Source§fn clone(&self) -> SwAudioEncoderOptions
fn clone(&self) -> SwAudioEncoderOptions
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more