Membrane.RTSP.Response (Membrane RTSP v0.2.1) View Source

This module represents a RTSP response.

Link to this section Summary

Functions

Retrieves the first header matching given name from a response.

Parses RTSP response.

Link to this section Types

Specs

result() :: {:ok, t()} | {:error, atom()}

Specs

t() :: %Membrane.RTSP.Response{
  body: Membrane.Protocol.SDP.Session.t() | binary(),
  headers: Membrane.RTSP.headers(),
  status: non_neg_integer(),
  version: term()
}

Link to this section Functions

Link to this function

get_header(response, name)

View Source

Specs

get_header(t(), binary()) :: {:error, :no_such_header} | {:ok, binary()}

Retrieves the first header matching given name from a response.

  iex> response = %Response{
  ...>   status: 200,
  ...>   version: "1.0",
  ...>   headers: [{"header_name", "header_value"}]
  ...> }
  iex> Response.get_header(response, "header_name")
  {:ok, "header_value"}
  iex> Response.get_header(response, "non_existent_header")
  {:error, :no_such_header}

Specs

parse(binary()) ::
  {:ok, t()} | {:error, :invalid_start_line | :malformed_header}

Parses RTSP response.

If the body is present it will be parsed according to Content-Type header. Currently only the application/sdp is supported.