pub struct FlacDecoderUnmovable<'a, ReadSeek>{
pub scale_to_i32_range: bool,
pub desired_audio_form: FlacAudioForm,
pub vendor_string: Option<String>,
pub comments: BTreeMap<String, String>,
pub pictures: Vec<PictureData>,
pub cue_sheets: Vec<FlacCueSheet>,
/* private fields */
}
Expand description
- The flac decoder. The
FlacDecoder
is a wrapper for theFlacDecoderUnmovable
what prevents the structure moves.
§The decoder’s core structure, but can’t move after initialize()
has been called.
Use a Box
to contain it, or just don’t move it will be fine.
Fields§
§scale_to_i32_range: bool
- Scale to
i32
range or not, if set to true, the sample will be scaled to the whole range ofi32
[-2147483648, +2147483647] if bits per sample is not 32.
desired_audio_form: FlacAudioForm
- The desired form of audio you want to receive.
vendor_string: Option<String>
- The vendor string read from the FLAC file.
comments: BTreeMap<String, String>
- The comments, or metadata read from the FLAC file.
pictures: Vec<PictureData>
- The pictures, or CD cover read from the FLAC file.
cue_sheets: Vec<FlacCueSheet>
- The cue sheets read from the FLAC file.
Implementations§
Source§impl<'a, ReadSeek> FlacDecoderUnmovable<'a, ReadSeek>
impl<'a, ReadSeek> FlacDecoderUnmovable<'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>
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 FlacDecoderUnmovable<'_, ReadSeek>
impl<'a, ReadSeek> Debug for FlacDecoderUnmovable<'_, ReadSeek>
Auto Trait Implementations§
impl<'a, ReadSeek> Freeze for FlacDecoderUnmovable<'a, ReadSeek>where
ReadSeek: Freeze,
impl<'a, ReadSeek> !RefUnwindSafe for FlacDecoderUnmovable<'a, ReadSeek>
impl<'a, ReadSeek> !Send for FlacDecoderUnmovable<'a, ReadSeek>
impl<'a, ReadSeek> !Sync for FlacDecoderUnmovable<'a, ReadSeek>
impl<'a, ReadSeek> Unpin for FlacDecoderUnmovable<'a, ReadSeek>where
ReadSeek: Unpin,
impl<'a, ReadSeek> !UnwindSafe for FlacDecoderUnmovable<'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