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§
Sourcefn info(&self) -> Result<DsdSourceInfo, DsdSourceError>
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.
Sourcefn reader(&self) -> Result<Box<dyn Read + Send>, DsdSourceError>
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.
Sourcefn file_len(&self) -> Result<u64, DsdSourceError>
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§
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>
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".