View Source Membrane.RemoteControlled.Pipeline (Membrane Core v0.10.2)

Membrane.RemoteControlled.Pipeline is a basic Membrane.Pipeline implementation that can be controlled by a controlling process.

The controlling process can request the execution of arbitrary valid Membrane.Pipeline.Action:

  children = ...
  links = ...
  actions = [{:spec, %ParentSpec{children: children, links: links}}]
  Pipeline.exec_actions(pipeline, actions)

The controlling process can also subscribe to the messages sent by the pipeline and later on synchroniously await for these messages:

# subscribes to message which is sent when the pipeline enters any playback state
Pipeline.subscribe(pipeline, %Message.PlaybackState{state: _})
...
# awaits for the message sent when the pipeline enters :playing playback state
Pipeline.await_playback_state(pipeline, :playing)
...
# awaits for the message sent when the pipeline enters :stopped playback state
Pipeline.await_playback_state(pipeline, :stopped)

Membrane.RemoteControlled.Pipeline can be used when there is no need for introducing a custom logic in the Membrane.Pipeline callbacks implementation. An example of usage could be running a pipeline from the elixir script. Membrane.RemoteControlled.Pipeline sends the following messages:

  • Membrane.RemoteControlled.Message.PlaybackState.t() sent when pipeline enters a given playback state,
  • Membrane.RemoteControlled.Message.StartOfStream.t() sent when one of direct pipeline children informs the pipeline about start of a stream,
  • Membrane.RemoteControlled.Message.EndOfStream.t() sent when one of direct pipeline children informs the pipeline about end of a stream,
  • Membrane.RemoteControlled.Message.Notification.t() sent when pipeline receives notification from one of its children,
  • Membrane.RemoteControlled.Message.Terminated.t() sent when the pipeline gracefully terminates.

Link to this section Summary

Functions

Awaits for the first Membrane.RemoteControlled.Message() wrapping the Membrane.RemoteControlled.Message.EndOfStream() message with no further constraints, sent by the process with pipeline pid. It is required to firstly use the subscribe/2 to subscribe to a given message before awaiting for that message.

Awaits for the first Membrane.RemoteControlled.Message() wrapping the Membrane.RemoteControlled.Message.EndOfStream() message concerning the given element, sent by the process with pipeline pid. It is required to firstly use the subscribe/2 to subscribe to a given message before awaiting for that message.

Awaits for the first Membrane.RemoteControlled.Message() wrapping the Membrane.RemoteControlled.Message.EndOfStream() message concerning the given element and the pad, sent by the process with pipeline pid. It is required to firstly use the subscribe/2 to subscribe to a given message before awaiting for that message.

Awaits for the first Membrane.RemoteControlled.Message() wrapping the Membrane.RemoteControlled.Message.Notification() message with no further constraints, sent by the process with pipeline pid. It is required to firstly use the subscribe/2 to subscribe to a given message before awaiting for that message.

Awaits for the first Membrane.RemoteControlled.Message() wrapping the Membrane.RemoteControlled.Message.Notification() message concerning the given element, sent by the process with pipeline pid. It is required to firstly use the subscribe/2 to subscribe to a given message before awaiting for that message.

Awaits for the first Membrane.RemoteControlled.Message() wrapping the Membrane.RemoteControlled.Message.PlaybackState() message with no further constraints, sent by the process with pipeline pid. It is required to firstly use the subscribe/2 to subscribe to a given message before awaiting for that message.

Awaits for the first Membrane.RemoteControlled.Message() wrapping the Membrane.RemoteControlled.Message.PlaybackState() message with the given state, sent by the process with pipeline pid. It is required to firstly use the subscribe/2 to subscribe to a given message before awaiting for that message.

Awaits for the first Membrane.RemoteControlled.Message() wrapping the Membrane.RemoteControlled.Message.StartOfStream() message with no further constraints, sent by the process with pipeline pid. It is required to firstly use the subscribe/2 to subscribe to a given message before awaiting for that message.

Awaits for the first Membrane.RemoteControlled.Message() wrapping the Membrane.RemoteControlled.Message.StartOfStream() message concerning the given element, sent by the process with pipeline pid. It is required to firstly use the subscribe/2 to subscribe to a given message before awaiting for that message.

Awaits for the first Membrane.RemoteControlled.Message() wrapping the Membrane.RemoteControlled.Message.StartOfStream() message concerning the given element and the pad, sent by the process with pipeline pid. It is required to firstly use the subscribe/2 to subscribe to a given message before awaiting for that message.

Awaits for the Membrane.RemoteControlled.Message() wrapping the Membrane.RemoteControlled.Message.Terminated message, which is send when the pipeline gracefully terminates. It is required to firstly use the subscribe/2 to subscribe to a given message before awaiting for that message.

