pub struct AudioFrame {
pub samples: u32,
pub pts: Option<i64>,
pub data: Vec<Vec<u8>>,
}Expand description
Uncompressed audio frame.
Stream-level properties (sample format, channel count, sample rate,
time base) are NOT carried per-frame — read them from the stream’s
CodecParameters. Frames stay lightweight
because real-time playback moves thousands per second per stream.
Sample layout is determined by the stream’s SampleFormat:
- Interleaved formats:
datahas one plane; samples are stored asch0 ch1 ... chN ch0 ch1 ... chN .... - Planar formats:
datahas one plane per channel.
Use SampleFormat::plane_count
with the stream’s channel count to compute the expected data.len().
Fields§
§samples: u32Number of samples per channel in this frame. Variable per-frame for VBR codecs and on partial flushes.
pts: Option<i64>§data: Vec<Vec<u8>>Raw sample bytes. Length matches format.plane_count(channels)
from the stream’s CodecParameters.
Trait Implementations§
Source§impl Clone for AudioFrame
impl Clone for AudioFrame
Source§fn clone(&self) -> AudioFrame
fn clone(&self) -> AudioFrame
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreAuto Trait Implementations§
impl Freeze for AudioFrame
impl RefUnwindSafe for AudioFrame
impl Send for AudioFrame
impl Sync for AudioFrame
impl Unpin for AudioFrame
impl UnsafeUnpin for AudioFrame
impl UnwindSafe for AudioFrame
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
Mutably borrows from an owned value. Read more