Documentation ¶
Index ¶
- Constants
- type AnnounceRequest
- type Client
- func (c *Client) Feed(buf []byte) (int, error)
- func (c *Client) NewAnnounceRequest() *AnnounceRequest
- func (c *Client) NewDescribeRequest(sdp string) *DescribeRequest
- func (c *Client) NewGetParameterRequest() *GetParameterRequest
- func (c *Client) NewOptionsRequest() *OptionsRequest
- func (c *Client) NewPauseRequest() *PauseRequest
- func (c *Client) NewPlayRequest() *PlayRequest
- func (c *Client) NewRecordRequest() *RecordRequest
- func (c *Client) NewRequest(method string) *Request
- func (c *Client) NewSetParameterRequest() *SetParameterRequest
- func (c *Client) NewSetupRequest(trackId int, transport *Transport) *SetupRequest
- func (c *Client) NewTeardownRequest() *TeardownRequest
- func (c *Client) SetUrl(url string)
- func (c *Client) State() State
- type DescribeRequest
- type DescribeResponse
- type GetParameterRequest
- type HeaderLines
- type IRequest
- type IResponse
- type IRtspListener
- type IServSession
- type IServSessionEventListener
- type IServerEventListener
- type ISessionProvider
- type Logger
- type MethodEnum
- type Options
- type OptionsRequest
- type OptionsResponse
- type PauseRequest
- type PlayRequest
- type RecordRequest
- type Request
- func (req *Request) Announce() *AnnounceRequest
- func (req *Request) CSeq() int
- func (req *Request) ContentType() string
- func (req *Request) Describe() *DescribeRequest
- func (req *Request) GetContent() []byte
- func (req *Request) GetLine(key string) string
- func (req *Request) GetParameter() *GetParameterRequest
- func (req *Request) Method() MethodEnum
- func (req *Request) MethodStr() string
- func (req *Request) Option() *OptionsRequest
- func (req *Request) Pause() *PauseRequest
- func (req *Request) Play() *PlayRequest
- func (req *Request) Record() *RecordRequest
- func (req *Request) Session() string
- func (req *Request) SetContent(content string)
- func (req *Request) SetLine(key, value string)
- func (req *Request) SetParameter() *SetParameterRequest
- func (req *Request) Setup() *SetupRequest
- func (req *Request) String() string
- func (req *Request) Teardown() *TeardownRequest
- func (req *Request) Url() string
- type Response
- func (resp *Response) CSeq() int
- func (resp *Response) Content() []byte
- func (resp *Response) ContentLength() int
- func (resp *Response) Describe() *DescribeResponse
- func (resp *Response) Expires() string
- func (resp *Response) LastModified() string
- func (resp *Response) Line(key string) string
- func (resp *Response) Option() *OptionsResponse
- func (resp *Response) Server() string
- func (resp *Response) Session() string
- func (resp *Response) SetContent(content string)
- func (resp *Response) SetLine(key, value string)
- func (resp *Response) String() string
- type RtpProfile
- type RtspRole
- type Serv
- func (serv *Serv) AnnounceProcess(req *Request) error
- func (serv *Serv) DescribeProcess(req *Request) error
- func (serv *Serv) Feed(buf []byte) (int, error)
- func (serv *Serv) GetDescription() []byte
- func (serv *Serv) GetParameterProcess(req *Request) error
- func (serv *Serv) Logger() Logger
- func (serv *Serv) OptionsProcess(req *Request) error
- func (serv *Serv) PauseProcess(req *Request) error
- func (serv *Serv) PlayProcess(req *Request) error
- func (serv *Serv) SetDescribe(desc string)
- func (serv *Serv) SetParameterProcess(req *Request) error
- func (serv *Serv) SetupProcess(req *Request) error
- func (serv *Serv) State() State
- func (serv *Serv) TeardownProcess(req *Request) error
- func (serv *Serv) WriteResponse(resp IResponse) error
- func (serv *Serv) WriteResponseStatus(cseq int, status Status) error
- type ServOptions
- type ServSession
- func (ss *ServSession) AddParams(k, v interface{})
- func (ss *ServSession) DeleteParams(k interface{})
- func (ss *ServSession) GetEventListener() IServSessionEventListener
- func (ss *ServSession) GetParams(k interface{}) (interface{}, bool)
- func (ss *ServSession) Logger() Logger
- func (ss *ServSession) SetEventListener(listener IServSessionEventListener)
- type Server
- func (s *Server) Decode(c gnet.Conn) ([]byte, error)
- func (s *Server) Encode(c gnet.Conn, buf []byte) ([]byte, error)
- func (s *Server) OnClosed(c gnet.Conn, err error) (action gnet.Action)
- func (s *Server) OnInitComplete(gs gnet.Server) (action gnet.Action)
- func (s *Server) OnOpened(c gnet.Conn) (out []byte, action gnet.Action)
- func (s *Server) OnShutdown(gs gnet.Server)
- func (s *Server) Run() error
- func (s *Server) Shutdown(ctx context.Context) error
- type SetParameterRequest
- type SetupRequest
- type SetupResponse
- type State
- type Status
- type TeardownRequest
- type TrackRemote
- type Transport
- type TransportType
- type Url
- func (u *Url) ClearArgs()
- func (u *Url) DelArg(key string)
- func (u *Url) GetArg(key string) string
- func (u *Url) GetArgs() map[string]string
- func (u *Url) GetHost() string
- func (u *Url) GetPassword() string
- func (u *Url) GetPath() string
- func (u *Url) GetPort() int
- func (u *Url) GetUser() string
- func (u *Url) HasArg(key string) bool
- func (u *Url) Parse(s string) error
- func (u *Url) SetArg(key, value string)
- func (u *Url) SetArgs(args map[string]string)
- func (u *Url) SetHost(host string)
- func (u *Url) SetPassword(password string)
- func (u *Url) SetPath(path string)
- func (u *Url) SetPort(port int)
- func (u *Url) SetUser(user string)
- func (u *Url) String() string
- type WriteHandler
Constants ¶
const ( RtpProfileInvalid = iota - 1 // invalid RtpProfileAVP RtpProfileAVPF RtpProfileSAVP RtpProfileSAVPF )
const ( RtpProfileAVPStr = "rtp/avp" RtpProfileAVPFStr = "rtp/avpf" RtpProfileSAVPStr = "rtp/savp" RtpProfileSAVPFStr = "rtp/savpf" )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AnnounceRequest ¶
type AnnounceRequest struct {
IRequest
}
AnnounceRequest is a RTSP ANNOUNCE request
type Client ¶
type Client struct { Url string Write WriteHandler // contains filtered or unexported fields }
func NewClient ¶
func NewClient(write WriteHandler) *Client
func (*Client) NewAnnounceRequest ¶
func (c *Client) NewAnnounceRequest() *AnnounceRequest
func (*Client) NewDescribeRequest ¶
func (c *Client) NewDescribeRequest(sdp string) *DescribeRequest
func (*Client) NewGetParameterRequest ¶
func (c *Client) NewGetParameterRequest() *GetParameterRequest
func (*Client) NewOptionsRequest ¶
func (c *Client) NewOptionsRequest() *OptionsRequest
func (*Client) NewPauseRequest ¶
func (c *Client) NewPauseRequest() *PauseRequest
func (*Client) NewPlayRequest ¶
func (c *Client) NewPlayRequest() *PlayRequest
func (*Client) NewRecordRequest ¶
func (c *Client) NewRecordRequest() *RecordRequest
func (*Client) NewRequest ¶
func (*Client) NewSetParameterRequest ¶
func (c *Client) NewSetParameterRequest() *SetParameterRequest
func (*Client) NewSetupRequest ¶
func (c *Client) NewSetupRequest(trackId int, transport *Transport) *SetupRequest
func (*Client) NewTeardownRequest ¶
func (c *Client) NewTeardownRequest() *TeardownRequest
type DescribeRequest ¶
type DescribeRequest struct {
IRequest
}
DescribeRequest is a RTSP DESCRIBE request
func (*DescribeRequest) Accept ¶
func (req *DescribeRequest) Accept() string
func (*DescribeRequest) SetSdp ¶
func (req *DescribeRequest) SetSdp(sdp string)
type DescribeResponse ¶
type DescribeResponse struct {
IResponse
}
DescribeResponse is a RTSP DESCRIBE request
func (*DescribeResponse) ContentBase ¶
func (resp *DescribeResponse) ContentBase() string
func (*DescribeResponse) ContentType ¶
func (resp *DescribeResponse) ContentType() string
func (*DescribeResponse) Describe ¶
func (resp *DescribeResponse) Describe() string
func (*DescribeResponse) SetContentBase ¶
func (resp *DescribeResponse) SetContentBase(base string)
func (*DescribeResponse) SetContentType ¶
func (resp *DescribeResponse) SetContentType(contentType string)
type GetParameterRequest ¶
type GetParameterRequest struct {
IRequest
}
GetParameterRequest is a RTSP GET_PARAMETER request
type HeaderLines ¶
func (HeaderLines) String ¶
func (lines HeaderLines) String() string
type IResponse ¶
type IResponse interface { String() string CSeq() int Session() string // Transport() (*Transport, error) ContentLength() int Expires() string LastModified() string Server() string Content() []byte SetContent(content string) Line(key string) string SetLine(key, value string) Option() *OptionsResponse }
type IRtspListener ¶
type IRtspListener interface { OnTrackRemote(track *TrackRemote) error OnTransport(t *Transport) error }
type IServSession ¶
type IServSession interface { AddParams(k, v interface{}) GetParams(k interface{}) (interface{}, bool) DeleteParams(k interface{}) SetEventListener(listener IServSessionEventListener) GetEventListener() IServSessionEventListener Logger() Logger }
type IServerEventListener ¶
type IServerEventListener interface { OnShutdown(s *Server) OnConnect(ss IServSession) OnDisconnect(ss IServSession) }
type ISessionProvider ¶
type ISessionProvider interface {
NewOrGet() IServSession
}
type MethodEnum ¶
type MethodEnum int
const ( UnknownMethod MethodEnum = iota - 1 OptionsMethod DescribeMethod AnnounceMethod SetupMethod PlayMethod PauseMethod TeardownMethod GetParameterMethod SetParameterMethod RecordMethod )
type Options ¶
type Options struct { // ReuseAddr indicates whether to set up the SO_REUSEADDR socket option. ReuseAddr bool // ReusePort indicates whether to set up the SO_REUSEPORT socket option. ReusePort bool // TCPKeepAlive sets up a duration for (SO_KEEPALIVE) socket option. TCPKeepAlive time.Duration // TCPNoDelay enables/disables the TCP_NODELAY socket option. TCPNoDelay bool // LockOSThread enables/disables the runtime.LockOSThread() call. LockOSThread bool // SocketRecvBuffer sets the maximum socket receive buffer in bytes. SocketRecvBuffer int // SocketSendBuffer sets the maximum socket send buffer in bytes. SocketSendBuffer int // Logger is the logger for the server. Logger Logger // NumEventLoop is the number of event loops. NumEventLoop int // Multicore enables/disables the multi-core execution. Multicore bool // IdleTimeout is the maximum duration for the connection to be idle. IdleTimeout time.Duration }
type OptionsRequest ¶
type OptionsRequest struct {
IRequest
}
OptionsRequest is a RTSP OPTIONS request
func (*OptionsRequest) ProxyRequire ¶
func (req *OptionsRequest) ProxyRequire() string
func (*OptionsRequest) Require ¶
func (req *OptionsRequest) Require() string
type OptionsResponse ¶
type OptionsResponse struct {
IResponse
}
OptionsResponse is a RTSP OPTIONS request
func (*OptionsResponse) Public ¶
func (resp *OptionsResponse) Public() []string
func (*OptionsResponse) SetOptions ¶
func (resp *OptionsResponse) SetOptions(options []string)
type PauseRequest ¶
type PauseRequest struct {
IRequest
}
PauseRequest is a RTSP PAUSE request
func (*PauseRequest) Range ¶
func (req *PauseRequest) Range() string
type PlayRequest ¶
type PlayRequest struct {
IRequest
}
PlayRequest is a RTSP PLAY request
func (*PlayRequest) Range ¶
func (req *PlayRequest) Range() string
type Request ¶
type Request struct {
// contains filtered or unexported fields
}
func (*Request) Announce ¶
func (req *Request) Announce() *AnnounceRequest
func (*Request) ContentType ¶
func (*Request) Describe ¶
func (req *Request) Describe() *DescribeRequest
func (*Request) GetContent ¶
func (*Request) GetParameter ¶
func (req *Request) GetParameter() *GetParameterRequest
func (*Request) Method ¶
func (req *Request) Method() MethodEnum
func (*Request) Option ¶
func (req *Request) Option() *OptionsRequest
func (*Request) Pause ¶
func (req *Request) Pause() *PauseRequest
func (*Request) Play ¶
func (req *Request) Play() *PlayRequest
func (*Request) Record ¶
func (req *Request) Record() *RecordRequest
func (*Request) SetContent ¶
func (*Request) SetParameter ¶
func (req *Request) SetParameter() *SetParameterRequest
func (*Request) Setup ¶
func (req *Request) Setup() *SetupRequest
func (*Request) Teardown ¶
func (req *Request) Teardown() *TeardownRequest
type Response ¶
type Response struct {
// contains filtered or unexported fields
}
func NewResponse ¶
func (*Response) ContentLength ¶
func (*Response) Describe ¶
func (resp *Response) Describe() *DescribeResponse
func (*Response) LastModified ¶
func (*Response) Option ¶
func (resp *Response) Option() *OptionsResponse
func (*Response) SetContent ¶
type RtpProfile ¶
type RtpProfile int
func (*RtpProfile) Parse ¶
func (r *RtpProfile) Parse(s string) error
func (RtpProfile) String ¶
func (r RtpProfile) String() string
type Serv ¶
type Serv struct {
// contains filtered or unexported fields
}
func NewServ ¶
func NewServ(ss IServSession, options ServOptions) *Serv
func (*Serv) AnnounceProcess ¶
func (*Serv) DescribeProcess ¶
func (*Serv) GetDescription ¶
func (*Serv) GetParameterProcess ¶
func (*Serv) OptionsProcess ¶
func (*Serv) PauseProcess ¶
func (*Serv) PlayProcess ¶
func (*Serv) SetDescribe ¶
func (*Serv) SetParameterProcess ¶
func (*Serv) SetupProcess ¶
func (*Serv) TeardownProcess ¶
func (*Serv) WriteResponse ¶
type ServOptions ¶
type ServOptions struct { IdleTimeout time.Duration `json:"idleTimeout,omitempty" p:"idleTimeout"` // idle timeout Logger Logger Write WriteHandler }
type ServSession ¶
type ServSession struct {
// contains filtered or unexported fields
}
func NewServSession ¶
func NewServSession(listener IServSessionEventListener) *ServSession
func (*ServSession) AddParams ¶
func (ss *ServSession) AddParams(k, v interface{})
func (*ServSession) DeleteParams ¶
func (ss *ServSession) DeleteParams(k interface{})
func (*ServSession) GetEventListener ¶
func (ss *ServSession) GetEventListener() IServSessionEventListener
func (*ServSession) GetParams ¶
func (ss *ServSession) GetParams(k interface{}) (interface{}, bool)
func (*ServSession) Logger ¶
func (ss *ServSession) Logger() Logger
func (*ServSession) SetEventListener ¶
func (ss *ServSession) SetEventListener(listener IServSessionEventListener)
type Server ¶
type Server struct { gnet.EventServer // contains filtered or unexported fields }
func NewServer ¶
func NewServer(eventListener IServerEventListener, provider ISessionProvider, addr string, opt Options) (*Server, error)
func (*Server) OnInitComplete ¶
func (*Server) OnShutdown ¶
type SetParameterRequest ¶
type SetParameterRequest struct {
IRequest
}
SetParameterRequest is a RTSP SET_PARAMETER request
type SetupRequest ¶
type SetupRequest struct {
IRequest
}
SetupRequest is a RTSP SETUP request
func (*SetupRequest) SetTransport ¶
func (req *SetupRequest) SetTransport(transport *Transport)
func (*SetupRequest) Transport ¶
func (req *SetupRequest) Transport() (*Transport, error)
func (*SetupRequest) TransportString ¶
func (req *SetupRequest) TransportString() string
type SetupResponse ¶
type SetupResponse struct {
IResponse
}
func NewSetupResponse ¶
func NewSetupResponse(cseq int, status Status, transport *Transport) *SetupResponse
func (*SetupResponse) SetTransport ¶
func (resp *SetupResponse) SetTransport(transport *Transport)
func (*SetupResponse) Transport ¶
func (resp *SetupResponse) Transport() (*Transport, error)
type Status ¶
type Status int
const ( StatusContinue Status = 100 StatusOK Status = 200 StatusCreated Status = 201 StatusLowOnStorageSpace Status = 250 StatusMultipleChoices Status = 300 StatusMovedPermanently Status = 301 StatusMovedTemporarily Status = 302 StatusSeeOther Status = 303 StatusNotModified Status = 304 StatusUseProxy Status = 305 StatusBadRequest Status = 400 StatusPaymentRequired Status = 402 StatusForbidden Status = 403 StatusNotFound Status = 404 StatusMethodNotAllowed Status = 405 StatusNotAcceptable Status = 406 StatusProxyAuthRequired Status = 407 StatusRequestTimeout Status = 408 StatusGone Status = 410 StatusLengthRequired Status = 411 StatusPreconditionFailed Status = 412 StatusRequestEntityTooLarge Status = 413 StatusRequestURITooLarge Status = 414 StatusUnsupportedMediaType Status = 415 StatusParameterNotUnderstood Status = 451 StatusConferenceNotFound Status = 452 StatusNotEnoughBandwidth Status = 453 StatusSessionNotFound Status = 454 StatusMethodNotValid Status = 455 StatusHeaderFieldNotValid Status = 456 StatusInvalidRange Status = 457 StatusParameterIsReadOnly Status = 458 StatusAggregateNotAllowed Status = 459 StatusOnlyAggregateAllowed Status = 460 StatusUnsupportedTransport Status = 461 StatusDestinationUnreachable Status = 462 StatusKeyManagementFailure Status = 463 StatusInternalServerError Status = 500 StatusNotImplemented Status = 501 StatusBadGateway Status = 502 StatusGatewayTimeout Status = 504 StatusVersionNotSupported Status = 505 StatusOptionNotSupported Status = 551 )
100 - Continue 200 - OK 201 - Created 250 - Low on Storage Space 300 - Multiple Choices 301 - Moved Permanently 302 - Moved Temporarily 303 - See Other 304 - Not Modified 305 - Use Proxy 400 - Bad Request 401 - Unauthorized 402 - Payment Required 403 - Forbidden 404 - Not Found 405 - Method Not Allowed 406 - Not Acceptable 407 - Proxy Authentication Required 408 - Request Time-out 410 - Gone 411 - Length Required 412 - Precondition Failed 413 - Request Entity Too Large 414 - Request-URI Too Large 415 - Unsupported Media Type 451 - Parameter Not Understood 452 - Conference Not Found 453 - Not Enough Bandwidth 454 - Session Not Found 455 - Method Not Valid in This State 456 - Header Field Not Valid for Resource 457 - Invalid Range 458 - Parameter Is Read-Only 459 - Aggregate operation not allowed 460 - Only aggregate operation allowed 461 - Unsupported transport 462 - Destination unreachable 463 - Key management Failure 500 - Internal Server Error 501 - Not Implemented 502 - Bad Gateway 503 - Service Unavailable 504 - Gateway Time-out 505 - RTSP Version not supported 551 - Option not supported
type TeardownRequest ¶
type TeardownRequest struct {
IRequest
}
TeardownRequest is a RTSP TEARDOWN request
type TrackRemote ¶
type TrackRemote struct { }
type Transport ¶
type Transport struct {
// contains filtered or unexported fields
}
func NewTcpTransport ¶
func NewTcpTransport(profile RtpProfile, interleaveds []int) *Transport
func NewUdpTransport ¶
func NewUdpTransport(profile RtpProfile, clientPorts []int) *Transport
func UnmarshalTransport ¶
func (*Transport) RtcpInterleaved ¶
func (*Transport) RtpInterleaved ¶
type TransportType ¶
type TransportType int
const ( TransportTypeTcp TransportType = iota TransportTypeUdp )
type Url ¶
type Url struct { Scheme string Host string Port int Path string User string Password string Args map[string]string }