Versions in this module Expand all Collapse all v0 v0.0.1 Aug 22, 2019 Changes in this version + const InterleavedFrameHeaderLength + const MethodAnnounce + const MethodDescribe + const MethodGetParameter + const MethodOptions + const MethodPause + const MethodPlay + const MethodRecord + const MethodSetParameter + const MethodSetup + const MethodTeardown + const RTPFixedHeaderLength + const StatusAccepted + const StatusAlreadyReported + const StatusBadGateway + const StatusBadRequest + const StatusConflict + const StatusContinue + const StatusCreated + const StatusExpectationFailed + const StatusFailedDependency + const StatusForbidden + const StatusFound + const StatusGatewayTimeout + const StatusGone + const StatusHTTPVersionNotSupported + const StatusIMUsed + const StatusInsufficientStorage + const StatusInternalServerError + const StatusLengthRequired + const StatusLocked + const StatusLoopDetected + const StatusMethodNotAllowed + const StatusMethodNotValidInThisState + const StatusMisdirectedRequest + const StatusMovedPermanently + const StatusMultiStatus + const StatusMultipleChoices + const StatusNetworkAuthenticationRequired + const StatusNoContent + const StatusNonAuthoritativeInfo + const StatusNotAcceptable + const StatusNotExtended + const StatusNotFound + const StatusNotImplemented + const StatusNotModified + const StatusOK + const StatusPartialContent + const StatusPaymentRequired + const StatusPermanentRedirect + const StatusPreconditionFailed + const StatusPreconditionRequired + const StatusProcessing + const StatusProxyAuthRequired + const StatusRequestEntityTooLarge + const StatusRequestHeaderFieldsTooLarge + const StatusRequestTimeout + const StatusRequestURITooLong + const StatusRequestedRangeNotSatisfiable + const StatusResetContent + const StatusSeeOther + const StatusServiceUnavailable + const StatusSwitchingProtocols + const StatusTeapot + const StatusTemporaryRedirect + const StatusTooEarly + const StatusTooManyRequests + const StatusUnauthorized + const StatusUnavailableForLegalReasons + const StatusUnprocessableEntity + const StatusUnsupportedMediaType + const StatusUpgradeRequired + const StatusUseProxy + const StatusVariantAlsoNegotiates + var ErrorClientAlreadyStopped = errors.New("RTSP client already stopped") + var ErrorDropFrame = errors.New("drop frame due to full queue") + var ErrorInterleavedFrameHeaderTooShort = errors.New("interleave frame too short") + var ErrorInterleavedMagicNumberWrong = errors.New("interleaved magic number wrong") + var ErrorNotImplement = errors.New("not implement") + var ErrorRTPTooShort = errors.New("RTP packet is too short") + var ErrorTimeout = errors.New("Timeout") + var ErrorUserinfoNeed = errors.New("Need user info to login") + func DecodeSDP(b []byte) (m *sdp.Message, err error) + func EncodeRTPInfo(infos []*RTPInfo) string + func EncodeSDP(m *sdp.Message) []byte + func GetSDPAttribute(media *sdp.Media, key string) (string, error) + func ParseRTSPVersion(vers string) (major, minor int, ok bool) + func SetSDPAttribute(media *sdp.Media, key, value string) error + func StatusText(statusCode int) string + type Authorization interface + Inject func(*Request) error + func NewAuthenticate(wwwAuthenticate, username, password string) (Authorization, error) + type Client struct + CSeq uint64 + Options *ClientOptions + URL *url.URL + Userinfo *url.Userinfo + func Dial(ctx context.Context, rawurl string, options *ClientOptions) (*Client, error) + func (client *Client) ReadInterleavedFrame() <-chan InterleavedFrame + func (client *Client) SendRequest(request *Request, timeout time.Duration) (*Response, error) + func (client *Client) Stop() error + type ClientOptions struct + ConnectTimeout time.Duration + ReadBufferSize int + ReadInterleavedFrameSize int + WriteQueueSize int + func DefaultClientOptions() *ClientOptions + type InterleavedFrame [][]byte + func ParseInterleavedFrame(b [][]byte) (InterleavedFrame, error) + func ReadInterleavedFrame(reader *bufio.Reader) (frame InterleavedFrame, err error) + func (frame InterleavedFrame) Channel() uint8 + func (frame InterleavedFrame) Data() []byte + func (frame InterleavedFrame) Length() int + type MediaChannel struct + Control string + ControlID int + ControlQueue chan RTCPPacket + MediaID int + MediaQueue chan RTPPacket + SSRC []byte + Type RTPTransportType + func (mc *MediaChannel) HandleRTCP(p []byte) error + func (mc *MediaChannel) HandleRTP(p []byte) error + func (mc *MediaChannel) String() string + func (mc *MediaChannel) TCPString() string + type PlayOptions struct + ControlQueueSize int + Keepalive time.Duration + MediaQueueSize int + Timeout time.Duration + UserAgent string + func DefaultPlayOptions() *PlayOptions + type PlaySession struct + Channels []*MediaChannel + ContentBase string + Keepalive time.Duration + RTPInfos []*RTPInfo + SDP *sdp.Message + Token string + func Play(client *Client, options *PlayOptions) (session *PlaySession, err error) + func (session *PlaySession) NewRequest(method, control string) (*Request, error) + func (session *PlaySession) PrefixURL() string + type RTCPPacket []byte + func ParseRTCP(b []byte) (RTCPPacket, error) + type RTPInfo struct + Control string + Packet RTPPacket + func DecodeRTPInfo(raw string) (infos []*RTPInfo, _ error) + func (info *RTPInfo) String() string + type RTPPacket []byte + func ParseRTP(b []byte) (RTPPacket, error) + func (p RTPPacket) CSRCCount() int + func (p RTPPacket) Extension() bool + func (p RTPPacket) Len() int + func (p RTPPacket) Marker() bool + func (p RTPPacket) Padding() bool + func (p RTPPacket) Payload() []byte + func (p RTPPacket) PayloadType() int + func (p RTPPacket) SSRC() uint32 + func (p RTPPacket) SequenceNumber() uint16 + func (p RTPPacket) SetSequenceNumber(seq uint16) + func (p RTPPacket) SetTimestamp(timestamp uint32) + func (p RTPPacket) Timestamp() uint32 + func (p RTPPacket) Version() int + type RTPTransportType int + const RTPOverTCP + const RTPOverUDP + const RTPTransportInvalid + type Request struct + Body []byte + CSeq uint64 + Control string + Header header.Header + Method string + ProtoMajor int + ProtoMinor int + RawURL string + URL *url.URL + func NewRequest(method string, rawurl string) *Request + func ReadRequest(r *bufio.Reader) (request *Request, err error) + func (r *Request) Bytes() []byte + type Response struct + Body []byte + CSeq uint64 + Header header.Header + ProtoMajor int + ProtoMinor int + StatusCode int + func ReadResponse(r *bufio.Reader) (response *Response, err error) + func (response *Response) Bytes() []byte