Membrane Core v0.1.1 Membrane.Element View Source

Module containing functions spawning, shutting down, inspecting and controlling playback of elements. These functions are usually called by Membrane.Pipeline, and can be called from elsewhere only if there is a really good reason for doing so.

Link to this section Summary

Types

Defines options that can be passed to start/5 / start_link/5 and received in Membrane.Element.Base.Mixin.CommonBehaviour.handle_init/1 callback

Type that defines an element name by which it is identified

Functions

Returns a specification to start this module under a supervisor

Checks whether module is an element

Sends synchronous call to element, informing it that linking has finished

Sends synchronous call to element, requesting it to create a new instance of :on_request pad

Sends synchronous calls to two elements, telling them to link with each other

Sends synchronous call to the given element requesting it to set controlling pid

Sends synchronous call to the given element requesting it to set message bus

Stops given element process

Works similarly to start_link/3, but does not link to the current process

Works similarly to start_link/5, but does not link to the current process

Works similarly to start_link/5, but passes element struct (with default values) as element options

Starts process for element of given module, initialized with given options and links it to the current process in the supervision tree

Sends synchronous call to element, telling it to unlink all its pads

Link to this section Types

Link to this type element_options_t() View Source
element_options_t() :: struct() | nil

Defines options that can be passed to start/5 / start_link/5 and received in Membrane.Element.Base.Mixin.CommonBehaviour.handle_init/1 callback.

Type that defines an element name by which it is identified.

Link to this section Functions

Returns a specification to start this module under a supervisor.

See Supervisor.

Checks whether module is an element.

Link to this function handle_linking_finished(server, timeout \\ 5000) View Source

Sends synchronous call to element, informing it that linking has finished.

Link to this function handle_new_pad(server, direction, pad, timeout \\ 5000) View Source

Sends synchronous call to element, requesting it to create a new instance of :on_request pad.

Link to this function link(pid, pid, from_pad, to_pad, params) View Source
link(
  from_element :: pid(),
  to_element :: pid(),
  from_pad :: Membrane.Element.Pad.name_t(),
  to_pad :: Membrane.Element.Pad.name_t(),
  params :: list()
) :: :ok | {:error, any()}

Sends synchronous calls to two elements, telling them to link with each other.

Link to this function set_controlling_pid(server, controlling_pid, timeout \\ 5000) View Source
set_controlling_pid(pid(), pid(), timeout()) :: :ok | {:error, any()}

Sends synchronous call to the given element requesting it to set controlling pid.

It will wait for reply for amount of time passed as second argument (in milliseconds).

Link to this function set_message_bus(server, message_bus, timeout \\ 5000) View Source
set_message_bus(pid(), pid(), timeout()) :: :ok | {:error, any()}

Sends synchronous call to the given element requesting it to set message bus.

It will wait for reply for amount of time passed as second argument (in milliseconds).

Link to this function shutdown(server, timeout \\ 5000) View Source
shutdown(pid(), timeout()) :: :ok

Stops given element process.

It will wait for reply for amount of time passed as second argument (in milliseconds).

Will trigger calling Membrane.Element.Base.Mixin.CommonBehaviour.handle_shutdown/1 callback.

Link to this function start(pipeline, module, name) View Source
start(pid(), module(), name_t()) :: GenServer.on_start()

Works similarly to start_link/3, but does not link to the current process.

Link to this function start(pipeline, module, name, element_options, process_options \\ []) View Source

Works similarly to start_link/5, but does not link to the current process.

Link to this function start_link(pipeline, module, name) View Source
start_link(pid(), module(), name_t()) :: GenServer.on_start()

Works similarly to start_link/5, but passes element struct (with default values) as element options.

If element does not define struct, nil is passed.

Link to this function start_link(pipeline, module, name, element_options, process_options \\ []) View Source

Starts process for element of given module, initialized with given options and links it to the current process in the supervision tree.

Calls GenServer.start_link/3 underneath.

Link to this function unlink(server, timeout \\ 5000) View Source

Sends synchronous call to element, telling it to unlink all its pads.