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

This module implements struct for caps representing raw audio stream with interleaved channels.

Link to this section Summary

Functions

Determines if format is big endian

Converts bytes to frames in given caps

Converts bytes to time in Membrane.Time units in given caps

Returns how many bytes are needed to store a single frame

Converts frames to bytes in given caps

Converts frames to time in Membrane.Time units in given caps

Determines if format is little endian

Returns maximum sample value for given format

Returns minimum sample value for given format

Returns how many bytes are needed to store a single sample

Converts one raw sample into its numeric value, interpreting it for given format

Determines if format is floating point

Determines if format is integer

Determines if format is signed

Returns one ‘silent’ sample, that is value of zero in given caps’ format

Converts time in Membrane.Time units to bytes in given caps

Converts time in Membrane.Time units to frames in given caps

Determines if format is unsigned

Converts value into one raw sample, encoding it in given format

Same as value_to_sample/2, but also checks for overflow. Returns {:error, :overflow} if overflow happens

Link to this section Types

Link to this type channels_t() View Source
channels_t() :: pos_integer()
Link to this type sample_rate_t() View Source
sample_rate_t() :: pos_integer()
Link to this type t() View Source
t() :: %Membrane.Caps.Audio.Raw{
  channels: channels_t(),
  format: Membrane.Caps.Audio.Raw.Format.t(),
  sample_rate: sample_rate_t()
}

Link to this section Functions

Link to this function big_endian?(raw) View Source
big_endian?(t()) :: boolean()

Determines if format is big endian.

Inlined by the compiler.

Link to this function bytes_to_frames(bytes, caps, round_f \\ &trunc/1) View Source

Converts bytes to frames in given caps.

Inlined by the compiler.

Link to this function bytes_to_time(bytes, caps, round_f \\ &trunc/1) View Source
bytes_to_time(non_neg_integer(), t(), (float() -> integer())) ::
  Membrane.Time.non_neg_t()

Converts bytes to time in Membrane.Time units in given caps.

Inlined by the compiler.

Link to this function frame_size(caps) View Source
frame_size(t()) :: integer()

Returns how many bytes are needed to store a single frame.

Inlined by the compiler

Link to this function frames_to_bytes(frames, caps) View Source
frames_to_bytes(non_neg_integer(), t()) :: non_neg_integer()

Converts frames to bytes in given caps.

Inlined by the compiler.

Link to this function frames_to_time(frames, caps, round_f \\ &trunc/1) View Source
frames_to_time(non_neg_integer(), t(), (float() -> integer())) ::
  Membrane.Time.non_neg_t()

Converts frames to time in Membrane.Time units in given caps.

Inlined by the compiler.

Link to this function little_endian?(raw) View Source
little_endian?(t()) :: boolean()

Determines if format is little endian.

Inlined by the compiler.

Link to this function sample_max(raw) View Source
sample_max(t()) :: number()

Returns maximum sample value for given format.

Inlined by the compiler.

Link to this function sample_min(raw) View Source
sample_min(t()) :: number()

Returns minimum sample value for given format.

Inlined by the compiler.

Link to this function sample_size(raw) View Source
sample_size(t()) :: integer()

Returns how many bytes are needed to store a single sample.

Inlined by the compiler

Link to this function sample_to_value(sample, raw) View Source
sample_to_value(bitstring(), t()) :: number()

Converts one raw sample into its numeric value, interpreting it for given format.

Inlined by the compiler.

Link to this function sample_type_float?(raw) View Source
sample_type_float?(t()) :: boolean()

Determines if format is floating point.

Inlined by the compiler.

Link to this function sample_type_int?(raw) View Source
sample_type_int?(t()) :: boolean()

Determines if format is integer.

Inlined by the compiler.

Link to this function signed?(raw) View Source
signed?(t()) :: boolean()

Determines if format is signed.

Inlined by the compiler.

Link to this function sound_of_silence(raw) View Source
sound_of_silence(t()) :: binary()

Returns one ‘silent’ sample, that is value of zero in given caps’ format.

Inlined by the compiler.

Link to this function time_to_bytes(time, caps, round_f \\ &(&1 |> :math.ceil() |> trunc)) View Source
time_to_bytes(Membrane.Time.non_neg_t(), t(), (float() -> integer())) ::
  non_neg_integer()

Converts time in Membrane.Time units to bytes in given caps.

Inlined by the compiler.

Link to this function time_to_frames(time, caps, round_f \\ &(&1 |> :math.ceil() |> trunc)) View Source
time_to_frames(Membrane.Time.non_neg_t(), t(), (float() -> integer())) ::
  non_neg_integer()

Converts time in Membrane.Time units to frames in given caps.

Inlined by the compiler.

Link to this function unsigned?(raw) View Source
unsigned?(t()) :: boolean()

Determines if format is unsigned.

Inlined by the compiler.

Link to this function value_to_sample(value, raw) View Source
value_to_sample(number(), t()) :: binary()

Converts value into one raw sample, encoding it in given format.

Inlined by the compiler.

Link to this function value_to_sample_check_overflow(value, caps) View Source
value_to_sample_check_overflow(number(), t()) ::
  {:ok, binary()} | {:error, :overflow}

Same as value_to_sample/2, but also checks for overflow. Returns {:error, :overflow} if overflow happens.

Inlined by the compiler.