Skip to main content

DsfFile

Struct DsfFile 

Source
pub struct DsfFile { /* private fields */ }
Expand description

In memory representation of a DSF file.

The DSF File Format Specification divides a DSF file into four chunks:

  • DSD chunk: basic file headers, size and pointers to other chunks.
  • Fmt chunk: information about the audio format e.g. sampling rate, etc.
  • Data chunk: the audio samples.
  • Metadata chunk: an optional ID3v2 metadata tag.

The fields of the DsfFile struct reflect this specification, with an additional File field for the underlying file, and a Tag read error field to store any error that occurred while reading the ID3 tag.

Implementations§

Source§

impl DsfFile

Source

pub fn open(path: &Path) -> Result<DsfFile, Error>

Attempt to open and parse the metadata of DSF file in read-only mode. Sample data is not read into memory to keep the memory footprint small.

§Errors

This function will return an error if path does not exist or is not a readable and valid DSF file.

§Examples
 use dsf_meta::DsfFile;
 use std::path::Path;

 let path = Path::new("my/music.dsf");

 match DsfFile::open(path) {
     Ok(dsf_file) => {
         println!("DSF file metadata:\n\n{}", dsf_file);
     }
     Err(error) => {
         println!("Error: {}", error);
     }
 }
Source

pub fn file(&self) -> &File

Return a reference to the underlying File

Source

pub fn dsd_chunk(&self) -> &DsdChunk

Return a reference to the DsdChunk.

Source

pub fn fmt_chunk(&self) -> &FmtChunk

Return a reference to the FmtChunk.

Source

pub fn data_chunk(&self) -> &DataChunk

Return a reference to the DataChunk.

Source

pub fn id3_tag(&self) -> &Option<Tag>

Return a reference to the optional ID3v2 Tag

Source

pub fn tag_read_err(&self) -> Option<&Error>

Return the error if attempt to read the ID3 tag failed.

Trait Implementations§

Source§

impl Display for DsfFile

Source§

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

Formats the value using the given formatter. Read more

Auto Trait Implementations§

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> ToString for T
where T: Display + ?Sized,

Source§

fn to_string(&self) -> String

Converts the given value to a String. Read more
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.