pub struct AudioOnlyTranscoder { /* private fields */ }Expand description
Audio-only transcoder.
Accepts raw PCM samples (f32, -1.0..=1.0), applies channel mapping and level adjustments, and returns the processed output samples.
In a full pipeline this struct would wrap actual codec encode/decode calls; here it provides the configuration layer and frame-level processing hooks that the codec pipeline can call.
Implementations§
Source§impl AudioOnlyTranscoder
impl AudioOnlyTranscoder
Sourcepub fn new(config: AudioOnlyConfig) -> Self
pub fn new(config: AudioOnlyConfig) -> Self
Creates a new AudioOnlyTranscoder from a validated config.
Sourcepub fn config(&self) -> &AudioOnlyConfig
pub fn config(&self) -> &AudioOnlyConfig
Returns the active configuration.
Sourcepub fn codec_name(&self) -> &str
pub fn codec_name(&self) -> &str
Returns the output codec name string.
Sourcepub fn estimated_bitrate(&self) -> u32
pub fn estimated_bitrate(&self) -> u32
Returns the effective output bitrate in bits per second.
If config.bitrate is 0 the codec default is returned.
Sourcepub fn frames_processed(&self) -> u64
pub fn frames_processed(&self) -> u64
Number of audio frames processed since creation (or last reset).
Sourcepub fn transcode_samples(&mut self, input: &[f32]) -> Result<Vec<f32>>
pub fn transcode_samples(&mut self, input: &[f32]) -> Result<Vec<f32>>
Process a block of interleaved PCM samples.
Input samples must be interleaved with the number of channels declared in
the config, in f32 format. Output length equals input length after
channel mapping (no sample-rate conversion is performed in this stub –
that would be delegated to oximedia-audio::resample).
§Errors
Returns TranscodeError::InvalidInput when:
inputlength is not a multiple ofchannels- any individual sample is NaN or infinite
Sourcepub fn update_config(
&mut self,
input_codec: AudioCodecId,
output_codec: AudioCodecId,
sample_rate: u32,
channels: u8,
bitrate: u32,
) -> Result<()>
pub fn update_config( &mut self, input_codec: AudioCodecId, output_codec: AudioCodecId, sample_rate: u32, channels: u8, bitrate: u32, ) -> Result<()>
Update the config on the fly (e.g. for adaptive bitrate pipelines).
§Errors
Returns an error if the new config fails validation.
Auto Trait Implementations§
impl Freeze for AudioOnlyTranscoder
impl RefUnwindSafe for AudioOnlyTranscoder
impl Send for AudioOnlyTranscoder
impl Sync for AudioOnlyTranscoder
impl Unpin for AudioOnlyTranscoder
impl UnsafeUnpin for AudioOnlyTranscoder
impl UnwindSafe for AudioOnlyTranscoder
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more