View Source Membrane.RCPipeline (Membrane Core v1.1.1)

Remote controlled pipeline - a basic Membrane.Pipeline implementation that can be remotely controlled from an external process.

The easiest way to start this pipeline is to use start_link!/1

  pipeline = Membrane.RCPipeline.start_link!()

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

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

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

# subscribes to message which is sent when the pipeline enters `playing`
Membrane.RCPipeline.subscribe(pipeline, %Message.Playing{})
...
# awaits for the message sent when the pipeline enters :playing playback
Membrane.RCPipeline.await_playing(pipeline)
...

Membrane.RCPipeline 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.RCPipeline sends the following messages:

Summary

Functions

Awaits for the first Membrane.RCMessage.t/0 wrapping the Membrane.RCMessage.EndOfStream.t/0 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.RCMessage.t/0 wrapping the Membrane.RCMessage.EndOfStream.t/0 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.RCMessage.t/0 wrapping the Membrane.RCMessage.EndOfStream.t/0 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.RCMessage.t/0 wrapping the Membrane.RCMessage.Notification.t/0 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.RCMessage.t/0 wrapping the Membrane.RCMessage.Notification.t/0 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.RCMessage.t/0 wrapping the Membrane.RCMessage.Playing.t/0 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.RCMessage.t/0 wrapping the Membrane.RCMessage.StartOfStream.t/0 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.RCMessage.t/0 wrapping the Membrane.RCMessage.StartOfStream.t/0 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.RCMessage.t/0 wrapping the Membrane.RCMessage.StartOfStream.t/0 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.RCMessage.t/0 wrapping the Membrane.RCMessage.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.

Returns child specification for spawning under a supervisor

Sends a list of t:Pipeline.Action.t/0 to the given Membrane.RCPipeline for execution.

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

Starts the Membrane.RCPipeline and links it to the current process. The process that makes the call to the start_link/1 automatically becomes the controller process.

Subscribes to a given subscription_pattern. The subscription_pattern should describe some subset of elements of t:Membrane.RCPipeline.Message.t/0 type. The subscription_pattern must be a match pattern.

Functions

Link to this function

await_end_of_stream(pipeline)

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

Awaits for the first Membrane.RCMessage.t/0 wrapping the Membrane.RCMessage.EndOfStream.t/0 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
@spec await_end_of_stream(pid(), Membrane.Element.name()) ::
  Membrane.RCMessage.EndOfStream.t()

Awaits for the first Membrane.RCMessage.t/0 wrapping the Membrane.RCMessage.EndOfStream.t/0 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.RCMessage.t/0 wrapping the Membrane.RCMessage.EndOfStream.t/0 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.RCMessage.Notification.t()

Awaits for the first Membrane.RCMessage.t/0 wrapping the Membrane.RCMessage.Notification.t/0 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.RCMessage.t/0 wrapping the Membrane.RCMessage.Notification.t/0 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)
@spec await_playing(pid()) :: Membrane.RCMessage.Playing.t()

Awaits for the first Membrane.RCMessage.t/0 wrapping the Membrane.RCMessage.Playing.t/0 It is required to firstly use the subscribe/2 to subscribe to a given message before awaiting for that message.

Usage example:

  1. awaiting until the pipeline starts playing:
    Pipeline.await_playing(pipeline)
Link to this function

await_start_of_stream(pipeline)

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

Awaits for the first Membrane.RCMessage.t/0 wrapping the Membrane.RCMessage.StartOfStream.t/0 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
@spec await_start_of_stream(pid(), Membrane.Element.name()) ::
  Membrane.RCMessage.StartOfStream.t()

Awaits for the first Membrane.RCMessage.t/0 wrapping the Membrane.RCMessage.StartOfStream.t/0 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.RCMessage.t/0 wrapping the Membrane.RCMessage.StartOfStream.t/0 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.RCMessage.Terminated.t()

Awaits for the Membrane.RCMessage.t/0 wrapping the Membrane.RCMessage.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)

Returns child specification for spawning under a supervisor

Link to this function

exec_actions(pipeline, actions)

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

Sends a list of t:Pipeline.Action.t/0 to the given Membrane.RCPipeline for execution.

Usage example:

  1. making the Membrane.RCPipeline start the Membrane.ChildrenSpec specified in the action.
    children = ...
    links = ...
    actions = [{:spec, children++links}]
    Pipeline.exec_actions(pipeline, actions)
@spec start([Membrane.Pipeline.config_entry() | {:controller_pid, pid()}]) ::
  Membrane.Pipeline.on_start()

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

@spec start!([Membrane.Pipeline.config_entry() | {:controller_pid, pid()}]) :: pid()
Link to this function

start_link(options \\ [])

View Source
@spec start_link([Membrane.Pipeline.config_entry() | {:controller_pid, pid()}]) ::
  Membrane.Pipeline.on_start()

Starts the Membrane.RCPipeline and links it to the current process. The process that makes the call to the start_link/1 automatically becomes the controller process.

Link to this function

start_link!(options \\ [])

View Source
@spec start_link!([Membrane.Pipeline.config_entry() | {:controller_pid, pid()}]) ::
  pid()
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 t:Membrane.RCPipeline.Message.t/0 type. The subscription_pattern must be a match pattern.

Usage examples:

  1. making the Membrane.RCPipeline 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.RCPipeline send to the controlling process Message.Playing message when the pipeline playback changes to :playing
  subscribe(pipeline, %Message.Playing{})
Link to this function

terminate(pipeline, opts \\ [])

View Source
@spec terminate(pid(), Keyword.t()) :: :ok | {:ok, pid()} | {:error, :timeout}

See Membrane.Pipeline.terminate/2.