rtsp

package
v0.0.0-...-505e429 Latest Latest
Warning

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

Go to latest
Published: Oct 17, 2022 License: MIT Imports: 20 Imported by: 0

Documentation

Index

Constants

View Source
const Version1 = "RTSP/1.0"

Variables

This section is empty.

Functions

func NewResponse

func NewResponse(proto string, cSeq string) *response

Types

type Channel

type Channel interface {
	SetSDP(tx Transaction, sdp *sdp.Message, raw []byte) bool
	SDP() *sdp.Message
	Raw() []byte
	Lock(tx Transaction) bool
	Source() Transaction
	Input() chan *Package
	Play(tx Transaction) error
	Record(tx Transaction) error
	Teardown(tx Transaction) error
}

func NewChannel

func NewChannel(ch string) Channel

type HandlerFunc

type HandlerFunc func(req Request, res Response, tx Transaction) error

type Media

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

type Package

type Package struct {
	Ch          int
	Len         uint32
	Order       int
	Interleaved bool
	Data        []byte
}

type Request

type Request interface {
	Method() methods.Method
	URL() *url.URL
	Path() string
	Stream() string
	Headers() map[string][]string
	Header(key string) ([]string, bool)
	Transport() (header.TransportHeader, bool)
	CSeq() string
	Proto() string
	SessionID() string
	ContentType() string
	Body() []byte
	Encode() []byte
	ParseSDP() (*sdp.Message, error)
	Channel() string
}

type Response

type Response interface {
	SetHeader(key string, value ...string)
	SetBody(body []byte)
	SetStatus(status string)
	SetCode(code uint64)
	Encoding() []byte
}

func ErrInternal

func ErrInternal(res Response) Response

func ErrMethodNotAllowed

func ErrMethodNotAllowed(res Response) Response

func ErrMethodNotValidINThisState

func ErrMethodNotValidINThisState(res Response) Response

func ErrUnsupportedTransport

func ErrUnsupportedTransport(res Response) Response

type Server

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

func NewServer

func NewServer(opts ...ServerOption) *Server

func (*Server) RegisterHandleFunc

func (s *Server) RegisterHandleFunc(method methods.Method, fn HandlerFunc)

func (*Server) RegisterHandler

func (s *Server) RegisterHandler(handler minimalHandler)

func (*Server) Start

func (s *Server) Start(ctx context.Context) error

func (*Server) Stop

func (s *Server) Stop(_ context.Context) error

type ServerOption

type ServerOption func(s *Server)

func Address

func Address(addr string) ServerOption

func Logger

func Logger(logger log.Logger) ServerOption

func Network

func Network(network string) ServerOption

func RTCP

func RTCP(rtcp string) ServerOption

func RTP

func RTP(rtp string) ServerOption

func Timeout

func Timeout(duration time.Duration) ServerOption

func WithChannel

func WithChannel(ch string) ServerOption

type Transaction

type Transaction interface {
	ID() string
	IP() net.IP
	Status() status.Status
	Forward(p *Package, wg *sync.WaitGroup) error
	Response(res Response) error
	Request(req Request) error
	Medias() map[string]*Media
	AddMedia(media *Media)
	PreReady(sdp *sdp.Message) bool
	PreRecord(sdp *sdp.Message) bool
	PrePlay(sdp *sdp.Message) bool
	PreInit()
	Interleaved() bool
	ReadInterleavedFrame(frame []byte) (int, uint32, error)
	WriteInterleavedFrame(channel int, frame []byte) error
	Read(buf []byte) (int, error)
	RTCP() int
	RTP() int
	Close() error
}

type TransactionController

type TransactionController interface {
	CreateTx(trans *transport, rf *rtcpFamily) *transaction
	DeleteTx(id *transaction)
	GetCh(ch string) (Channel, bool)
	GetOrCreateCh(ch string) Channel
	Forward(p *Package, addr *net.UDPAddr)
}

type Transport

type Transport interface {
	Addr() string
	IP() net.IP
	Parse() (*request, error)
	Write(data []byte) error
	Read(buf []byte) (int, error)
	Conn() net.Conn
	Close() error
}

type UnimplementedServerHandler

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

func (*UnimplementedServerHandler) ANNOUNCE

func (u *UnimplementedServerHandler) ANNOUNCE(req Request, res Response, tx Transaction) error

func (*UnimplementedServerHandler) DESCRIBE

func (u *UnimplementedServerHandler) DESCRIBE(req Request, res Response, tx Transaction) error

func (*UnimplementedServerHandler) OPTIONS

func (u *UnimplementedServerHandler) OPTIONS(req Request, res Response, tx Transaction) error

func (*UnimplementedServerHandler) PLAY

func (*UnimplementedServerHandler) RECORD

func (*UnimplementedServerHandler) SETUP

func (*UnimplementedServerHandler) TEARDOWN

func (u *UnimplementedServerHandler) TEARDOWN(req Request, res Response, tx Transaction) error

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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