Membrane Core v0.2.2 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
Type that defines an element name by which it is identified
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 of user-managed state of element
Defines possible element types:
- source, producing buffers
- filter, processing buffers
- sink, consuming buffers
Functions
Changes the playback state to the new_state
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
Checks whether the given term is a valid element name
Sends synchronous calls to two elements, telling them to link with each other
Changes playback state to :playing
Changes playback state to :prepared
Sends synchronous call to the given element requesting it to set controlling pid
Sends synchronous call to the given element requesting it to set watcher
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
Changes playback state to :stopped
Sends synchronous call to element, telling it to unlink all its pads
Link to this section Types
name_t()
View Source
name_t() :: atom() | {atom(), non_neg_integer()}
name_t() :: atom() | {atom(), non_neg_integer()}
Type that defines an element name by which it is identified.
options_t()
View Source
options_t() :: struct() | nil
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.
state_t() View Source
Type of user-managed state of element.
type_t()
View Source
type_t() :: :source | :filter | :sink
type_t() :: :source | :filter | :sink
Defines possible element types:
- source, producing buffers
- filter, processing buffers
- sink, consuming buffers
Link to this section Functions
change_playback_state(pid, new_state)
View Source
change_playback_state(pid(), Membrane.Core.Playback.state_t()) :: :ok
change_playback_state(pid(), Membrane.Core.Playback.state_t()) :: :ok
Changes the playback state to the new_state
.
child_spec(init_arg) View Source
Returns a specification to start this module under a supervisor.
See Supervisor
.
element?(module) View Source
Checks whether module is an element.
handle_linking_finished(server, timeout \\ 5000) View Source
Sends synchronous call to element, informing it that linking has finished.
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.
is_element_name(term) View Source (macro)
Checks whether the given term is a valid element name
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()}
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.
play(pid)
View Source
play(pid()) :: :ok
play(pid()) :: :ok
Changes playback state to :playing
.
An alias for change_playback_state/2
with proper state.
prepare(pid)
View Source
prepare(pid()) :: :ok
prepare(pid()) :: :ok
Changes playback state to :prepared
.
An alias for change_playback_state/2
with proper state.
set_controlling_pid(server, controlling_pid, timeout \\ 5000) View Source
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).
set_watcher(server, watcher, timeout \\ 5000) View Source
Sends synchronous call to the given element requesting it to set watcher.
It will wait for reply for amount of time passed as second argument (in milliseconds).
shutdown(server, timeout \\ 5000) View Source
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.
start(pipeline, module, name)
View Source
start(pid(), module(), name_t()) :: GenServer.on_start()
start(pid(), module(), name_t()) :: GenServer.on_start()
Works similarly to start_link/3
, but does not link to the current process.
start(pipeline, module, name, element_options, process_options \\ [])
View Source
start(pid(), module(), name_t(), options_t(), GenServer.options()) ::
GenServer.on_start()
start(pid(), module(), name_t(), options_t(), GenServer.options()) :: GenServer.on_start()
Works similarly to start_link/5
, but does not link to the current process.
start_link(pipeline, module, name)
View Source
start_link(pid(), module(), name_t()) :: GenServer.on_start()
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.
start_link(pipeline, module, name, element_options, process_options \\ [])
View Source
start_link(pid(), module(), name_t(), options_t(), GenServer.options()) ::
GenServer.on_start()
start_link(pid(), module(), name_t(), options_t(), GenServer.options()) :: GenServer.on_start()
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.
stop(pid)
View Source
stop(pid()) :: :ok
stop(pid()) :: :ok
Changes playback state to :stopped
.
An alias for change_playback_state/2
with proper state.
unlink(server, timeout \\ 5000) View Source
Sends synchronous call to element, telling it to unlink all its pads.