Documentation
¶
Index ¶
- Constants
- Variables
- func ConnectHTTP(verb, uri, cookie string) []byte
- func ReceiveHTTP(rdr *Conn) error
- type Conn
- func (c *Conn) AddSink(ch byte, port int) error
- func (c *Conn) Discard(n int) (discarded int, err error)
- func (c *Conn) Peek(n int) ([]byte, error)
- func (c *Conn) ReadByte() (byte, error)
- func (c *Conn) ReadBytes(n int) ([]byte, error)
- func (c *Conn) ReadLine() (string, error)
- func (c *Conn) ReadUint16() (data uint16, err error)
- func (c *Conn) Start()
- func (c *Conn) Stop()
- func (c *Conn) Write(p []byte) (n int, err error)
- type Digest
- type DigestAuth
- type Feed
- type Headers
- type MessageHeader
- type Pair
- type Queue
- type RawPacket
- type Request
- type Response
- type Session
- type Transport
Constants ¶
const ( // VerbDescribe DESCRIBE C->S P,S recommended VerbDescribe = "DESCRIBE" // VerbAnnounce ANNOUNCE C->S, S->C P,S optional VerbAnnounce = "ANNOUNCE" // VerbGetParameter GET_PARAMETER C->S, S->C P,S optional VerbGetParameter = "GET_PARAMETER" // VerbOptions OPTIONS C->S, S->C P,S required (S->C: optional) VerbOptions = "OPTIONS" // VerbPause PAUSE C->S P,S recommended VerbPause = "PAUSE" // VerbPlay PLAY C->S P,S required VerbPlay = "PLAY" // VerbRecord RECORD C->S P,S optional VerbRecord = "RECORD" // VerbRedirect REDIRECT S->C P,S optional VerbRedirect = "REDIRECT" // VerbSetup SETUP C->S S required VerbSetup = "SETUP" // VerbSetParameter SET_PARAMETER C->S, S->C P,S optional VerbSetParameter = "SET_PARAMETER" // VerbTeardown TEARDOWN C->S P,S required VerbTeardown = "TEARDOWN" )
const ( // ProtoTCP requests TCP as lower protocol. ProtoTCP = 0 // ProtoUnicast requests UDP unicast as lower protocol. ProtoUnicast = 1 // ProtoMulticast requests UDP multicast as lower protocol. ProtoMulticast = 2 // ProtoHTTP opens HTTP connections with GET and POST, transmits and receives base64 encoded RTSP messages over it. ProtoHTTP = 3 )
const ( // StageInit indicates initialization stage. StageInit = iota // StageReady indicates that setup of all transports is complete. StageReady // StagePlay indicates that playback is in progress. StagePlay // StagePause indicates that playback is paused. StagePause // StageDone indicates that connection is closing. StageDone )
const ( // HeaderAccept is HTTP Accept header. HeaderAccept = "Accept" // HeaderAuthenticate is HTTP WWW-Authenticate header. HeaderAuthenticate = "WWW-Authenticate" // HeaderAuthorization is HTTP Accept header. HeaderAuthorization = "Authorization" // HeaderContentLength is HTTP Content-Length header. HeaderContentLength = "Content-Length" // HeaderCSeq is RTSP CSeq header. HeaderCSeq = "CSeq" // HeaderPublic is HTTP Public header. HeaderPublic = "Public" // HeaderSession is RTSP Session header. HeaderSession = "Session" // HeaderTransport is RTSP Transport header. HeaderTransport = "Transport" // HeaderUserAgent is RTSP User-Agent header. HeaderUserAgent = "User-Agent" // HeaderXSessionCookie is HTTP X-SessionCookie header for RTSP over HTTP. HeaderXSessionCookie = "X-SessionCookie" // HeaderPragma is HTTP Pragma header. HeaderPragma = "Pragma" // HeaderCacheControl is HTTP Cache-Control header. HeaderCacheControl = "Cache-Control" )
const ( // RtspOK indicates that request has succeeded. RtspOK = 200 // RtspNoContent indicates that server has successfully fulfilled the request and that there is no additional content to send in the response payload body. RtspNoContent = 204 // RtspNotModified indicates that client, which made the request conditional, already has a valid representation. RtspNotModified = 304 RtspUnauthorized = 401 // RtspLowOnStorageSpace indicates insufficient storage space on server to satisfy record request. RtspLowOnStorageSpace = 250 // RtspMethodNotAllowed indicates that method specified in the request is not allowed for the resource identified by the request URI. RtspMethodNotAllowed = 405 // RtspParameterNotUnderstood indicates that recipient of the request does not support one or more parameters contained in the request. RtspParameterNotUnderstood = 451 // RtspConferenceNotFound indicates that conference indicated by a Conference header field is unknown to the media server. RtspConferenceNotFound = 452 // RtspNotEnoughBandwidth indicates that request was refused because there was insufficient bandwidth. RtspNotEnoughBandwidth = 453 // RtspSessionNotFound indicates that RTSP session identifier in the Session header is missing, RtspSessionNotFound = 454 // RtspMethodNotValidInThisState indicates that client or server cannot process this request in its current state. RtspMethodNotValidInThisState = 455 // RtspHeaderFieldNotValidForResource indicates that server could not act on a required request header. RtspHeaderFieldNotValidForResource = 456 // RtspInvalidRange indicates that Range value given is out of bounds. RtspInvalidRange = 457 // RtspParameterIsReadOnly indicates that parameter to be set by SET_PARAMETER can be read but not modified. RtspParameterIsReadOnly = 458 // RtspAggregateOperationNotAllowed indicates that requested method may not be applied on the URL in question since it is an aggregate (presentation) URL. RtspAggregateOperationNotAllowed = 459 // RtspOnlyAggregateOperationAllowed indicates that requested method may not be applied on the URL in question since it is not an aggregate (presentation) URL. RtspOnlyAggregateOperationAllowed = 460 // RtspUnsupportedTransport indicates that Transport field did not contain a supported transport specification. RtspUnsupportedTransport = 461 // RtspDestinationUnreachable indicates that data transmission channel could not be established because the client address could not be reached. RtspDestinationUnreachable = 462 // RtspOptionNotSupported indicates that option given in the Require or the Proxy-Require fields was not supported. RtspOptionNotSupported = 551 )
const (
// Agent is user agent string for this application.
Agent = "Ouro/1.0"
)
Variables ¶
var ( // ErrAuthMalformedChallenge indicates incorrectly formatted WWW-Authenticate header. ErrAuthMalformedChallenge = errors.New("Malformed authentication challenge header") // ErrAuthNotImpemented indicates missing implementation for authentication method or encryption. ErrAuthNotImpemented = errors.New("Missing implementation for authentication method") )
var ( // ErrMalformedTransport indicates trouble parsing Transport header value. ErrMalformedTransport = errors.New("Malformed value of Transport header") )
Functions ¶
func ConnectHTTP ¶
ConnectHTTP issues command for RTSP over HTTP wrapper.
func ReceiveHTTP ¶
ReceiveHTTP reads headers form the response to GET.
Types ¶
type Conn ¶
type Conn struct { Data chan RawPacket // Channel to feed incoming data and control packet to for further processing Proto int Timeout time.Duration URL *url.URL // Parsed out original URI with user credentials. BaseURI string // Formatted URI without user credentials. // contains filtered or unexported fields }
Conn encapsulates low level network connection and hides buffering and packetization.
func (*Conn) ReadBytes ¶
ReadBytes reads requested number of bytes, returning a slice containing the data.
func (*Conn) ReadLine ¶
ReadLine reads until the first occurrence of newline, returning a string containing the data up to and including newline.
func (*Conn) ReadUint16 ¶
ReadUint16 reads and returns an unsigned 2-byte integer.
func (*Conn) Start ¶
func (c *Conn) Start()
Start initiates processing of incoming packets on all UDP listeners created thus far.
type Digest ¶
type Digest struct {
// contains filtered or unexported fields
}
Digest encapsulates all information necessary to perform digest authentication against a remote site.
func NewDigest ¶
NewDigest parses challenge and creates a new basic/digest authentication processor.
func (*Digest) Authenticate ¶
func (d *Digest) Authenticate(username, password string) DigestAuth
Authenticate creates value for Authorization header.
type DigestAuth ¶
DigestAuth is function to call to encoude authorization for a particular verb in session.
type Feed ¶
type Feed struct { sdp.Media IsSet bool Sets *h264.ParameterSets // contains filtered or unexported fields }
Feed represents a media feed encapsulating SDP, transport properties, channel, and utility functions.
func ParseFeeds ¶
ParseFeeds creates media feeds from parsed SDP body.
func (*Feed) TransportHeader ¶
TransportHeader returns a formatted transport header for SETUP request.
func (*Feed) TransportSetup ¶
TransportSetup populates transport properties from response to SETUP verb.
type MessageHeader ¶
An MessageHeader represents a MIME-style header mapping keys to values.
func (MessageHeader) Del ¶
func (h MessageHeader) Del(key string)
Del deletes the values associated with key.
func (MessageHeader) Get ¶
func (h MessageHeader) Get(key string) string
Get gets the first value associated with the given key.
func (MessageHeader) Set ¶
func (h MessageHeader) Set(key string, value string)
Set sets the header associated with key to the given value.
type Pair ¶
Pair represents a pair of channels or ports.
type Request ¶
type Request struct { Verb string Cseq int URI string Auth string Session string Header MessageHeader }
Request encapsulates verb, uri, and headers for RTSP command.
type Response ¶
type Response struct { Proto string Status string StatusCode int ContentLength int64 Cseq int Header MessageHeader Body []byte }
Response encapsulates RTSP response. It is modeled by http.Response but includes only what is needed to handle RTSP.
type Session ¶
type Session struct { *Conn sync.Mutex State chan int // Stage signaller. // contains filtered or unexported fields }
Session maintains RTSP session and workflow.
func (*Session) Describe ¶
Describe handles DESCRIBE request in RTSP and parses SDP data in response.
func (*Session) KeepAlive ¶
KeepAlive executes OPTIONS on a regular basis to keep connection alive. RTP over TCP does not need keep-alive messages according to RFC.
type Transport ¶
type Transport struct { IsTCP bool IsMulticast bool IsInterleaved bool IsAppend bool Interleave Pair Port Pair ClientPort Pair ServerPort Pair Layers int TTL int Destination string Source string SSRC string Mode string }
Transport encapsulates RTSP transport header information.
func NewTransport ¶
NewTransport creates default transport for media.