pub struct PcmChunk {
pub timestamp: Timeval,
pub data: Vec<u8>,
pub format: SampleFormat,
/* private fields */
}Expand description
A decoded PCM chunk with a server-time timestamp and a read cursor.
Fields§
§timestamp: TimevalServer-time timestamp of this chunk.
data: Vec<u8>Raw PCM sample data.
format: SampleFormatSample format (rate, bits, channels).
Implementations§
Source§impl PcmChunk
impl PcmChunk
Sourcepub fn new(timestamp: Timeval, data: Vec<u8>, format: SampleFormat) -> Self
pub fn new(timestamp: Timeval, data: Vec<u8>, format: SampleFormat) -> Self
Create a new PCM chunk.
Sourcepub fn start_usec(&self) -> i64
pub fn start_usec(&self) -> i64
Start time of this chunk in microseconds.
Sourcepub fn duration_usec(&self) -> i64
pub fn duration_usec(&self) -> i64
Duration of this chunk in microseconds.
Sourcepub fn read_frames(&mut self, output: &mut [u8], frames: u32) -> u32
pub fn read_frames(&mut self, output: &mut [u8], frames: u32) -> u32
Read up to frames frames into output, returning the number read.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for PcmChunk
impl RefUnwindSafe for PcmChunk
impl Send for PcmChunk
impl Sync for PcmChunk
impl Unpin for PcmChunk
impl UnsafeUnpin for PcmChunk
impl UnwindSafe for PcmChunk
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