base

package
v0.0.0-...-d2f83e5 Latest Latest
Warning

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

Go to latest
Published: Sep 7, 2021 License: MIT Imports: 10 Imported by: 0

Documentation

Overview

Package base contains the base elements of the RTSP protocol.

Index

Constants

This section is empty.

Variables

View Source
var StatusMessages = statusMessages

StatusMessages contains the status messages associated with each status code.

Functions

func PathSplitQuery

func PathSplitQuery(pathAndQuery string) (string, string)

PathSplitQuery splits a path from a query.

func ReadInterleavedFrameOrRequest

func ReadInterleavedFrameOrRequest(frame *InterleavedFrame, req *Request, br *bufio.Reader) (interface{}, error)

ReadInterleavedFrameOrRequest reads an InterleavedFrame or a Response.

func ReadInterleavedFrameOrResponse

func ReadInterleavedFrameOrResponse(frame *InterleavedFrame, res *Response, br *bufio.Reader) (interface{}, error)

ReadInterleavedFrameOrResponse reads an InterleavedFrame or a Response.

Types

type Header map[string]HeaderValue

Header is a RTSP reader, present in both Requests and Responses.

type HeaderValue

type HeaderValue []string

HeaderValue is an header value.

type InterleavedFrame

type InterleavedFrame struct {
	// channel id
	Channel int

	// frame payload
	Payload []byte
}

InterleavedFrame is an interleaved frame, and allows to transfer binary data within RTSP/TCP connections. It is used to send and receive RTP and RTCP packets with TCP.

func (*InterleavedFrame) Read

func (f *InterleavedFrame) Read(br *bufio.Reader) error

Read reads an interleaved frame.

func (InterleavedFrame) Write

func (f InterleavedFrame) Write(bw *bufio.Writer) error

Write writes an InterleavedFrame into a buffered writer.

type Method

type Method string

Method is the method of a RTSP request.

const (
	Announce     Method = "ANNOUNCE"
	Describe     Method = "DESCRIBE"
	GetParameter Method = "GET_PARAMETER"
	Options      Method = "OPTIONS"
	Pause        Method = "PAUSE"
	Play         Method = "PLAY"
	Record       Method = "RECORD"
	Setup        Method = "SETUP"
	SetParameter Method = "SET_PARAMETER"
	Teardown     Method = "TEARDOWN"
)

standard methods

type Request

type Request struct {
	// request method
	Method Method

	// request url
	URL *URL

	// map of header values
	Header Header

	// optional body
	Body []byte
}

Request is a RTSP request.

func (*Request) Read

func (req *Request) Read(rb *bufio.Reader) error

Read reads a request.

func (*Request) ReadIgnoreFrames

func (req *Request) ReadIgnoreFrames(rb *bufio.Reader, buf []byte) error

ReadIgnoreFrames reads a request and ignores any interleaved frame sent before the request.

func (Request) String

func (req Request) String() string

String implements fmt.Stringer.

func (Request) Write

func (req Request) Write(bw *bufio.Writer) error

Write writes a request.

type Response

type Response struct {
	// numeric status code
	StatusCode StatusCode

	// status message
	StatusMessage string

	// map of header values
	Header Header

	// optional body
	Body []byte
}

Response is a RTSP response.

func (*Response) Read

func (res *Response) Read(rb *bufio.Reader) error

Read reads a response.

func (*Response) ReadIgnoreFrames

func (res *Response) ReadIgnoreFrames(rb *bufio.Reader, buf []byte) error

ReadIgnoreFrames reads a response and ignores any interleaved frame sent before the response.

func (Response) String

func (res Response) String() string

String implements fmt.Stringer.

func (Response) Write

func (res Response) Write(bw *bufio.Writer) error

Write writes a Response.

type StatusCode

type StatusCode int

StatusCode is the status code of a RTSP response.

