Membrane Element: Mad v0.1.0 Membrane.Element.Mad.Decoder.Native View Source

Wrapper for native implementation of decoder

Link to this section Summary

Functions

Initializes mad_stream, mad_frame, mad_synth and returns DecoderHandle resource No arugments are expected On success, should return {:ok, decoder_handle}

Decodes one frame from input Expects 2 arguments:

  • native resource
  • buffer to decode

Link to this section Functions

Link to this function create() View Source
create() :: {:ok, any()}

Initializes mad_stream, mad_frame, mad_synth and returns DecoderHandle resource No arugments are expected On success, should return {:ok, decoder_handle}

Link to this function decode_frame(native, data) View Source
decode_frame(any(), bitstring()) ::
  {:ok, {bitstring(), non_neg_integer(), non_neg_integer(), non_neg_integer()}}
  | {:error, any()}

Decodes one frame from input Expects 2 arguments:

  • native resource
  • buffer to decode

Returns one of:

  • tuple {:ok, {decoded_audio, bytes_used, sample_rate, channels}} on success decoded_audio is a bitstring with interleaved channels
  • {:error, :buflen} - when input buffer is too small
  • {:error, {:recoverable, reason, bytes_to_skip}}
  • {:error, {:malformed, reason}}