Membrane.Core.InputBuffer (Membrane Core v0.7.0) View Source

Buffer that is attached to the :input pad when working in a :pull mode.

It stores Membrane.Buffer, Membrane.Event and Membrane.Caps structs and prevents the situation where the data in a stream contains the discontinuities. It also guarantees that element won't be flooded with the incoming data.

Link to this section Summary

Types

Properties that can be passed when creating new InputBuffer

t()

Link to this section Types

Specs

output_t() :: {:empty | :value, [output_value_t()]}

Specs

output_value_t() :: {:event | :caps, any()} | {:buffers, list(), pos_integer()}

Specs

props_t() :: [
  preferred_size: pos_integer(),
  min_demand: pos_integer(),
  warn_size: pos_integer(),
  fail_size: pos_integer()
]

Properties that can be passed when creating new InputBuffer

Available options are:

  • :preferred_size - size which will be the 'target' for InputBuffer - it will make demands trying to grow to this size. Its default value depends on the set Membrane.Buffer.Metric and is obtained via Membrane.Buffer.Metric.input_buf_preferred_size/0
  • :min_demand - the minimal size of a demand that can be sent to the linked output pad. This prevents from excessive message passing between elements. Defaults to a quarter of preferred size.
  • warn_size - in toilet mode (connecting push output to pull input pad), receiving more data than this size triggers a warning. By default it is equal to twice the preferred size.
  • fail_size - in toilet mode (connecting push output to pull input pad), receiving more data than this results in an element failure. By default, it is four times the preferred size.

Specs

t() :: %Membrane.Core.InputBuffer{
  current_size: non_neg_integer(),
  demand: non_neg_integer(),
  log_tag: String.t(),
  metric: module(),
  min_demand: pos_integer(),
  preferred_size: pos_integer(),
  q: Qex.t(),
  toilet?: boolean(),
  toilet_props: %{warn: pos_integer(), fail: pos_integer()}
}

Link to this section Functions

Specs

empty?(t()) :: boolean()

Specs

enable_toilet(t()) :: t()
Link to this function

init(demand_unit, demand_pid, demand_pad, log_tag, props)

View Source

Specs

Specs

parse_props(keyword()) :: {:error, reason :: any()} | {:ok, props_t()}
Link to this function

store(input_buf, type \\ :buffers, v)

View Source

Specs

store(t(), atom(), any()) :: t()
Link to this function

take_and_demand(input_buf, count, demand_pid, demand_pad)

View Source

Specs

take_and_demand(t(), non_neg_integer(), pid(), Membrane.Pad.ref_t()) ::
  {output_t(), t()}