[−][src]Struct lewton::inside_ogg::OggStreamReader
Reading ogg/vorbis files or streams
This is a small helper struct to help reading ogg/vorbis files or streams in that format.
It only supports the main use case of pure audio ogg files streams. Reading a file where vorbis is only one of multiple streams, like in the case of ogv, is not supported.
If you need support for this, you need to use the lower level methods instead.
Fields
ident_hdr: IdentHeader
comment_hdr: CommentHeader
setup_hdr: SetupHeader
Methods
impl<T: Read + Seek> OggStreamReader<T>
[src]
pub fn new(rdr: T) -> Result<Self, VorbisError>
[src]
Constructs a new OggStreamReader from a given implementation of Read + Seek
.
Please note that this function doesn't work well with async
I/O. In order to support this use case, enable the async_ogg
feature,
and use the HeadersReader
struct instead.
pub fn from_ogg_reader(rdr: PacketReader<T>) -> Result<Self, VorbisError>
[src]
Constructs a new OggStreamReader from a given Ogg PacketReader.
The new
function is a nice wrapper around this function that
also creates the ogg reader.
Please note that this function doesn't work well with async
I/O. In order to support this use case, enable the async_ogg
feature,
and use the HeadersReader
struct instead.
pub fn into_inner(self) -> PacketReader<T>
[src]
pub fn read_dec_packet(&mut self) -> Result<Option<Vec<Vec<i16>>>, VorbisError>
[src]
Reads and decompresses an audio packet from the stream.
On read errors, it returns Err(e) with the error.
On success, it either returns None, when the end of the stream has been reached, or Some(packet_data), with the data of the decompressed packet.
pub fn read_dec_packet_generic<S: Samples>(
&mut self
) -> Result<Option<S>, VorbisError>
[src]
&mut self
) -> Result<Option<S>, VorbisError>
Reads and decompresses an audio packet from the stream (generic).
On read errors, it returns Err(e) with the error.
On success, it either returns None, when the end of the stream has been reached, or Some(packet_data), with the data of the decompressed packet.
pub fn read_dec_packet_itl(&mut self) -> Result<Option<Vec<i16>>, VorbisError>
[src]
Reads and decompresses an audio packet from the stream (interleaved).
On read errors, it returns Err(e) with the error.
On success, it either returns None, when the end of the stream has been reached, or Some(packet_data), with the data of the decompressed packet.
Unlike read_dec_packet
, this function returns the
interleaved samples.
pub fn stream_serial(&self) -> u32
[src]
Returns the stream serial of the current stream
The stream serial can change in chained ogg files.
pub fn get_last_absgp(&self) -> Option<u64>
[src]
Returns the absolute granule position of the last read page.
In the case of ogg/vorbis, the absolute granule position is given as number of PCM samples, on a per channel basis.
pub fn seek_absgp_pg(&mut self, absgp: u64) -> Result<(), VorbisError>
[src]
Seeks to the specified absolute granule position, with a page granularity.
The granularity is per-page, and the obtained position is then <= the seeked absgp.
In the case of ogg/vorbis, the absolute granule position is given as number of PCM samples, on a per channel basis.
Auto Trait Implementations
impl<T> Unpin for OggStreamReader<T> where
T: Unpin,
T: Unpin,
impl<T> Sync for OggStreamReader<T> where
T: Sync,
T: Sync,
impl<T> Send for OggStreamReader<T> where
T: Send,
T: Send,
impl<T> UnwindSafe for OggStreamReader<T> where
T: UnwindSafe,
T: UnwindSafe,
impl<T> RefUnwindSafe for OggStreamReader<T> where
T: RefUnwindSafe,
T: RefUnwindSafe,
Blanket Implementations
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,