const (
	StatusContinue                           StatusCode = 100
	StatusOK                                 StatusCode = 200
	StatusMovedPermanently                   StatusCode = 301
	StatusFound                              StatusCode = 302
	StatusSeeOther                           StatusCode = 303
	StatusNotModified                        StatusCode = 304
	StatusUseProxy                           StatusCode = 305
	StatusBadRequest                         StatusCode = 400
	StatusUnauthorized                       StatusCode = 401
	StatusPaymentRequired                    StatusCode = 402
	StatusForbidden                          StatusCode = 403
	StatusNotFound                           StatusCode = 404
	StatusMethodNotAllowed                   StatusCode = 405
	StatusNotAcceptable                      StatusCode = 406
	StatusProxyAuthRequired                  StatusCode = 407
	StatusRequestTimeout                     StatusCode = 408
	StatusGone                               StatusCode = 410
	StatusPreconditionFailed                 StatusCode = 412
	StatusRequestEntityTooLarge              StatusCode = 413
	StatusRequestURITooLong                  StatusCode = 414
	StatusUnsupportedMediaType               StatusCode = 415
	StatusParameterNotUnderstood             StatusCode = 451
	StatusNotEnoughBandwidth                 StatusCode = 453
	StatusSessionNotFound                    StatusCode = 454
	StatusMethodNotValidInThisState          StatusCode = 455
	StatusHeaderFieldNotValidForResource     StatusCode = 456
	StatusInvalidRange                       StatusCode = 457
	StatusParameterIsReadOnly                StatusCode = 458
	StatusAggregateOperationNotAllowed       StatusCode = 459
	StatusOnlyAggregateOperationAllowed      StatusCode = 460
	StatusUnsupportedTransport               StatusCode = 461
	StatusDestinationUnreachable             StatusCode = 462
	StatusDestinationProhibited              StatusCode = 463
	StatusDataTransportNotReadyYet           StatusCode = 464
	StatusNotificationReasonUnknown          StatusCode = 465
	StatusKeyManagementError                 StatusCode = 466
	StatusConnectionAuthorizationRequired    StatusCode = 470
	StatusConnectionCredentialsNotAccepted   StatusCode = 471
	StatusFailureToEstablishSecureConnection StatusCode = 472
	StatusInternalServerError                StatusCode = 500
	StatusNotImplemented                     StatusCode = 501
	StatusBadGateway                         StatusCode = 502
	StatusServiceUnavailable                 StatusCode = 503
	StatusGatewayTimeout                     StatusCode = 504
	StatusRTSPVersionNotSupported            StatusCode = 505
	StatusOptionNotSupported                 StatusCode = 551
	StatusProxyUnavailable                   StatusCode = 553
)

standard status codes

type StreamDelivery

type StreamDelivery int

StreamDelivery is the delivery method of a stream.

const (
	// StreamDeliveryUnicast means that the stream is unicasted
	StreamDeliveryUnicast StreamDelivery = iota

	// StreamDeliveryMulticast means that the stream is multicasted
	StreamDeliveryMulticast
)

func (StreamDelivery) String

func (sc StreamDelivery) String() string

String implements fmt.Stringer.

type StreamProtocol

type StreamProtocol int

StreamProtocol is the protocol of a stream.

const (
	// StreamProtocolUDP means that the stream uses the UDP protocol
	StreamProtocolUDP StreamProtocol = iota

	// StreamProtocolTCP means that the stream uses the TCP protocol
	StreamProtocolTCP
)

func (StreamProtocol) String

func (sp StreamProtocol) String() string

String implements fmt.Stringer.

type StreamType

type StreamType int

StreamType is the stream type.

const (
	// StreamTypeRTP means that the stream contains RTP packets
	StreamTypeRTP StreamType = iota

	// StreamTypeRTCP means that the stream contains RTCP packets
	StreamTypeRTCP
)

func (StreamType) String

func (st StreamType) String() string

String implements fmt.Stringer

type URL

type URL url.URL

URL is a RTSP URL. This is basically an HTTP URL with some additional functions to handle control attributes.

func ParseURL

func ParseURL(s string) (*URL, error)

ParseURL parses a RTSP URL.

func (*URL) Clone

func (u *URL) Clone() *URL

Clone clones a URL.

func (*URL) CloneWithoutCredentials

func (u *URL) CloneWithoutCredentials() *URL

CloneWithoutCredentials clones a URL without its credentials.

func (*URL) RTSPPath

func (u *URL) RTSPPath() (string, bool)

RTSPPath returns the path of a RTSP URL.

func (*URL) RTSPPathAndQuery

func (u *URL) RTSPPathAndQuery() (string, bool)

RTSPPathAndQuery returns the path and query of a RTSP URL.

func (*URL) String

func (u *URL) String() string

String implements fmt.Stringer.

Jump to

Keyboard shortcuts

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