pub struct VorbisSource<B: AsRef<[u8]>> { /* private fields */ }Expand description
An Ogg Vorbis file’s samples, decoded from its bytes as they are asked for. It
borrows them or owns them, as B does: a worker that outlives its caller holds
an Arc<[u8]>.
Implementations§
Source§impl<B: AsRef<[u8]>> VorbisSource<B>
impl<B: AsRef<[u8]>> VorbisSource<B>
Sourcepub fn new(bytes: B, limits: &Limits) -> Result<Self, Error>
pub fn new(bytes: B, limits: &Limits) -> Result<Self, Error>
A source of bytes, whose headers say what it holds, which must be
within limits. It decodes no audio yet.
Sourcepub fn comments(&self) -> &[(String, String)]
pub fn comments(&self) -> &[(String, String)]
The file’s comments, as it has them, each a name and its value.
Sourcepub fn comment(&self, name: &str) -> Option<&str>
pub fn comment(&self, name: &str) -> Option<&str>
The first comment called name, whatever its case, as Vorbis says names
are compared.
Sourcepub fn end_granule(&self) -> Option<u64>
pub fn end_granule(&self) -> Option<u64>
What the file’s last page says is its end, in frames from the start of the sound, if it has such a page. Nothing has checked it yet.
Sourcepub fn position(&self) -> Option<u64>
pub fn position(&self) -> Option<u64>
Where the next frame read is, in frames from the start of the sound. After a seek it isn’t known until the end of a page has been decoded.
Sourcepub fn seek_page(&mut self, frame: u64) -> Result<(), Error>
pub fn seek_page(&mut self, frame: u64) -> Result<(), Error>
Moves to the first page that ends at or past frame, or to the file’s end
if none does, dropping what was decoded of the last packet. The module’s
documentation says how to get from there to a sample. What it has decoded
still counts against the limit.
Trait Implementations§
Source§impl<B: AsRef<[u8]>> Source for VorbisSource<B>
impl<B: AsRef<[u8]>> Source for VorbisSource<B>
Source§fn total_frames(&self) -> Option<u64>
fn total_frames(&self) -> Option<u64>
Not known without decoding: the last page says, and a file can lie.