[][src]Struct adts_reader::AdtsHeader

pub struct AdtsHeader<'buf> { /* fields omitted */ }

Extract information for a single ADTS frame from the start of the given byte buffer .

Methods

impl<'buf> AdtsHeader<'buf>[src]

pub fn from_bytes(buf: &'buf [u8]) -> Result<AdtsHeader, AdtsHeaderError>[src]

Construct an instance by borrowing the given byte buffer. The given buffer may be longer then the ADTS frame, in which case the rest of the buffer is ignored.

Note that this function returns Err if there is not enough data to parse the whole header, but it can return Ok even if there is not enough data in the given buffer to hold the whole of the payload that the header indicates should be present (however if there is not enough data to hold the payload, then payload() will return None).

pub fn mpeg_version(&self) -> MpegVersion[src]

pub fn protection(&self) -> ProtectionIndicator[src]

pub fn audio_object_type(&self) -> AudioObjectType[src]

pub fn sampling_frequency(&self) -> SamplingFrequency[src]

pub fn private_bit(&self) -> u8[src]

either 1 or 0

pub fn channel_configuration(&self) -> ChannelConfiguration[src]

pub fn originality(&self) -> Originality[src]

pub fn home(&self) -> u8[src]

either 1 or 0

pub fn copyright_identification_bit(&self) -> u8[src]

either 1 or 0

pub fn copyright_identification_start(&self) -> CopyrightIdentificationStart[src]

pub fn frame_length(&self) -> u16[src]

length of this frame, including the length of the header.

pub fn payload_length(&self) -> Option<u16>[src]

Calculates the length of the frame payload from the frame_length header value, and the total size of headers in this frame -- returning None if the frame_length header had a value too small to even include the headers

pub fn adts_buffer_fullness(&self) -> u16[src]

pub fn crc(&self) -> Option<u16>[src]

Gives the 16-bit cyclic redundancy check value stored in this frame header, or None if the header does not supply a CRC.

NB the implementation doesn't currently check that the CRC is correct

pub fn number_of_raw_data_blocks_in_frame(&self) -> u8[src]

The number of data blocks in the frame, a value between 1 and 4 inclusive.

(Note that in the serialised ADTS data stores the number of blocks - 1. This method returns the actual number of blocks by adding one to the serialised value.)

Most streams store a single block per ADTS frame

pub fn payload(&self) -> Result<&'buf [u8], PayloadError>[src]

The payload AAC data inside this ADTS frame

Trait Implementations

impl<'buf> Debug for AdtsHeader<'buf>[src]

Auto Trait Implementations

impl<'buf> Sync for AdtsHeader<'buf>

impl<'buf> Unpin for AdtsHeader<'buf>

impl<'buf> Send for AdtsHeader<'buf>

impl<'buf> UnwindSafe for AdtsHeader<'buf>

impl<'buf> RefUnwindSafe for AdtsHeader<'buf>

Blanket Implementations

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.

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

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

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