View Source Membrane.FLAC.Parser.Engine (Membrane FLAC plugin v0.11.0)

Stateful parser based on FLAC format specification available here

The parser outputs:

  1. Membrane.FLAC
  2. Membrane.Buffer with "fLaC" - the FLAC stream marker in ASCII
  3. At least one Membrane.Buffer with metadata block(s)
  4. Membrane.Buffers containing one frame each, with decoded metadata from its header (as Membrane.FLAC.FrameMetadata struct)

The parsing is done by calling init/0 and than parse/2 with the data to parse. The last buffer can be obtained by calling flush/1

The parser returns a frame once it encounters a beginning of the next one since there's no other way to determine where the frame ends.

Link to this section Summary

Types

Opaque struct containing state of the parser.

Functions

Outputs the last buffer queued in parser. Should be called afer providing all data to the parser.

Returns an initialized parser state

Parses FLAC stream, splitting it into Membrane.Buffers and providing format.

Link to this section Types

@opaque state()

Opaque struct containing state of the parser.

Link to this section Functions

@spec flush(state()) :: {:ok, Membrane.Buffer.t()}

Outputs the last buffer queued in parser. Should be called afer providing all data to the parser.

Link to this function

init(streaming? \\ false)

View Source
@spec init(boolean()) :: state()

Returns an initialized parser state

Link to this function

parse(binary_data, state \\ init())

View Source
@spec parse(binary(), state()) ::
  {:ok, [Membrane.StreamFormat.t() | Membrane.Buffer.t()], state()}
  | {:error, any()}

Parses FLAC stream, splitting it into Membrane.Buffers and providing format.

See moduledoc (Membrane.FLAC.Parser.Engine) for more info

The call without state provided is an equivalent of using init/0 as state