pub struct FlacEncoder { /* private fields */ }Expand description
FLAC audio encoder.
Implementations§
Source§impl FlacEncoder
impl FlacEncoder
Sourcepub fn new(config: FlacConfig) -> Self
pub fn new(config: FlacConfig) -> Self
Create a new FLAC encoder.
Sourcepub fn stream_header(&self) -> Vec<u8> ⓘ
pub fn stream_header(&self) -> Vec<u8> ⓘ
Generate the FLAC stream header (fLaC magic + STREAMINFO block).
Must be placed at the start of the stream before any frames.
Sourcepub fn encode(
&mut self,
samples: &[i32],
) -> CodecResult<(Vec<u8>, Vec<FlacFrame>)>
pub fn encode( &mut self, samples: &[i32], ) -> CodecResult<(Vec<u8>, Vec<FlacFrame>)>
Encode interleaved i32 PCM samples into one or more FLAC frames.
samples is interleaved: [ch0_s0, ch1_s0, ch0_s1, ch1_s1, ...].
Returns (stream_header, frames) on the first call, or just frames on
subsequent calls. Use stream_header() for the initial fLaC header.
§Errors
Returns CodecError::InvalidParameter if the sample count is not a
multiple of channels.
Auto Trait Implementations§
impl Freeze for FlacEncoder
impl RefUnwindSafe for FlacEncoder
impl Send for FlacEncoder
impl Sync for FlacEncoder
impl Unpin for FlacEncoder
impl UnsafeUnpin for FlacEncoder
impl UnwindSafe for FlacEncoder
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
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more