MediaCodecs.MPEG4.ADTS (MediCodecs v0.7.0)

View Source

Module for parsing and serializing ADTS (Audio Data Transport Stream) packets.

Summary

Functions

Parses an ADTS packet from a binary stream.

Serializes an ADTS packet into a binary.

Types

t()

@type t() :: %MediaCodecs.MPEG4.ADTS{
  audio_object_type: non_neg_integer(),
  channels: 0..8,
  frames: binary(),
  frames_count: non_neg_integer(),
  sampling_frequency: non_neg_integer()
}

Functions

parse(adts_stream)

@spec parse(binary()) ::
  {:ok, t(), unprocessed :: binary()} | :more | {:error, :invalid_packet}

Parses an ADTS packet from a binary stream.

This function returns:

  • {:ok, packet, unprocessed} if the packet is successfully parsed with unprocessed as the remaining unprocessed binary.
  • :more if more data is needed to complete the parsing.
  • {:error, :invalid_packet} if the packet is invalid or cannot be parsed.

serialize(packet)

@spec serialize(t()) :: binary()

Serializes an ADTS packet into a binary.