RTMP.FLV.AudioTag (rtmp v0.1.0)

Copy Markdown View Source

Parses the body of an RTMP audio message (an FLV audio tag body).

AAC is parsed: the sequence header's AudioSpecificConfig is decoded into %{object_type: ..., sample_rate: ..., channels: ...} and raw frames are delivered as-is. Every other legacy FLV sound format (MP3, Speex, PCM, Nellymoser, G.711, ...) is passed through unparsed, with the FLV header's rate/size/channel fields in :config.

Enhanced RTMP audio (sound format 9, the "ExHeader" used for Opus, FLAC, AC-3 and multitrack audio) is not supported and is reported as {:unsupported, reason} so the connection can reject it cleanly instead of handing out frames nobody can decode.

Summary

Functions

Parses an audio message payload into RTMP.Frame fields.

Decodes an AAC AudioSpecificConfig (ISO 14496-3, 1.6.2.1).

Types

result()

@type result() :: {:ok, map()} | :skip | {:error, term()} | {:unsupported, term()}

Functions

parse(arg)

@spec parse(binary()) :: result()

Parses an audio message payload into RTMP.Frame fields.

Returns {:ok, fields}, :skip (an empty message — nothing to deliver), {:error, reason} (malformed; drop this frame), or {:unsupported, reason} (a codec this library rejects).

parse_audio_specific_config(config)

@spec parse_audio_specific_config(binary()) :: {:ok, map()} | {:error, term()}

Decodes an AAC AudioSpecificConfig (ISO 14496-3, 1.6.2.1).

Returns %{object_type: integer, sample_rate: integer, channels: integer}. channels is the raw channel configuration; 0 means the layout is defined in a program config element.