Struct FlacDecoderUnmovable

Source
pub struct FlacDecoderUnmovable<'a, ReadSeek>
where ReadSeek: Read + Seek + Debug,
{ 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 the FlacDecoderUnmovable 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 of i32 [-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>
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 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.
Source

pub fn finalize(self)

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

Trait Implementations§

Source§

impl<'a, ReadSeek> Debug for FlacDecoderUnmovable<'_, 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> Drop for FlacDecoderUnmovable<'_, ReadSeek>
where ReadSeek: Read + Seek + Debug,

Source§

fn drop(&mut self)

Executes the destructor for this type. Read more

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