Crate adts_reader

Source
Expand description

A Rust parser for the Audio Data Transport Stream framing format often used to carry encoded AAC audio data.

AdtsHeader is the primary type provided by this crate.

Given a buffer containing some number of ADTS frames, the first frame may be inspected by constructing a header instance with,

use adts_reader::AdtsHeader;
// let buf = ...;
match AdtsHeader::from_bytes(&buf) {
    Ok(header) => println!("length (headers+payload) is {}", header.frame_length()),
    Err(e) => panic!("failed to read header: {:?}", e),
}

§Unsupported

  • Resynchronising AdtsParser after encountering bitstream error (we could search for sync-word)
  • Copyright identifiers (I don’t have any example bitstreams to try)
  • CRC handling (probably needs to be implemented as part of AAC bitstream parsing)

Structs§

AdtsHeader
Extract information for a single ADTS frame from the start of the given byte buffer .
AdtsParser
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).
CopyrightIdentification
PayloadError
Error indicating that not enough data was provided to AdtsHeader to be able to extract the whole ADTS payload following the header fields.

Enums§

AdtsHeaderError
AdtsParseError
AudioObjectType
ChannelConfiguration
CopyrightIdErr
CopyrightIdentificationStart
MpegVersion
Originality
ProtectionIndicator
SamplingFrequency

Traits§

AdtsConsumer
Trait to be implemented by types that wish to consume the ADTS data produced by AdtsParser.