Struct FlacDecoder

Source
pub struct FlacDecoder<'a, ReadSeek>
where ReadSeek: Read + Seek + Debug,
{ /* private fields */ }
Expand description
  • The flac decoder. The FlacDecoder is a wrapper for the FlacDecoderUnmovable 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>
where ReadSeek: Read + Seek + Debug,

Source

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>

Source

pub fn finalize(self)

  • Call this function if you don’t want the decoder anymore.

Methods from Deref<Target = FlacDecoderUnmovable<'a, ReadSeek>>§

Source

pub fn initialize(&mut self) -> Result<(), FlacDecoderError>

  • The initialize() function. Sets up all of the callback functions, sets client_data to the address of the self struct.
Source

pub fn seek(&mut self, frame_index: u64) -> Result<(), FlacDecoderError>

  • Seek to the specific sample position, may fail.
Source

pub fn tell(&mut self) -> Result<u64, Error>

  • Calls your on_tell() closure to get the read position
Source

pub fn length(&mut self) -> Result<u64, Error>

  • Calls your on_length() closure to get the length of the file
Source

pub fn eof(&mut self) -> bool

  • Calls your on_eof() closure to check if reader hits the end of the file.
Source

pub fn get_vendor_string(&self) -> &Option<String>

  • Get the vendor string.
Source

pub fn get_comments(&self) -> &BTreeMap<String, String>

  • Get all of the comments or metadata.
Source

pub fn get_pictures(&self) -> &Vec<PictureData>

  • Get all of the pictures
Source

pub fn get_cue_sheets(&self) -> &Vec<FlacCueSheet>

  • Get all of the cue sheets
Source

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.
Source

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.
Source

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>
where ReadSeek: Read + Seek + Debug,

Source§

fn fmt(&self, fmt: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<'a, ReadSeek> Deref for FlacDecoder<'a, ReadSeek>
where ReadSeek: Read + Seek + Debug,

Source§

type Target = FlacDecoderUnmovable<'a, ReadSeek>

The resulting type after dereferencing.
Source§

fn deref(&self) -> &FlacDecoderUnmovable<'a, ReadSeek>

Dereferences the value.
Source§

impl<'a, ReadSeek> DerefMut for FlacDecoder<'a, ReadSeek>
where ReadSeek: Read + Seek + Debug,

Source§

fn deref_mut(&mut self) -> &mut FlacDecoderUnmovable<'a, ReadSeek>

Mutably 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> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<P, T> Receiver for P
where P: Deref<Target = T> + ?Sized, T: ?Sized,

Source§

type Target = T

🔬This is a nightly-only experimental API. (arbitrary_self_types)
The target type on which the method may be called.
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.