Sends a list of Pipeline.Action.t() to the given Membrane.RemoteControlled.Pipeline for execution.

play(pid) deprecated

Changes playback state of pipeline to :playing.

prepare(pid) deprecated

Changes playback state to :prepared.

Does the same as the start_link/1 but starts the process outside of the supervision tree.

Starts the Membrane.RemoteControlled.Pipeline and links it to the current process. The process that makes the call to the start_link/1 automatically become the controller process.

stop(pid) deprecated

Changes playback state to :stopped.

Changes pipeline's playback state to :stopped and terminates its process.

Subscribes to a given subscription_pattern. The subscription_pattern should describe some subset of elements of Membrane.RemoteControlled.Pipeline.message_t() type. The subscription_pattern must be a match pattern.

Changes pipeline's playback state to :stopped and terminates its process.

Link to this section Functions

Link to this function

await_end_of_stream(pipeline)

View Source
@spec await_end_of_stream(pid()) :: Membrane.RemoteControlled.Message.EndOfStream.t()

Awaits for the first Membrane.RemoteControlled.Message() wrapping the Membrane.RemoteControlled.Message.EndOfStream() message with no further constraints, sent by the process with pipeline pid. It is required to firstly use the subscribe/2 to subscribe to a given message before awaiting for that message.

Usage example:

  1. awaiting for the first end_of_stream occuring on any pad of any element in the pipeline:
      Pipeline.await_end_of_stream(pipeline)
Link to this function

await_end_of_stream(pipeline, element)

View Source

Awaits for the first Membrane.RemoteControlled.Message() wrapping the Membrane.RemoteControlled.Message.EndOfStream() message concerning the given element, sent by the process with pipeline pid. It is required to firstly use the subscribe/2 to subscribe to a given message before awaiting for that message.

Usage example:

  1. awaiting for the first end_of_stream occuring on any pad of the :element_id element in the pipeline:
      Pipeline.await_end_of_stream(pipeline, :element_id)
Link to this function

await_end_of_stream(pipeline, element, pad)

View Source

Awaits for the first Membrane.RemoteControlled.Message() wrapping the Membrane.RemoteControlled.Message.EndOfStream() message concerning the given element and the pad, sent by the process with pipeline pid. It is required to firstly use the subscribe/2 to subscribe to a given message before awaiting for that message.

Usage example:

  1. awaiting for the first end_of_stream occuring on the :pad_id of the :element_id element in the pipeline:
      Pipeline.await_end_of_stream(pipeline, :element_id, :pad_id)
Link to this function

await_notification(pipeline)

View Source
@spec await_notification(pid()) :: Membrane.RemoteControlled.Message.Notification.t()

Awaits for the first Membrane.RemoteControlled.Message() wrapping the Membrane.RemoteControlled.Message.Notification() message with no further constraints, sent by the process with pipeline pid. It is required to firstly use the subscribe/2 to subscribe to a given message before awaiting for that message.

Usage example:

  1. awaiting for the first notification send to any element in the pipeline:
      Pipeline.await_notification(pipeline)
Link to this function

await_notification(pipeline, element)

View Source

Awaits for the first Membrane.RemoteControlled.Message() wrapping the Membrane.RemoteControlled.Message.Notification() message concerning the given element, sent by the process with pipeline pid. It is required to firstly use the subscribe/2 to subscribe to a given message before awaiting for that message.

Usage example:

  1. awaiting for the first notification send to the :element_id element in the pipeline:
      Pipeline.await_notification(pipeline, :element_id)
Link to this function

await_playback_state(pipeline)

View Source
@spec await_playback_state(pid()) ::
  Membrane.RemoteControlled.Message.PlaybackState.t()

Awaits for the first Membrane.RemoteControlled.Message() wrapping the Membrane.RemoteControlled.Message.PlaybackState() message with no further constraints, sent by the process with pipeline pid. It is required to firstly use the subscribe/2 to subscribe to a given message before awaiting for that message.

Usage example:

  1. awaiting for any playback state change occuring in the pipeline:
      Pipeline.await_playback_state(pipeline)
Link to this function

await_playback_state(pipeline, playback_state)

View Source

Awaits for the first Membrane.RemoteControlled.Message() wrapping the Membrane.RemoteControlled.Message.PlaybackState() message with the given state, sent by the process with pipeline pid. It is required to firstly use the subscribe/2 to subscribe to a given message before awaiting for that message.

Usage example:

  1. awaiting for the pipeline's playback state to change into :playing:
      Pipeline.await_playback_state(pipeline, :playing)
Link to this function

await_start_of_stream(pipeline)

