Membrane Caps: Audio.Raw v0.1.2 Membrane.Caps.Audio.Raw.Format View Source

This module defines formats used in Membrane.Caps.Audio.Raw.Caps and some helpers to deal with them.

Link to this section Summary

Functions

Converts positive integer containing serialized format to atom

Converts 3-tuple format to an equivalent atom form

converts audio format to 32-bit unsigned integer consisting of (from oldest bit):

  • first bit for type (int/float)
  • then bit for encoding (unsigned/signed)
  • then bit for endianity (little/big)
  • then sequence of zeroes
  • last 8 bits for size (in bits)

Converts format atom to an equivalent 3-tuple form

Link to this section Types

Link to this type endianness_t() View Source
endianness_t() :: :le | :be | :any
Link to this type sample_size_t() View Source
sample_size_t() :: 8 | 16 | 24 | 32 | 64
Link to this type sample_type_t() View Source
sample_type_t() :: :s | :u | :f
Link to this type t() View Source
t() ::
  :f64be
  | :f64le
  | :f32be
  | :f32le
  | :u32be
  | :s32be
  | :u32le
  | :s32le
  | :u24be
  | :s24be
  | :u24le
  | :s24le
  | :u16be
  | :s16be
  | :u16le
  | :s16le
  | :u8
  | :s8

Link to this section Functions

Link to this function deserialize(serialized_format) View Source
deserialize(pos_integer()) :: t()

Converts positive integer containing serialized format to atom.

expects serialized format

returns format atom (See t/0)

Converts 3-tuple format to an equivalent atom form

Link to this function serialize(format) View Source
serialize(t()) :: pos_integer()

converts audio format to 32-bit unsigned integer consisting of (from oldest bit):

  • first bit for type (int/float)
  • then bit for encoding (unsigned/signed)
  • then bit for endianity (little/big)
  • then sequence of zeroes
  • last 8 bits for size (in bits)

expects atom format

returns format encoded as integer

Converts format atom to an equivalent 3-tuple form