Membrane.SRT.Source (Membrane SRT plugin v0.2.0)

View Source

Membrane Source acting as a SRT server. It listens for connection on given port. When the connection is estabilished, it start receiving stream with given stream_id.

Element options

Passed via struct Membrane.SRT.Source.t/0

  • ip

    String.t() | nil

    Default value: nil
    Address on which the server starts listening.

  • port

    :inet.port_number() | nil

    Default value: nil
    Port on which the server starts listening.

  • stream_id

    String.t() | nil

    Default value: nil
    ID of the stream which will be accepted by this server.

  • password

    String.t() | nil

    Default value: nil
    Password used to authenticate the connection. If set, the server will require clients to provide this password when connecting. If not set, the server will accept connections without authentication. Note that if you set this option, you must also set the same password on the client side when connecting to this server. Password needs to have between 10 and 79 characters.

    Please note that it can only be used along ip, port and stream_id options (password cannot be set when server and conn_id are provided).

  • server

    ExLibSRT.Server.t() | nil

    Default value: nil
    Reference to an already-running ExLibSRT.Server. Must be provided together with conn_id.

    When using this option, the other options (ip, port, stream_id and password) cannot be set. If you want to use Membrane.SRT.Source with that option, remember to spawn the element right after receiving {:srt_server_conn, conn_id, stream_id} message from the server, so that the source can bind to the desired connection within the 1-second timeout.

    Exemplary usage scenario:

    # Start the server listening on desired address and port {:ok, server} = ExLibSRT.Server.start(<ip>, <port>, accept_mode: :accept_all)

    # Wait until a client with desired stream_id connects receive do

    {:srt_server_conn, conn_id, _stream_id} ->
      pid = Membrane.RCPipeline.start_link!()
    
      # Spawn the `Membrane.SRT.Source` element and pass the server
      # and connection ID as arguments
      spec =
        child(:source, %Membrane.SRT.Source{server: server, conn_id: conn_id})
        |> child(:sink, %Membrane.File.Sink{location: "output.ts"})
      Membrane.RCPipeline.exec_actions(pid, spec: spec)

    end

  • conn_id

    ExLibSRT.Server.connection_id() | nil

    Default value: nil
    Connection ID received via {:srt_server_conn, conn_id, stream_id}. Must be provided together with server.

Pads

:output

Accepted formats:

Membrane.RemoteStream
Direction::output
Availability::always
Flow control::push

Summary

Types

t()

Struct containing options for Membrane.SRT.Source

Functions

Returns description of options available for this module

Types

t()

@type t() :: %Membrane.SRT.Source{
  conn_id: ExLibSRT.Server.connection_id() | nil,
  ip: String.t() | nil,
  password: String.t() | nil,
  port: :inet.port_number() | nil,
  server: ExLibSRT.Server.t() | nil,
  stream_id: String.t() | nil
}

Struct containing options for Membrane.SRT.Source

Functions

options()

@spec options() :: keyword()

Returns description of options available for this module