[][src]Struct ogg::reading::PacketReader

pub struct PacketReader<T: Read + Seek> { /* fields omitted */ }

Reader for packets from an Ogg stream.

This reads codec packets belonging to several different logical streams from one physical Ogg container stream.

This reader is not async ready. It does not keep its internal state consistent when it encounters the WouldBlock error kind. If you desire async functionality, consider enabling the async feature and look into the async module.

Implementations

impl<T: Read + Seek> PacketReader<T>[src]

pub fn new(rdr: T) -> PacketReader<T>[src]

Constructs a new PacketReader with a given Read.

pub fn into_inner(self) -> T[src]

Returns the wrapped reader, consuming the PacketReader.

pub fn read_packet(&mut self) -> Result<Option<Packet>, OggReadError>[src]

Reads a packet, and returns it on success.

Ok(None) is returned if the physical stream has ended.

pub fn read_packet_expected(&mut self) -> Result<Packet, OggReadError>[src]

Reads a packet, and returns it on success.

The difference to the read_packet function is that this function returns an Err(_) if the physical stream has ended. This function is useful if you expect a new packet to come.

pub fn seek_bytes(&mut self, pos: SeekFrom) -> Result<u64, Error>[src]

Seeks the underlying reader

Seeks the reader that this PacketReader bases on by the specified number of bytes. All new pages will be read from the new position.

This also flushes all the unread packets in the queue.

pub fn seek_absgp(
    &mut self,
    stream_serial: Option<u32>,
    pos_goal: u64
) -> Result<bool, OggReadError>
[src]

Seeks to absolute granule pos

More specifically, it seeks to the first Ogg page that has an absgp greater or equal to the specified one. In the case of continued packets, the seek operation may also end up at the last page that comes before such a page and has a packet start.

The passed stream_serial parameter controls the stream serial number to filter our search for. If it's None, no filtering is applied, but if it is Some(n), we filter for streams with the serial number n. Note that the None case is only intended for streams where only one logical stream exists, the seek may misbehave if Ǹone gets passed when multiple streams exist.

The returned bool indicates whether the seek was successful.

pub fn delete_unread_packets(&mut self)[src]

Resets the internal state by deleting all unread packets.

Auto Trait Implementations

impl<T> RefUnwindSafe for PacketReader<T> where
    T: RefUnwindSafe
[src]

impl<T> Send for PacketReader<T> where
    T: Send
[src]

impl<T> Sync for PacketReader<T> where
    T: Sync
[src]

impl<T> Unpin for PacketReader<T> where
    T: Unpin
[src]

impl<T> UnwindSafe for PacketReader<T> where
    T: UnwindSafe
[src]

Blanket Implementations

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

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

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

impl<T> From<T> for T[src]

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

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

type Error = Infallible

The type returned in the event of a conversion error.

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

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

The type returned in the event of a conversion error.