View Source Membrane.RTSP.Request (Membrane RTSP v0.5.1)

This module represents a RTSP 1.0 request.

Summary

Functions

Returns the encoded URI as a binary. This is handy for digest auth since this value must be encoded as per the digest algorithm

Renders the a RTSP request struct into a binary that is a valid RTSP request string that can be transmitted via communication channel.

Attaches a header to a RTSP request struct.

Types

@type t() :: %Membrane.RTSP.Request{
  body: binary(),
  headers: Membrane.RTSP.headers(),
  method: binary(),
  path: nil | binary()
}

Functions

Link to this function

process_uri(request, uri)

View Source
@spec process_uri(t(), URI.t()) :: binary()

Returns the encoded URI as a binary. This is handy for digest auth since this value must be encoded as per the digest algorithm

@spec stringify(t(), URI.t()) :: binary()

Renders the a RTSP request struct into a binary that is a valid RTSP request string that can be transmitted via communication channel.

iex> uri = URI.parse("rtsp://domain.net:554/path:movie.mov")
iex> Request.stringify(%Request{method: "DESCRIBE"}, uri)
"DESCRIBE rtsp://domain.net:554/path:movie.mov RTSP/1.0\r\n\r\n"
iex> Request.stringify(%Request{method: "PLAY", path: "trackID=2"}, uri)
"PLAY rtsp://domain.net:554/path:movie.mov/trackID=2 RTSP/1.0\r\n\r\n"

Access credentials won't be rendered into an url present in a RTSP start line.

iex> uri = URI.parse("rtsp://user:password@domain.net:554/path:movie.mov")
iex> Request.stringify(%Request{method: "DESCRIBE"}, uri)
"DESCRIBE rtsp://domain.net:554/path:movie.mov RTSP/1.0\r\n\r\n"
Link to this function

with_header(request, name, value)

View Source
@spec with_header(t(), binary(), binary()) :: t()

Attaches a header to a RTSP request struct.

  iex> Request.with_header(%Request{method: "DESCRIBE"}, "header_name", "header_value")
  %Request{method: "DESCRIBE", headers: [{"header_name","header_value"}]}