pub struct FlacDecoder<'a, ReadSeek>{ /* private fields */ }
Expand description
- The flac decoder. The
FlacDecoder
is a wrapper for theFlacDecoderUnmovable
what prevents the structure moves.
§A wrapper for FlacDecoderUnmovable
, which provides a Box to make FlacDecoderUnmovable
never move.
This is the struct that should be mainly used by you.
Implementations§
Source§impl<'a, ReadSeek> FlacDecoder<'a, ReadSeek>
impl<'a, ReadSeek> FlacDecoder<'a, ReadSeek>
pub fn new( reader: ReadSeek, on_read: Box<dyn FnMut(&mut ReadSeek, &mut [u8]) -> (usize, FlacReadStatus) + 'a>, on_seek: Box<dyn FnMut(&mut ReadSeek, u64) -> Result<(), Error> + 'a>, on_tell: Box<dyn FnMut(&mut ReadSeek) -> Result<u64, Error> + 'a>, on_length: Box<dyn FnMut(&mut ReadSeek) -> Result<u64, Error> + 'a>, on_eof: Box<dyn FnMut(&mut ReadSeek) -> bool + 'a>, on_write: Box<dyn FnMut(&[Vec<i32>], &SamplesInfo) -> Result<(), Error> + 'a>, on_error: Box<dyn FnMut(FlacInternalDecoderError) + 'a>, md5_checking: bool, scale_to_i32_range: bool, desired_audio_form: FlacAudioForm, ) -> Result<Self, FlacDecoderError>
Methods from Deref<Target = FlacDecoderUnmovable<'a, ReadSeek>>§
Sourcepub fn initialize(&mut self) -> Result<(), FlacDecoderError>
pub fn initialize(&mut self) -> Result<(), FlacDecoderError>
- The
initialize()
function. Sets up all of the callback functions, setsclient_data
to the address of theself
struct.
Sourcepub fn seek(&mut self, frame_index: u64) -> Result<(), FlacDecoderError>
pub fn seek(&mut self, frame_index: u64) -> Result<(), FlacDecoderError>
- Seek to the specific sample position, may fail.
Sourcepub fn tell(&mut self) -> Result<u64, Error>
pub fn tell(&mut self) -> Result<u64, Error>
- Calls your
on_tell()
closure to get the read position
Sourcepub fn length(&mut self) -> Result<u64, Error>
pub fn length(&mut self) -> Result<u64, Error>
- Calls your
on_length()
closure to get the length of the file
Sourcepub fn eof(&mut self) -> bool
pub fn eof(&mut self) -> bool
- Calls your
on_eof()
closure to check ifreader
hits the end of the file.
Sourcepub fn get_vendor_string(&self) -> &Option<String>
pub fn get_vendor_string(&self) -> &Option<String>
- Get the vendor string.
Sourcepub fn get_comments(&self) -> &BTreeMap<String, String>
pub fn get_comments(&self) -> &BTreeMap<String, String>
- Get all of the comments or metadata.
Sourcepub fn get_pictures(&self) -> &Vec<PictureData>
pub fn get_pictures(&self) -> &Vec<PictureData>
- Get all of the pictures
Sourcepub fn get_cue_sheets(&self) -> &Vec<FlacCueSheet>
pub fn get_cue_sheets(&self) -> &Vec<FlacCueSheet>
- Get all of the cue sheets
Sourcepub fn decode(&mut self) -> Result<bool, FlacDecoderError>
pub fn decode(&mut self) -> Result<bool, FlacDecoderError>
- Decode one FLAC frame, may get an audio frame or a metadata frame.
- Your closures will be called by the decoder when you call this method.
Sourcepub fn decode_all(&mut self) -> Result<bool, FlacDecoderError>
pub fn decode_all(&mut self) -> Result<bool, FlacDecoderError>
- Decode all of the FLAC frames, get all of the samples and metadata and pictures and cue sheets, etc.
Sourcepub fn finish(&mut self) -> Result<(), FlacDecoderError>
pub fn finish(&mut self) -> Result<(), FlacDecoderError>
- Finish decoding the FLAC file, the remaining samples will be returned to you via your
on_write()
closure.
Trait Implementations§
Source§impl<'a, ReadSeek> Debug for FlacDecoder<'_, ReadSeek>
impl<'a, ReadSeek> Debug for FlacDecoder<'_, ReadSeek>
Source§impl<'a, ReadSeek> Deref for FlacDecoder<'a, ReadSeek>
impl<'a, ReadSeek> Deref for FlacDecoder<'a, ReadSeek>
Source§type Target = FlacDecoderUnmovable<'a, ReadSeek>
type Target = FlacDecoderUnmovable<'a, ReadSeek>
The resulting type after dereferencing.
Source§fn deref(&self) -> &FlacDecoderUnmovable<'a, ReadSeek>
fn deref(&self) -> &FlacDecoderUnmovable<'a, ReadSeek>
Dereferences the value.
Auto Trait Implementations§
impl<'a, ReadSeek> Freeze for FlacDecoder<'a, ReadSeek>
impl<'a, ReadSeek> !RefUnwindSafe for FlacDecoder<'a, ReadSeek>
impl<'a, ReadSeek> !Send for FlacDecoder<'a, ReadSeek>
impl<'a, ReadSeek> !Sync for FlacDecoder<'a, ReadSeek>
impl<'a, ReadSeek> Unpin for FlacDecoder<'a, ReadSeek>
impl<'a, ReadSeek> !UnwindSafe for FlacDecoder<'a, ReadSeek>
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