ExFLV.Tag.AudioData.AAC (FLV muxer and demuxer v0.4.0)

View Source

Module describing an AACAUDIODATA tag.

Summary

Functions

Creates a new AACAUDIODATA.

Parses the binary into an AACAUDIODATA tag.

Same as parse/1 but raises on error.

Types

packet_type()

@type packet_type() :: :sequence_header | :raw

t()

@type t() :: %ExFLV.Tag.AudioData.AAC{data: iodata(), packet_type: packet_type()}

Functions

new(data, packet_type)

@spec new(iodata(), packet_type()) :: t()

Creates a new AACAUDIODATA.

parse(tag)

@spec parse(binary()) :: {:ok, t()} | {:error, :invalid_data}

Parses the binary into an AACAUDIODATA tag.

iex> ExFLV.Tag.AudioData.AAC.parse(<<0, 1, 2, 3>>)
{:ok, %ExFLV.Tag.AudioData.AAC{packet_type: :sequence_header, data: <<1, 2, 3>>}}

iex> ExFLV.Tag.AudioData.AAC.parse(<<1, 1, 2, 3>>)
{:ok, %ExFLV.Tag.AudioData.AAC{packet_type: :raw, data: <<1, 2, 3>>}}

iex> ExFLV.Tag.AudioData.AAC.parse(<<2, 1, 2, 3>>)
{:error, :invalid_data}

parse!(data)

@spec parse!(binary()) :: t()

Same as parse/1 but raises on error.

iex> ExFLV.Tag.AudioData.AAC.parse!(<<0, 1, 2, 3>>)
%ExFLV.Tag.AudioData.AAC{packet_type: :sequence_header, data: <<1, 2, 3>>}