[][src]Struct lewton::inside_ogg::OggStreamReader

pub struct OggStreamReader<T: Read + Seek> {
    pub ident_hdr: IdentHeader,
    pub comment_hdr: CommentHeader,
    pub setup_hdr: SetupHeader,
    // some fields omitted
}

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: IdentHeadercomment_hdr: CommentHeadersetup_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]

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> Send for OggStreamReader<T> where
    T: Send

impl<T> Sync for OggStreamReader<T> where
    T: Sync

Blanket Implementations

impl<T, U> Into for T where
    U: From<T>, 
[src]

impl<T> From for T[src]

impl<T, U> TryFrom for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T> Borrow for T where
    T: ?Sized
[src]

impl<T> BorrowMut for T where
    T: ?Sized
[src]

impl<T, U> TryInto for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

impl<T> Any for T where
    T: 'static + ?Sized
[src]