[−][src]Struct ogg::reading::BasePacketReader
Low level struct for reading from an Ogg stream.
Note that most times you'll want the higher level PacketReader
struct.
It takes care of most of the internal parsing and logic, you will only have to take care of handing over your data.
Essentially, it manages a cache of package data for each logical
bitstream, and when the cache of every logical bistream is empty,
it asks for a fresh page. You will then need to feed the struct
one via the push_page
function.
All functions on this struct are async ready. They get their data fed, instead of calling and blocking in order to get it.
Methods
impl BasePacketReader
[src]
pub fn new() -> Self
[src]
Constructs a new blank BasePacketReader
.
You can feed it data using the push_page
function, and
obtain data using the read_packet
function.
pub fn read_packet(&mut self) -> Option<Packet>
[src]
Extracts a packet from the cache, if the cache contains valid packet data,
otherwise it returns None
.
If this function returns None
, you'll need to add a page to the cache
by using the push_page
function.
pub fn push_page(&mut self, page: OggPage) -> Result<(), OggReadError>
[src]
Pushes a given Ogg page, updating the internal structures with its contents.
If you want the code to function properly, you should first call
parse_segments
, then parse_packet_data
on a PageParser
before passing the resulting OggPage
to this function.
pub fn update_after_seek(&mut self)
[src]
Reset the internal state after a seek
It flushes the cache so that no partial data is left inside. It also tells the parsing logic to expect little inconsistencies due to the read position not being at the start.
Auto Trait Implementations
impl Unpin for BasePacketReader
impl Sync for BasePacketReader
impl Send for BasePacketReader
impl UnwindSafe for BasePacketReader
impl RefUnwindSafe for BasePacketReader
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,