Documentation ¶
Index ¶
- Constants
- Variables
- type Auth
- type AuthBasic
- type AuthDigest
- type Client
- func (c *Client) Close()
- func (c *Client) GetSDP() []*SdpItem
- func (c *Client) Ping(ctx context.Context) error
- func (c *Client) Play(ctx context.Context, handler MediaHandler) error
- func (c *Client) SendRequest(request *Request) error
- func (c *Client) Setup(ctx context.Context, mediaID int, control *url.URL) error
- func (c *Client) Start(ctx context.Context) error
- func (c *Client) Teardown(ctx context.Context) error
- type Media
- type MediaH264
- type MediaH265
- type MediaHandler
- type MediaMPEG4
- type Request
- type Response
- type SdpItem
- type Transport
- type TransportTCP
- type TransportUDP
Constants ¶
const ( MethodDescribe = "DESCRIBE" MethodGetParameter = "GET_PARAMETER" MethodOptions = "OPTIONS" MethodPlay = "PLAY" MethodSetup = "SETUP" MethodTeardown = "TEARDOWN" )
Method Definitions
const SdpMimeType = "application/sdp"
Variables ¶
var ( ErrClientClosed = fmt.Errorf("client closed") ErrResponseTimeout = fmt.Errorf("response timeout") )
Functions ¶
This section is empty.
Types ¶
type Auth ¶
type AuthBasic ¶
type AuthBasic struct {
// contains filtered or unexported fields
}
The 'Basic' HTTP Authentication Scheme https://datatracker.ietf.org/doc/html/rfc7617
func NewAuthBasic ¶
type AuthDigest ¶
type AuthDigest struct {
// contains filtered or unexported fields
}
HTTP Digest Access Authentication https://datatracker.ietf.org/doc/html/rfc7616
func NewAuthDigest ¶
func NewAuthDigest(login, password, header string) *AuthDigest
func (*AuthDigest) Header ¶
func (a *AuthDigest) Header(method, uri string) string
type Client ¶
type Client struct { UseTCP bool URL *url.URL UserAgent string ConnectTimeout time.Duration RequestTimeout time.Duration // contains filtered or unexported fields }
Real Time Streaming Protocol (RTSP) https://datatracker.ietf.org/doc/html/rfc2326
func (*Client) Close ¶
func (c *Client) Close()
Close closes the connection and closes all transports. Should be called after Play() finished
func (*Client) Play ¶
func (c *Client) Play(ctx context.Context, handler MediaHandler) error
Play sends request to start the stream delivery. Waits for ctx.Done or any error on transport. For UDP transport it sends keep-alive requests each 30 second
func (*Client) SendRequest ¶
SendRequest sends RTSP/1.0 request to the server.
type MediaH264 ¶
type MediaH264 struct { ClockRate int PacketizationMode int ProfileLevelID []byte SPS []byte PPS []byte }
RTP Payload Format for H.264 Video https://datatracker.ietf.org/doc/html/rfc6184
func NewMediaH264 ¶
type MediaH265 ¶
RTP Payload Format for High Efficiency Video Coding (HEVC) https://datatracker.ietf.org/doc/html/rfc7798
func NewMediaH265 ¶
type MediaHandler ¶
type MediaMPEG4 ¶
RTP Payload Format for Transport of MPEG-4 Elementary Streams https://datatracker.ietf.org/doc/html/rfc3640
func NewMediaMPEG4 ¶
func NewMediaMPEG4(clockRate int) *MediaMPEG4
func (*MediaMPEG4) ParseFMTP ¶
func (m *MediaMPEG4) ParseFMTP(line string)
type Response ¶
func ReadResponse ¶
ReadResponse reads a response from the server.
type SdpItem ¶
SDP: Session Description Protocol https://datatracker.ietf.org/doc/html/rfc2327
type Transport ¶
type Transport interface { // Setup configures the transport. // Returns the transport protocol header for RTSP SETUP request Setup(mediaID int) (string, error) // Play starts the transport Play(handler MediaHandler) // Close closes the transport Close() // Err returns the transport error Err() <-chan error }
type TransportTCP ¶
type TransportTCP struct {
// contains filtered or unexported fields
}
func NewTransportTCP ¶
func NewTransportTCP(reader *bufio.Reader) *TransportTCP
func (*TransportTCP) Close ¶
func (t *TransportTCP) Close()
func (*TransportTCP) Err ¶
func (t *TransportTCP) Err() <-chan error
func (*TransportTCP) Play ¶
func (t *TransportTCP) Play(handler MediaHandler)
Play starts receigin RTP/RTCP packets.
type TransportUDP ¶
type TransportUDP struct {
// contains filtered or unexported fields
}
func NewTransportUDP ¶
func NewTransportUDP() *TransportUDP
func (*TransportUDP) Close ¶
func (t *TransportUDP) Close()
func (*TransportUDP) Err ¶
func (t *TransportUDP) Err() <-chan error
func (*TransportUDP) Play ¶
func (t *TransportUDP) Play(handler MediaHandler)
Play starts receigin RTP/RTCP packets.