pub struct AVAudioFifo { /* private fields */ }Expand description
Context for an Audio FIFO Buffer.
- Operates at the sample level rather than the byte level.
- Supports multiple channels with either planar or packed sample format.
- Automatic reallocation when writing to a full buffer.
Implementations§
Source§impl AVAudioFifo
impl AVAudioFifo
pub fn as_ptr(&self) -> *const AVAudioFifo
pub fn as_mut_ptr(&mut self) -> *mut AVAudioFifo
Sourcepub unsafe fn set_ptr(&mut self, ptr: NonNull<AVAudioFifo>)
pub unsafe fn set_ptr(&mut self, ptr: NonNull<AVAudioFifo>)
§Safety
This function should only be called when the pointer is valid and the data it’s pointing to can be dropped.
Sourcepub unsafe fn from_raw(raw: NonNull<AVAudioFifo>) -> Self
pub unsafe fn from_raw(raw: NonNull<AVAudioFifo>) -> Self
§Safety
This function should only be called when the pointer is valid and the data it’s pointing to can be dropped.
pub fn into_raw(self) -> NonNull<AVAudioFifo>
Source§impl AVAudioFifo
impl AVAudioFifo
Sourcepub fn new(sample_fmt: AVSampleFormat, channels: i32, nb_samples: i32) -> Self
pub fn new(sample_fmt: AVSampleFormat, channels: i32, nb_samples: i32) -> Self
Allocate an AVAudioFifo.
Sourcepub unsafe fn write(
&mut self,
data: *const *mut u8,
nb_samples: i32,
) -> Result<()>
pub unsafe fn write( &mut self, data: *const *mut u8, nb_samples: i32, ) -> Result<()>
Write data to an AVAudioFifo.
The AVAudioFifo will be reallocated automatically if the available space is less than nb_samples.
§Safety
Function is safe when the data points to valid samples.
Sourcepub unsafe fn peek(
&mut self,
data: *const *mut u8,
nb_samples: i32,
) -> Result<i32>
pub unsafe fn peek( &mut self, data: *const *mut u8, nb_samples: i32, ) -> Result<i32>
Peek data from an AVAudioFifo.
§Safety
Function is safe when the data points to valid sample buffer.
Sourcepub unsafe fn peek_at(
&mut self,
data: *const *mut u8,
nb_samples: i32,
offset: i32,
) -> Result<i32>
pub unsafe fn peek_at( &mut self, data: *const *mut u8, nb_samples: i32, offset: i32, ) -> Result<i32>
Peek data from an AVAudioFifo.
§Safety
Function is safe when the data points to valid sample buffer.
Sourcepub unsafe fn read(
&mut self,
data: *const *mut u8,
nb_samples: i32,
) -> Result<i32>
pub unsafe fn read( &mut self, data: *const *mut u8, nb_samples: i32, ) -> Result<i32>
Read data from an AVAudioFifo.
This function returns actually read size if success.
§Safety
Function is safe when the data points to valid array such as AVFrame::data.
Sourcepub fn drain(&mut self, nb_samples: i32)
pub fn drain(&mut self, nb_samples: i32)
Drain data from an AVAudioFifo.
Removes the data without reading it.
Sourcepub fn size(&self) -> i32
pub fn size(&self) -> i32
Get the current number of samples in the AVAudioFifo available for
reading.
Sourcepub fn space(&self) -> i32
pub fn space(&self) -> i32
Get the current number of samples in the AVAudioFifo available for
writing.