rtsp

package
v0.0.0-...-36a4cef Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 25, 2022 License: MIT Imports: 15 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetMethods

func GetMethods() []string

GetMethods all RTSP methods as a slice of strings

Types

type Client

type Client struct {
	// contains filtered or unexported fields
}

Client Rtsp client

func NewClient

func NewClient(address string, port int) (*Client, error)

NewClient instantiates a new client connecting to the address specified

func (*Client) LocalAddress

func (c *Client) LocalAddress() string

LocalAddress returns the local (our) address

func (*Client) RemoteAddress

func (c *Client) RemoteAddress() string

RemoteAddress returns the remote address

func (*Client) Send

func (c *Client) Send(request *Request) (*Response, error)

Send will send a request to the server

type Decrypter

type Decrypter interface {
	Decode([]byte) ([]byte, error)
}

Decrypter decrypts a received packet

type Method

type Method int
const (
	Describe Method = iota
	Announce
	Get_Parameter
	Options
	Play
	Pause
	Record
	Redirect
	Setup
	Set_Parameter
	Teardown
	Flush
)

func (Method) String

func (i Method) String() string

type PortSet

type PortSet struct {
	Address string
	Control int
	Timing  int
	Data    int
}

PortSet wraps the ports needed for an RTSP stream

type Request

type Request struct {
	Method     Method
	RequestURI string

	Headers map[string]string
	Body    []byte
	// contains filtered or unexported fields
}

Request RTSP request

func NewRequest

func NewRequest() *Request

func (*Request) String

func (r *Request) String() string

type RequestHandler

type RequestHandler func(req *Request, resp *Response, localAddr string, remoteAddr string)

RequestHandler callback function that gets invoked when a request is received

type Response

type Response struct {
	Headers map[string]string
	Body    []byte
	Status  Status
	// contains filtered or unexported fields
}

Response RTSP response

func NewResponse

func NewResponse() *Response

func (*Response) String

func (r *Response) String() string

type Server

type Server struct {
	// contains filtered or unexported fields
}

Server Server for handling Rtsp control requests

func NewServer

func NewServer(port int) *Server

NewServer instantiates a new RtspServer

func (*Server) AddHandler

func (r *Server) AddHandler(m Method, rh RequestHandler)

AddHandler registers a handler for a given RTSP method

func (*Server) Start

func (r *Server) Start(verbose bool)

Start creates listening socket for the RTSP connection

func (*Server) Stop

func (r *Server) Stop()

Stop stops the RTSP server

type Session

type Session struct {
	Description *sdp.SessionDescription

	RemotePorts PortSet
	LocalPorts  PortSet

	DataChan chan []byte
	// contains filtered or unexported fields
}

Session a streaming session

func NewSession

func NewSession(description *sdp.SessionDescription, decrypter Decrypter) *Session

NewSession instantiates a new Session

func (*Session) Close

func (s *Session) Close(closeDone chan struct{})

Close closes a session

func (*Session) DataConn

func (s *Session) DataConn() net.Conn

func (*Session) InitReceive

func (s *Session) InitReceive() error

InitReceive initializes the session to for receiving

func (*Session) StartReceiving

func (s *Session) StartReceiving() error

StartReceiving starts a session for listening for data

func (*Session) StartSending

func (s *Session) StartSending() (err error)

StartSending starts a session for sending data

type Status

type Status int
const (
	Continue                      Status = 100
	Ok                            Status = 200
	Created                       Status = 201
	LowOnStorage                  Status = 250
	MultipleChoices               Status = 300
	MovedPermanently              Status = 301
	MovedTemp                     Status = 301
	SeeOther                      Status = 303
	UseProxy                      Status = 305
	BadRequest                    Status = 400
	Unauthorized                  Status = 401
	PaymentRequired               Status = 402
	Forbidden                     Status = 403
	NotFound                      Status = 404
	MethodNotAllowed              Status = 405
	NotAcceptable                 Status = 406
	ProxyAuthenticationRequired   Status = 407
	RequestTimeout                Status = 408
	Gone                          Status = 410
	LengthRequired                Status = 411
	PreconditionFailed            Status = 412
	RequestEntityTooLarge         Status = 413
	RequestURITooLong             Status = 414
	UnsupportedMediaType          Status = 415
	Invalidparameter              Status = 451
	IllegalConferenceIdentifier   Status = 452
	NotEnoughBandwidth            Status = 453
	SessionNotFound               Status = 454
	MethodNotValidInThisState     Status = 455
	HeaderFieldNotValid           Status = 456
	InvalidRange                  Status = 457
	ParameterIsReadOnly           Status = 458
	AggregateOperationNotAllowed  Status = 459
	OnlyAggregateOperationAllowed Status = 460
	UnsupportedTransport          Status = 461
	DestinationUnreachable        Status = 462
	InternalServerError           Status = 500
	NotImplemented                Status = 501
	BadGateway                    Status = 502
	ServiceUnavailable            Status = 503
	GatewayTimeout                Status = 504
	RTSPVersionNotSupported       Status = 505
	Optionnotsupport              Status = 551
)

func (Status) String

func (i Status) String() string

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL