pub struct Stream { /* private fields */ }Expand description
Time-synchronized PCM stream buffer.
Implementations§
Source§impl Stream
impl Stream
Sourcepub fn new(format: SampleFormat) -> Self
pub fn new(format: SampleFormat) -> Self
Create a new stream for the given sample format.
Sourcepub fn format(&self) -> SampleFormat
pub fn format(&self) -> SampleFormat
Returns the sample format.
Sourcepub fn set_buffer_ms(&mut self, ms: i64)
pub fn set_buffer_ms(&mut self, ms: i64)
Set the target buffer size in milliseconds.
Sourcepub fn chunk_count(&self) -> usize
pub fn chunk_count(&self) -> usize
Number of queued chunks.
Sourcepub fn get_player_chunk(
&mut self,
server_now_usec: i64,
output_buffer_dac_time_usec: i64,
output: &mut [u8],
frames: u32,
) -> bool
pub fn get_player_chunk( &mut self, server_now_usec: i64, output_buffer_dac_time_usec: i64, output: &mut [u8], frames: u32, ) -> bool
Fill output with time-synchronized PCM data. Returns false if no data available.
Sourcepub fn get_silence(&self, output: &mut [u8], frames: u32)
pub fn get_silence(&self, output: &mut [u8], frames: u32)
Fill output with silence.
Sourcepub fn get_player_chunk_or_silence(
&mut self,
server_now_usec: i64,
output_buffer_dac_time_usec: i64,
output: &mut [u8],
frames: u32,
) -> bool
pub fn get_player_chunk_or_silence( &mut self, server_now_usec: i64, output_buffer_dac_time_usec: i64, output: &mut [u8], frames: u32, ) -> bool
Like get_player_chunk, but fills silence on failure.
Auto Trait Implementations§
impl Freeze for Stream
impl RefUnwindSafe for Stream
impl Send for Stream
impl Sync for Stream
impl Unpin for Stream
impl UnsafeUnpin for Stream
impl UnwindSafe for Stream
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