Membrane.RTSP.Server (Membrane RTSP v0.12.0)
View SourceImplementation of an RTSP server.
Usage
To use the RTSP server, you should start it and provide some configuration. To start a new server under a supervision tree:
children = [
{Membrane.RTSP.Server, [port: 8554, handler: MyRequestHandler]}
]
Supervisor.start_link(children, strategy: :one_for_one)Or start it directly by calling start_link/1 or start/1.
{:ok, server} = Membrane.RTSP.Server.start_link(config)For the available configuration options refer to start_link/1
Summary
Functions
Returns a specification to start this module under a supervisor.
Get the port number of the server.
Start an instance of the RTSP server.
Start and link an instance of the RTSP server.
Stops the RTSP server.
In interleaved TCP mode we want to pass control over the client connection socket to the pipeline (usually).
Types
@type server_config() :: [server_option()]
@type server_option() :: {:handler, module()} | {:handler_config, term()} | {:name, term()} | {:port, :inet.port_number()} | {:address, :inet.ip_address()} | {:udp_rtp_port, :inet.port_number()} | {:udp_rtcp_port, :inet.port_number()} | {:session_timeout, non_neg_integer()}
Functions
Returns a specification to start this module under a supervisor.
See Supervisor.
@spec port_number(pid() | GenServer.name()) :: {:ok, :inet.port_number()} | {:error, any()}
Get the port number of the server.
If the server started with port number 0, the os will choose an available port to assign to the server.
@spec start(server_config()) :: GenServer.on_start()
Start an instance of the RTSP server.
Refer to start_link/1 for the available configuration.
@spec start_link(server_config()) :: GenServer.on_start()
Start and link an instance of the RTSP server.
Options
handler- An implementation of the behaviourMembrane.RTSP.Server.Handler. Refer to the module documentation for more details. This field is required.handler_config- Term that will be passed as an argument toinit/1callback of the handler. Defaults tonil.name- Used for name registration of the server. Defaults tonil.port- The port where the server will listen for client connections. Defaults to:554address- Specify the address where thetcpandudpsockets will be bound. Defaults to:any.udp_rtp_port- The port number of theUDPsocket that will be opened to sendRTPpackets.udp_rtcp_port- The port number of theUDPsocket that will be opened to sendRTCPpackets.session_timeout- if the server does not receive any request from the client within the specified timeframe (in seconds), the connection will be closed. Defaults to 60 seconds.
Server UDP support
Both udp_rtp_port and udp_rtcp_port must be provided for the server
to support UDP transport.
Stops the RTSP server.
Options
timeout- timeout of the server termination, passed toGenServer.stop/3.
@spec transfer_client_socket_control( server_pid :: pid() | GenServer.name(), client_conn_pid :: pid(), new_controlling_process_pid :: pid() ) :: :ok | {:error, :unknown_conn | :closed | :not_owner | :badarg | :inet.posix()}
In interleaved TCP mode we want to pass control over the client connection socket to the pipeline (usually).
This function allows to transfer the control over such socket to a specified process.