Membrane Core v0.5.0 Membrane.Pipeline behaviour View Source
Module containing functions for constructing and supervising pipelines.
Pipelines are units that make it possible to instantiate, link and manage elements and bins in convenient way (actually they should always be used inside a pipeline). Linking pipeline children together enables them to pass data to one another, and process it in different ways.
To create a pipeline, use the __using__/1
macro and implement callbacks
of Membrane.Pipeline
behaviour. For details on instantiating and linking
children, see Membrane.ParentSpec
.
Link to this section Summary
Types
Defines options that can be passed to start/3
/ start_link/3
and received
in handle_init/1
callback.
Functions
Brings all the stuff necessary to implement a pipeline.
Returns a specification to start this module under a supervisor.
Checks whether module is a pipeline.
Changes playback state to :playing
.
Changes playback state to :prepared
.
Does the same as start_link/3
but starts process outside of supervision tree.
Starts the Pipeline based on given module and links it to the current process.
Changes playback state to :stopped
.
Changes pipeline's playback state to :stopped
and terminates its process
Callbacks
Callback invoked on initialization of pipeline process. It should parse options
and initialize pipeline's internal state. Internally it is invoked inside
GenServer.init/1
callback.
Callback invoked when pipeline is shutting down.
Internally called in GenServer.terminate/2
callback.
Enables to check whether module is membrane pipeline
Link to this section Types
Defines options that can be passed to start/3
/ start_link/3
and received
in handle_init/1
callback.
Link to this section Functions
Brings all the stuff necessary to implement a pipeline.
Options:
:bring_spec?
- if true (default) imports and aliasesMembrane.ParentSpec
:bring_pad?
- if true (default) requires and aliasesMembrane.Pad
Returns a specification to start this module under a supervisor.
See Supervisor
.
Checks whether module is a pipeline.
Changes playback state to :playing
.
An alias for Membrane.Core.PlaybackHandler.change_playback_state/2
with proper state.
Changes playback state to :prepared
.
An alias for Membrane.Core.PlaybackHandler.change_playback_state/2
with proper state.
start(module, pipeline_options \\ nil, process_options \\ [])
View Sourcestart( module(), pipeline_options :: pipeline_options_t(), process_options :: GenServer.options() ) :: GenServer.on_start()
Does the same as start_link/3
but starts process outside of supervision tree.
start_link(module, pipeline_options \\ nil, process_options \\ [])
View Sourcestart_link( module(), pipeline_options :: pipeline_options_t(), process_options :: GenServer.options() ) :: GenServer.on_start()
Starts the Pipeline based on given module and links it to the current process.
Pipeline options are passed to module's handle_init/1
callback.
Process options are internally passed to GenServer.start_link/3
.
Returns the same values as GenServer.start_link/3
.
Changes playback state to :stopped
.
An alias for Membrane.Core.PlaybackHandler.change_playback_state/2
with proper state.
stop_and_terminate(pipeline)
View Sourcestop_and_terminate(pipeline :: pid()) :: :ok
Changes pipeline's playback state to :stopped
and terminates its process
Link to this section Callbacks
handle_init(options)
View Sourcehandle_init(options :: pipeline_options_t()) :: Membrane.Core.CallbackHandler.callback_return_t()
Callback invoked on initialization of pipeline process. It should parse options
and initialize pipeline's internal state. Internally it is invoked inside
GenServer.init/1
callback.
handle_shutdown(reason, state)
View Sourcehandle_shutdown( reason, state :: Membrane.Core.Pipeline.State.internal_state_t() ) :: :ok when reason: :normal | :shutdown | {:shutdown, any()}
Callback invoked when pipeline is shutting down.
Internally called in GenServer.terminate/2
callback.
Useful for any cleanup required.
Enables to check whether module is membrane pipeline