Struct AdtsParser

Source
pub struct AdtsParser<C>
where C: AdtsConsumer,
{ pub consumer: C, /* private fields */ }
Expand description

Find ADTS frames within provided buffers of data, announcing audio configuration as it is discovered (normally just once at the start, but possibly changing during the stream if the stream is malformed).

Does not currently try to handle re-synchronise with the ADTS bitstream on encountering bad data.

Fields§

§consumer: C

Implementations§

Source§

impl<C> AdtsParser<C>
where C: AdtsConsumer,

Source

pub fn new(consumer: C) -> AdtsParser<C>

Source

pub fn start(&mut self)

Initialize or re-initialize parser state. Call this function before processing a group of ADTS frames to ensure that any error state due to processing an earlier group of ADTS frames is cleared.

Source

pub fn push(&mut self, adts_buf: &[u8])

Extracts information about each ADTS frame in the given buffer, which is passed to the AdtsConsumer implementation supplied at construction time.

If the given buffer ends part-way through an ADTS frame, the remaining unconsumed data will be buffered inside this AdtsParser instance, and the rest of the ADTS frame may be passed in another buffer in the next call to this method.

Auto Trait Implementations§

§

impl<C> Freeze for AdtsParser<C>
where C: Freeze,

§

impl<C> RefUnwindSafe for AdtsParser<C>
where C: RefUnwindSafe,

§

impl<C> Send for AdtsParser<C>
where C: Send,

§

impl<C> Sync for AdtsParser<C>
where C: Sync,

§

impl<C> Unpin for AdtsParser<C>
where C: Unpin,

§

impl<C> UnwindSafe for AdtsParser<C>
where C: UnwindSafe,

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

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

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.