Skip to main content

DsdSource

Trait DsdSource 

Source
pub trait DsdSource: Send {
    // Required methods
    fn info(&self) -> Result<DsdSourceInfo, DsdSourceError>;
    fn reader(&self) -> Result<Box<dyn Read + Send>, DsdSourceError>;
    fn file_len(&self) -> Result<u64, DsdSourceError>;

    // Provided methods
    fn channels(&self) -> Option<usize> { ... }
    fn endianness(&self) -> Option<Endianness> { ... }
    fn layout(&self) -> Option<FmtType> { ... }
    fn block_size(&self) -> Option<u32> { ... }
    fn sample_rate(&self) -> Option<u32> { ... }
    fn audio_length(&self) -> Option<u64> { ... }
    fn data_offset(&self) -> Option<u64> { ... }
    fn tag(&self) -> Option<Tag> { ... }
}
Expand description

A source of DSD audio data with a known native shape.

Implementers describe how their audio is laid out (see DsdSourceInfo) and provide a reader that yields that data as raw bytes, starting from the first byte of audio data. Implementers are not responsible for converting between planar/interleaved layouts or bit endianness; that is the responsibility of the reader consuming this trait.

Required Methods§

Source

fn info(&self) -> Result<DsdSourceInfo, DsdSourceError>

Describes the native shape of this source’s audio data. Fallible since some containers only discover certain properties (e.g. channel count, sample rate) while parsing, and may not have them available even after a successful open.

Source

fn reader(&self) -> Result<Box<dyn Read + Send>, DsdSourceError>

Returns a fresh, independent byte stream of this source’s native-shape audio data, positioned at the first byte of audio data.

Source

fn file_len(&self) -> Result<u64, DsdSourceError>

Total size of the underlying file, in bytes. Distinct from audio_length (which describes only the audio data): callers use this to sanity-check a source’s reported audio_length against what the file can actually contain, without needing to re-stat the path themselves.

Provided Methods§

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§