Membrane Core v0.1.0 Membrane.Element.Base.Source behaviour View Source

Module defining behaviour for sources - elements producing data.

Behaviours for filters are specified, besides this place, in modules Membrane.Element.Base.Mixin.CommonBehaviour, Membrane.Element.Base.Mixin.SourceBehaviour.

Source elements can define only source pads. Job of a usual source is to produce some data (read from soundcard, download through HTTP, etc.) and send it through such pad. If the pad works in pull mode, then element is also responsible for receiving demands, and send buffers only if they have previously been demanded (for more details, see Membrane.Element.Base.Mixin.SourceBehaviour.handle_demand/5 callback). Sources, like all elements, can of course have multiple pads if needed to provide more complex solutions.

Link to this section Summary

Callbacks

Callback that is called when buffers should be emitted by the source. In contrast to Membrane.Element.Base.Mixin.SourceBehaviour.handle_demand/5, size is not passed, but should always be considered to equal 1

Link to this section Callbacks

Link to this callback handle_demand1(pad, context, state) View Source
handle_demand1(
  pad :: Pad.name_t(),
  context :: Context.Demand.t(),
  state :: Membrane.Element.Base.Mixin.CommonBehaviour.internal_state_t()
) :: Membrane.Element.Base.Mixin.CommonBehaviour.callback_return_t()

Callback that is called when buffers should be emitted by the source. In contrast to Membrane.Element.Base.Mixin.SourceBehaviour.handle_demand/5, size is not passed, but should always be considered to equal 1.

Called by default implementation of Membrane.Element.Base.Mixin.SourceBehaviour.handle_demand/5, check documentation for that callback for more information.