Packages
membrane_core
0.2.1
1.3.4
1.3.3
1.3.2
1.3.1
1.3.0
1.2.7
1.2.6
1.2.5
retired
1.2.4
1.2.3
1.2.2
1.2.1
1.2.0
1.2.0-rc1
1.1.2
1.1.1
1.1.0
1.1.0-rc1
1.1.0-rc0
1.0.1
1.0.0
1.0.0-rc1
1.0.0-rc0
0.12.9
0.12.8
0.12.7
0.12.6
0.12.5
0.12.4
0.12.3
0.12.2
0.12.1
0.12.0
retired
0.11.5
0.11.4
0.11.3
0.11.2
0.11.1
0.11.0
0.10.2
0.10.1
0.10.0
0.9.0
0.8.2
0.8.1
0.8.0
0.7.0
0.6.1
0.6.0
0.5.3
0.5.2
0.5.1
0.5.0
0.4.3
0.4.2
0.4.1
0.4.0
0.3.2
0.3.1
0.3.0
0.2.2
0.2.1
0.2.0
0.1.1
0.1.0
Membrane Multimedia Framework (Core)
Current section
Files
Jump to
Current section
Files
lib/membrane/pipeline/spec.ex
defmodule Membrane.Pipeline.Spec do
@moduledoc """
Structure representing topology of a pipeline.
It can be returned from
`c:Membrane.Pipeline.handle_init/1` callback upon pipeline's initialization.
It will define a topology of children and links that build the pipeline.
## Children
Children that should be spawned when the pipeline starts can be defined
with the `:children` field.
You have to set it to a keyword list, where keys are valid element name
that is unique within this pipeline and values are either element's module or
struct of that module.
Sample definitions:
[
first_element: %Element.With.Options.Struct{option_a: 42},
some_element: Element.Without.Options,
other_element: Element.Using.Default.Options
]
When defining children, some additional parameters can be provided by wrapping
child definition with a tuple and putting keyword list of parameters at the end:
[
first_element: {Element.Bare, indexed: true},
second_element: {%Element{opt_a: 42}, indexed: true}
]
Available params are described in `t:child_property_t/0`
## Links
Links that should be made when the pipeline starts, and children are spawned
can be defined with the `:links` field.
You have to set it to a map, where both keys and values are tuples of
`{element_name, pad_name}`. Values can also have additional options passed by
keyword list at the end (See `t:link_option_t/0`).
Element names have to match names given to the `:children` field.
Once it's done, pipeline will ensure that links are present.
Sample definition:
%{
{:source, :output} => {:converter, :input, pull_buffer: [preferred_size: 20_000]},
{:converter, :output} => {:aggregator, :input},
{:aggregator, :output} => {:sink, :input},
}
"""
alias Membrane.Element
alias Membrane.Core.PullBuffer
alias Element.Pad
@type child_spec_t :: module | struct
@typedoc """
Description of all the children elements inside the pipeline
"""
@type children_spec_t ::
[{Membrane.Element.name_t(), child_spec_t}]
| %{Membrane.Element.name_t() => child_spec_t}
@typedoc """
Options available when linking elements in the pipeline
`:pull_buffer` allows to configure Buffer between elements. See `t:Membrane.Core.PullBuffer.props_t/0`
"""
@type link_option_t :: {:pull_buffer, PullBuffer.props_t()}
@type link_from_spec_t :: {Element.name_t(), Pad.name_t()}
@type link_to_spec_t ::
{Element.name_t(), Pad.name_t()}
| {Element.name_t(), Pad.name_t(), [link_option_t]}
@typedoc """
Map describing links between elements
"""
@type links_spec_t :: %{required(link_from_spec_t) => link_to_spec_t}
@typedoc """
Struct used when launching a pipeline
"""
@type t :: %__MODULE__{
children: children_spec_t,
links: links_spec_t
}
defstruct children: [],
links: %{}
end