ac_ffmpeg::codec::audio::resampler

Struct AudioResampler

Source
pub struct AudioResampler { /* private fields */ }
Expand description

Audio resampler.

§Resampler operation

  1. Push an audio frame to the resampler.
  2. Take all frames from the resampler until you get None.
  3. If there are more frames to be resampled, continue with 1.
  4. Flush the resampler.
  5. Take all frames from the resampler until you get None.

Timestamps of the output frames will be in 1 / target_sample_rate time base.

Implementations§

Source§

impl AudioResampler

Source

pub fn builder() -> AudioResamplerBuilder

Get a builder for the audio resampler.

Source

pub fn push(&mut self, frame: AudioFrame) -> Result<(), Error>

Push a given frame to the resampler.

§Panics

The method panics if the operation is not expected (i.e. another operation needs to be done).

Source

pub fn try_push(&mut self, frame: AudioFrame) -> Result<(), CodecError>

Push a given frame to the resampler.

Source

pub fn flush(&mut self) -> Result<(), Error>

Flush the resampler.

§Panics

The method panics if the operation is not expected (i.e. another operation needs to be done).

Source

pub fn try_flush(&mut self) -> Result<(), CodecError>

Flush the resampler.

Source

pub fn take(&mut self) -> Result<Option<AudioFrame>, Error>

Take a frame from the resampler (if available).

Trait Implementations§

Source§

impl Drop for AudioResampler

Source§

fn drop(&mut self)

Executes the destructor for this type. Read more
Source§

impl Send for AudioResampler

Source§

impl Sync for AudioResampler

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

Source§

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

Source§

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.