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,
impl<C> AdtsParser<C>where
C: AdtsConsumer,
pub fn new(consumer: C) -> AdtsParser<C>
Sourcepub fn start(&mut self)
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.
Sourcepub fn push(&mut self, adts_buf: &[u8])
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.