Packages
membrane_core
1.3.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
templates/bin.ex
defmodule Membrane.TemplateBin do
@moduledoc """
This is a generated template for a Membrane.Bin. Uncomment the snippets as necessary.
"""
use Membrane.Bin
require Membrane.Logger
# def_input_pad :input,
# accepted_format: _any
# availability: :on_request | :always, # default - :always
# max_instances: pos_integer() | :infinity, # relevant only for pads with `availability: :on_request`, default - :infinity
# options: [
# Same structure as in def_options/1
# ]
# def_output_pad :output,
# accepted_format: _any
# availability: :on_request | :always, # default - :always
# max_instances: pos_integer() | :infinity, # relevant only for pads with `availability: :on_request`, default - :infinity
# options: [
# Same structure as in def_options/1
# ]
# This macro also defines a struct of this module, which is then used for providing options
# when instantiating this component.
# def_options some_option: [
# spec: typespec of the option.
# default: default value - if not set, providing this option will be mandatory.
# inspector: function converting fields' value to a string for documentation purposes. If not set, &inspect/1 will be used.
# description: """
# Desription of the option.
# """
# ]
defmodule State do
# Using this struct is not strictly necessary, but it's considered a good practice
# and is strongly encouraged. Having a state with static fields with defined
# typespecs adds robustness to the codebase and can prevent many bugs.
@moduledoc false
# When you add new fields to the struct remember to add them to this spec too.
@type t :: %__MODULE__{}
defstruct []
end
# -----------------
# --- CALLBACKS ---
# -----------------
# These callbacks have been ordered as they are usually being executed in the lifecycle
# of a typical Membrane component - see https://hexdocs.pm/membrane_core/components_lifecycle.html.
# Most of them are optional and have default implementations, which are present here as commented out code.
# Any exceptions to this rule are mentioned above the relevant callbacks.
# By default this callback will return with state set to an empty map %{},
# however we recommend using a dedicated State struct.
@impl true
def handle_init(_ctx, _opts) do
{[], %State{}}
end
# This callback will be executed only for pads with `availability: :on_request`.
# @impl true
# def handle_pad_added(_pad, _context, state) do
# {[], state}
# end
# This callback will be executed only for pads with `availability: :on_request`.
# @impl true
# def handle_pad_removed(_pad, _context, state) do
# {[], state}
# end
# @impl true
# def handle_setup(_context, state) do
# {[], state}
# end
# @impl true
# def handle_playing(_context, state) do
# {[], state}
# end
# @impl true
# def handle_info(message, _context, state) do
# Membrane.Logger.warning("""
# Received message but no handle_info callback has been specified. Ignoring.
# Message: #{inspect(message)}\
# """)
#
# {[], state}
# end
# @impl true
# def handle_child_setup_completed(_child, _ctx, state) do
# {[], state}
# end
# @impl true
# def handle_child_playing(_child, _ctx, state) do
# {[], state}
# end
# @impl true
# def handle_element_start_of_stream(_element, _pad, _ctx, state) do
# {[], state}
# end
# @impl true
# def handle_element_end_of_stream(_element, _pad, _ctx, state) do
# {[], state}
# end
# @impl true
# def handle_child_notification(_notification, _element, _ctx, state) do
# {[], state}
# end
# @impl true
# def handle_parent_notification(_notification, _ctx, state) do
# {[], state}
# end
# @impl true
# def handle_crash_group_down(_group_name, _ctx, state) do
# {[], state}
# end
# @impl true
# def handle_terminate_request(_ctx, state) do
# {[terminate: :normal], state}
# end
# @impl true
# def handle_child_terminated(_child, _ctx, state) do
# {[], state}
# end
# This callback doesn't have a default implementation, but will be called only
# if a `:start_timer` action has been executed. For more information and examples
# of timer usage see https://hexdocs.pm/membrane_core/timer.html.
# @impl true
# def handle_tick(timer_id, context, state) do
# ...
# end
# This callback doesn't have a default implementation and will be called only if
# a child removes it's own dynamic pad. If not implemented, the bin will crash.
# @impl true
# handle_child_pad_removed(element, pad, ctx, state) do
# ...
# end
end