View Source
@spec await_start_of_stream(pid()) ::
  Membrane.RemoteControlled.Message.StartOfStream.t()

Awaits for the first Membrane.RemoteControlled.Message() wrapping the Membrane.RemoteControlled.Message.StartOfStream() message with no further constraints, sent by the process with pipeline pid. It is required to firstly use the subscribe/2 to subscribe to a given message before awaiting for that message.

Usage example:

  1. awaiting for the first start_of_stream occuring on any pad of any element in the pipeline:
      Pipeline.await_start_of_stream(pipeline)
Link to this function

await_start_of_stream(pipeline, element)

View Source

Awaits for the first Membrane.RemoteControlled.Message() wrapping the Membrane.RemoteControlled.Message.StartOfStream() message concerning the given element, sent by the process with pipeline pid. It is required to firstly use the subscribe/2 to subscribe to a given message before awaiting for that message.

Usage example:

  1. awaiting for the first start_of_stream occuring on any pad of the :element_id element in the pipeline:
      Pipeline.await_start_of_stream(pipeline, :element_id)
Link to this function

await_start_of_stream(pipeline, element, pad)

View Source

Awaits for the first Membrane.RemoteControlled.Message() wrapping the Membrane.RemoteControlled.Message.StartOfStream() message concerning the given element and the pad, sent by the process with pipeline pid. It is required to firstly use the subscribe/2 to subscribe to a given message before awaiting for that message.

Usage example:

  1. awaiting for the first start_of_stream occuring on the :pad_id pad of the :element_id element in the pipeline:
      Pipeline.await_start_of_stream(pipeline, :element_id, :pad_id)
Link to this function

await_termination(pipeline)

View Source
@spec await_termination(pid()) :: Membrane.RemoteControlled.Message.Terminated.t()

Awaits for the Membrane.RemoteControlled.Message() wrapping the Membrane.RemoteControlled.Message.Terminated message, which is send when the pipeline gracefully terminates. It is required to firstly use the subscribe/2 to subscribe to a given message before awaiting for that message.

Usage example:

  1. awaiting for the pipeline termination:
      Pipeline.await_termination(pipeline)
Link to this function

exec_actions(pipeline, actions)

View Source
@spec exec_actions(pid(), [Membrane.Pipeline.Action.t()]) :: :ok

Sends a list of Pipeline.Action.t() to the given Membrane.RemoteControlled.Pipeline for execution.

Usage example:

  1. making the Membrane.RemoteControlled.Pipeline start the Membrane.ParentSpec specified in the action.
      children = ...
      links = ...
      actions = [{:spec, %ParentSpec{children: children, links: links}}]
      Pipeline.exec_actions(pipeline, actions)
This function is deprecated. use pipeline's :playback action instead.
@spec play(pid()) :: :ok

Changes playback state of pipeline to :playing.

This function is deprecated. use pipeline's :playback action instead.
@spec prepare(pid()) :: :ok

Changes playback state to :prepared.

Link to this function

start(process_options \\ [])

View Source

Does the same as the start_link/1 but starts the process outside of the supervision tree.

Link to this function

start_link(process_options \\ [])

View Source
@spec start_link(GenServer.options()) :: GenServer.on_start()

Starts the Membrane.RemoteControlled.Pipeline and links it to the current process. The process that makes the call to the start_link/1 automatically become the controller process.

This function is deprecated. use pipeline's :playback action instead.
@spec stop(pid()) :: :ok

Changes playback state to :stopped.

Link to this function

stop_and_terminate(pipeline, opts \\ [])

View Source
This function is deprecated. use terminate/2 instead.
@spec stop_and_terminate(pid(), Keyword.t()) :: :ok

Changes pipeline's playback state to :stopped and terminates its process.

Link to this macro

subscribe(pipeline, subscription_pattern)

View Source (macro)

Subscribes to a given subscription_pattern. The subscription_pattern should describe some subset of elements of Membrane.RemoteControlled.Pipeline.message_t() type. The subscription_pattern must be a match pattern.

Usage examples:

  1. making the Membrane.RemoteControlled.Pipeline send to the controlling process Message.StartOfStream message when any pad of the :element_id receives :start_of_stream event.
  subscribe(pipeline, %Message.StartOfStream{element: :element_id, pad: _})
  1. making the Membrane.RemoteControlled.Pipeline send to the controlling process Message.PlaybackState message when the pipeline playback state changes to any state (that is - for all the :stopped, :prepared and :playing playback states).
  subscribe(pipeline, %Message.PlaybackState{state: _})
Link to this function

terminate(pipeline, opts \\ [])

View Source
@spec terminate(pid(), Keyword.t()) :: :ok

Changes pipeline's playback state to :stopped and terminates its process.