defs

package
v1.9.3 Latest Latest
Warning

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

Go to latest
Published: Oct 20, 2024 License: MIT Imports: 15 Imported by: 0

Documentation

Overview

Package defs contains shared definitions.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func FormatsInfo added in v1.5.0

func FormatsInfo(formats []format.Format) string

FormatsInfo returns a description of formats.

func FormatsToCodecs added in v1.5.0

func FormatsToCodecs(formats []format.Format) []string

FormatsToCodecs returns the name of codecs of given formats.

func MediasInfo added in v1.4.0

func MediasInfo(medias []*description.Media) string

MediasInfo returns a description of medias.

func MediasToCodecs added in v1.5.0

func MediasToCodecs(medias []*description.Media) []string

MediasToCodecs returns the name of codecs of given formats.

Types

type APIError

type APIError struct {
	Error string `json:"error"`
}

APIError is a generic error.

type APIHLSMuxer

type APIHLSMuxer struct {
	Path        string    `json:"path"`
	Created     time.Time `json:"created"`
	LastRequest time.Time `json:"lastRequest"`
	BytesSent   uint64    `json:"bytesSent"`
}

APIHLSMuxer is an HLS muxer.

type APIHLSMuxerList

type APIHLSMuxerList struct {
	ItemCount int            `json:"itemCount"`
	PageCount int            `json:"pageCount"`
	Items     []*APIHLSMuxer `json:"items"`
}

APIHLSMuxerList is a list of HLS muxers.

type APIPath

type APIPath struct {
	Name          string                  `json:"name"`
	ConfName      string                  `json:"confName"`
	Source        *APIPathSourceOrReader  `json:"source"`
	Ready         bool                    `json:"ready"`
	ReadyTime     *time.Time              `json:"readyTime"`
	Tracks        []string                `json:"tracks"`
	BytesReceived uint64                  `json:"bytesReceived"`
	BytesSent     uint64                  `json:"bytesSent"`
	Readers       []APIPathSourceOrReader `json:"readers"`
}

APIPath is a path.

type APIPathConfList

type APIPathConfList struct {
	ItemCount int          `json:"itemCount"`
	PageCount int          `json:"pageCount"`
	Items     []*conf.Path `json:"items"`
}

APIPathConfList is a list of path configurations.

type APIPathList

type APIPathList struct {
	ItemCount int        `json:"itemCount"`
	PageCount int        `json:"pageCount"`
	Items     []*APIPath `json:"items"`
}

APIPathList is a list of paths.

type APIPathSourceOrReader

type APIPathSourceOrReader struct {
	Type string `json:"type"`
	ID   string `json:"id"`
}

APIPathSourceOrReader is a source or a reader.

type APIRTMPConn

type APIRTMPConn struct {
	ID            uuid.UUID        `json:"id"`
	Created       time.Time        `json:"created"`
	RemoteAddr    string           `json:"remoteAddr"`
	State         APIRTMPConnState `json:"state"`
	Path          string           `json:"path"`
	Query         string           `json:"query"`
	BytesReceived uint64           `json:"bytesReceived"`
	BytesSent     uint64           `json:"bytesSent"`
}

APIRTMPConn is a RTMP connection.

type APIRTMPConnList

type APIRTMPConnList struct {
	ItemCount int            `json:"itemCount"`
	PageCount int            `json:"pageCount"`
	Items     []*APIRTMPConn `json:"items"`
}

APIRTMPConnList is a list of RTMP connections.

type APIRTMPConnState

type APIRTMPConnState string

APIRTMPConnState is the state of a RTMP connection.

const (
	APIRTMPConnStateIdle    APIRTMPConnState = "idle"
	APIRTMPConnStateRead    APIRTMPConnState = "read"
	APIRTMPConnStatePublish APIRTMPConnState = "publish"
)

states.

type APIRTSPConn

type APIRTSPConn struct {
	ID            uuid.UUID `json:"id"`
	Created       time.Time `json:"created"`
	RemoteAddr    string    `json:"remoteAddr"`
	BytesReceived uint64    `json:"bytesReceived"`
	BytesSent     uint64    `json:"bytesSent"`
}

APIRTSPConn is a RTSP connection.

type APIRTSPConnsList

type APIRTSPConnsList struct {
	ItemCount int            `json:"itemCount"`
	PageCount int            `json:"pageCount"`
	Items     []*APIRTSPConn `json:"items"`
}

APIRTSPConnsList is a list of RTSP connections.

type APIRTSPSession

type APIRTSPSession struct {
	ID            uuid.UUID           `json:"id"`
	Created       time.Time           `json:"created"`
	RemoteAddr    string              `json:"remoteAddr"`
	State         APIRTSPSessionState `json:"state"`
	Path          string              `json:"path"`
	Query         string              `json:"query"`
	Transport     *string             `json:"transport"`
	BytesReceived uint64              `json:"bytesReceived"`
	BytesSent     uint64              `json:"bytesSent"`
}

APIRTSPSession is a RTSP session.

type APIRTSPSessionList

type APIRTSPSessionList struct {
	ItemCount int               `json:"itemCount"`
	PageCount int               `json:"pageCount"`
	Items     []*APIRTSPSession `json:"items"`
}

APIRTSPSessionList is a list of RTSP sessions.

type APIRTSPSessionState

type APIRTSPSessionState string

APIRTSPSessionState is the state of a RTSP session.

const (
	APIRTSPSessionStateIdle    APIRTSPSessionState = "idle"
	APIRTSPSessionStateRead    APIRTSPSessionState = "read"
	APIRTSPSessionStatePublish APIRTSPSessionState = "publish"
)

states.

type APIRecording added in v1.5.1

type APIRecording struct {
	Name     string                 `json:"name"`
	Segments []*APIRecordingSegment `json:"segments"`
}

APIRecording is a recording.

type APIRecordingList added in v1.5.1

type APIRecordingList struct {
	ItemCount int             `json:"itemCount"`
	PageCount int             `json:"pageCount"`
	Items     []*APIRecording `json:"items"`
}

APIRecordingList is a list of recordings.

type APIRecordingSegment added in v1.5.1

type APIRecordingSegment struct {
	Start time.Time `json:"start"`
}

APIRecordingSegment is a recording segment.

type APISRTConn

type APISRTConn struct {
	ID         uuid.UUID       `json:"id"`
	Created    time.Time       `json:"created"`
	RemoteAddr string          `json:"remoteAddr"`
	State      APISRTConnState `json:"state"`
	Path       string          `json:"path"`
	Query      string          `json:"query"`

	// The total number of sent DATA packets, including retransmitted packets
	PacketsSent uint64 `json:"packetsSent"`
	// The total number of received DATA packets, including retransmitted packets
	PacketsReceived uint64 `json:"packetsReceived"`
	// The total number of unique DATA packets sent by the SRT sender
	PacketsSentUnique uint64 `json:"packetsSentUnique"`
	// The total number of unique original, retransmitted or recovered by the packet filter DATA packets
	// received in time, decrypted without errors and, as a result, scheduled for delivery to the
	// upstream application by the SRT receiver.
	PacketsReceivedUnique uint64 `json:"packetsReceivedUnique"`
	// The total number of data packets considered or reported as lost at the sender side.
	// Does not correspond to the packets detected as lost at the receiver side.
	PacketsSendLoss uint64 `json:"packetsSendLoss"`
	// The total number of SRT DATA packets detected as presently missing (either reordered or lost) at the receiver side
	PacketsReceivedLoss uint64 `json:"packetsReceivedLoss"`
	// The total number of retransmitted packets sent by the SRT sender
	PacketsRetrans uint64 `json:"packetsRetrans"`
	// The total number of retransmitted packets registered at the receiver side
	PacketsReceivedRetrans uint64 `json:"packetsReceivedRetrans"`
	// The total number of sent ACK (Acknowledgement) control packets
	PacketsSentACK uint64 `json:"packetsSentACK"`
	// The total number of received ACK (Acknowledgement) control packets
	PacketsReceivedACK uint64 `json:"packetsReceivedACK"`
	// The total number of sent NAK (Negative Acknowledgement) control packets
	PacketsSentNAK uint64 `json:"packetsSentNAK"`
	// The total number of received NAK (Negative Acknowledgement) control packets
	PacketsReceivedNAK uint64 `json:"packetsReceivedNAK"`
	// The total number of sent KM (Key Material) control packets
	PacketsSentKM uint64 `json:"packetsSentKM"`
	// The total number of received KM (Key Material) control packets
	PacketsReceivedKM uint64 `json:"packetsReceivedKM"`
	// The total accumulated time in microseconds, during which the SRT sender has some data to transmit,
	// including packets that have been sent, but not yet acknowledged
	UsSndDuration uint64 `json:"usSndDuration"`
	// ??
	PacketsReceivedBelated uint64 `json:"packetsReceivedBelated"`
	// The total number of dropped by the SRT sender DATA packets that have no chance to be delivered in time
	PacketsSendDrop uint64 `json:"packetsSendDrop"`
	// The total number of dropped by the SRT receiver and, as a result,
	// not delivered to the upstream application DATA packets
	PacketsReceivedDrop uint64 `json:"packetsReceivedDrop"`
	// The total number of packets that failed to be decrypted at the receiver side
	PacketsReceivedUndecrypt uint64 `json:"packetsReceivedUndecrypt"`

	// Same as packetsReceived, but expressed in bytes, including payload and all the headers (IP, TCP, SRT)
	BytesReceived uint64 `json:"bytesReceived"`
	// Same as packetsSent, but expressed in bytes, including payload and all the headers (IP, TCP, SRT)
	BytesSent uint64 `json:"bytesSent"`
	// Same as packetsSentUnique, but expressed in bytes, including payload and all the headers (IP, TCP, SRT)
	BytesSentUnique uint64 `json:"bytesSentUnique"`
	// Same as packetsReceivedUnique, but expressed in bytes, including payload and all the headers (IP, TCP, SRT)
	BytesReceivedUnique uint64 `json:"bytesReceivedUnique"`
	// Same as packetsReceivedLoss, but expressed in bytes, including payload and all the headers (IP, TCP, SRT),
	// bytes for the presently missing (either reordered or lost) packets' payloads are estimated
	// based on the average packet size
	BytesReceivedLoss uint64 `json:"bytesReceivedLoss"`
	// Same as packetsRetrans, but expressed in bytes, including payload and all the headers (IP, TCP, SRT)
	BytesRetrans uint64 `json:"bytesRetrans"`
	// Same as packetsReceivedRetrans, but expressed in bytes, including payload and all the headers (IP, TCP, SRT)
	BytesReceivedRetrans uint64 `json:"bytesReceivedRetrans"`
	// Same as PacketsReceivedBelated, but expressed in bytes, including payload and all the headers (IP, TCP, SRT)
	BytesReceivedBelated uint64 `json:"bytesReceivedBelated"`
	// Same as packetsSendDrop, but expressed in bytes, including payload and all the headers (IP, TCP, SRT)
	BytesSendDrop uint64 `json:"bytesSendDrop"`
	// Same as packetsReceivedDrop, but expressed in bytes, including payload and all the headers (IP, TCP, SRT)
	BytesReceivedDrop uint64 `json:"bytesReceivedDrop"`
	// Same as packetsReceivedUndecrypt, but expressed in bytes, including payload and all the headers (IP, TCP, SRT)
	BytesReceivedUndecrypt uint64 `json:"bytesReceivedUndecrypt"`

	// Current minimum time interval between which consecutive packets are sent, in microseconds
	UsPacketsSendPeriod float64 `json:"usPacketsSendPeriod"`
	// The maximum number of packets that can be "in flight"
	PacketsFlowWindow uint64 `json:"packetsFlowWindow"`
	// The number of packets in flight
	PacketsFlightSize uint64 `json:"packetsFlightSize"`
	// Smoothed round-trip time (SRTT), an exponentially-weighted moving average (EWMA)
	// of an endpoint's RTT samples, in milliseconds
	MsRTT float64 `json:"msRTT"`
	// Current transmission bandwidth, in Mbps
	MbpsSendRate float64 `json:"mbpsSendRate"`
	// Current receiving bandwidth, in Mbps
	MbpsReceiveRate float64 `json:"mbpsReceiveRate"`
	// Estimated capacity of the network link, in Mbps
	MbpsLinkCapacity float64 `json:"mbpsLinkCapacity"`
	// The available space in the sender's buffer, in bytes
	BytesAvailSendBuf uint64 `json:"bytesAvailSendBuf"`
	// The available space in the receiver's buffer, in bytes
	BytesAvailReceiveBuf uint64 `json:"bytesAvailReceiveBuf"`
	// Transmission bandwidth limit, in Mbps
	MbpsMaxBW float64 `json:"mbpsMaxBW"`
	// Maximum Segment Size (MSS), in bytes
	ByteMSS uint64 `json:"byteMSS"`
	// The number of packets in the sender's buffer that are already scheduled
	// for sending or even possibly sent, but not yet acknowledged
	PacketsSendBuf uint64 `json:"packetsSendBuf"`
	// Instantaneous (current) value of packetsSndBuf, but expressed in bytes,
	// including payload and all headers (IP, TCP, SRT)
	BytesSendBuf uint64 `json:"bytesSendBuf"`
	// The timespan (msec) of packets in the sender's buffer (unacknowledged packets)
	MsSendBuf uint64 `json:"msSendBuf"`
	// Timestamp-based Packet Delivery Delay value of the peer
	MsSendTsbPdDelay uint64 `json:"msSendTsbPdDelay"`
	// The number of acknowledged packets in receiver's buffer
	PacketsReceiveBuf uint64 `json:"packetsReceiveBuf"`
	// Instantaneous (current) value of packetsRcvBuf, expressed in bytes, including payload and all headers (IP, TCP, SRT)
	BytesReceiveBuf uint64 `json:"bytesReceiveBuf"`
	// The timespan (msec) of acknowledged packets in the receiver's buffer
	MsReceiveBuf uint64 `json:"msReceiveBuf"`
	// Timestamp-based Packet Delivery Delay value set on the socket via SRTO_RCVLATENCY or SRTO_LATENCY
	MsReceiveTsbPdDelay uint64 `json:"msReceiveTsbPdDelay"`
	// Instant value of the packet reorder tolerance
	PacketsReorderTolerance uint64 `json:"packetsReorderTolerance"`
	// Accumulated difference between the current time and the time-to-play of a packet that is received late
	PacketsReceivedAvgBelatedTime uint64 `json:"packetsReceivedAvgBelatedTime"`
	// Percentage of resent data vs. sent data
	PacketsSendLossRate float64 `json:"packetsSendLossRate"`
	// Percentage of retransmitted data vs. received data
	PacketsReceivedLossRate float64 `json:"packetsReceivedLossRate"`
}

APISRTConn is a SRT connection.

type APISRTConnList

type APISRTConnList struct {
	ItemCount int           `json:"itemCount"`
	PageCount int           `json:"pageCount"`
	Items     []*APISRTConn `json:"items"`
}

APISRTConnList is a list of SRT connections.

type APISRTConnState

type APISRTConnState string

APISRTConnState is the state of a SRT connection.

const (
	APISRTConnStateIdle    APISRTConnState = "idle"
	APISRTConnStateRead    APISRTConnState = "read"
	APISRTConnStatePublish APISRTConnState = "publish"
)

states.

type APIWebRTCSession

type APIWebRTCSession struct {
	ID                        uuid.UUID             `json:"id"`
	Created                   time.Time             `json:"created"`
	RemoteAddr                string                `json:"remoteAddr"`
	PeerConnectionEstablished bool                  `json:"peerConnectionEstablished"`
	LocalCandidate            string                `json:"localCandidate"`
	RemoteCandidate           string                `json:"remoteCandidate"`
	State                     APIWebRTCSessionState `json:"state"`
	Path                      string                `json:"path"`
	Query                     string                `json:"query"`
	BytesReceived             uint64                `json:"bytesReceived"`
	BytesSent                 uint64                `json:"bytesSent"`
}

APIWebRTCSession is a WebRTC session.

type APIWebRTCSessionList

type APIWebRTCSessionList struct {
	ItemCount int                 `json:"itemCount"`
	PageCount int                 `json:"pageCount"`
	Items     []*APIWebRTCSession `json:"items"`
}

APIWebRTCSessionList is a list of WebRTC sessions.

type APIWebRTCSessionState

type APIWebRTCSessionState string

APIWebRTCSessionState is the state of a WebRTC connection.

const (
	APIWebRTCSessionStateRead    APIWebRTCSessionState = "read"
	APIWebRTCSessionStatePublish APIWebRTCSessionState = "publish"
)

states.

type Path added in v1.4.0

type Path interface {
	Name() string
	SafeConf() *conf.Path
	ExternalCmdEnv() externalcmd.Environment
	StartPublisher(req PathStartPublisherReq) (*stream.Stream, error)
	StopPublisher(req PathStopPublisherReq)
	RemovePublisher(req PathRemovePublisherReq)
	RemoveReader(req PathRemoveReaderReq)
}

Path is a path.

type PathAccessRequest added in v1.4.0

type PathAccessRequest struct {
	Name     string
	Query    string
	Publish  bool
	SkipAuth bool

	// only if skipAuth = false
	User  string
	Pass  string
	IP    net.IP
	Proto auth.Protocol
	ID    *uuid.UUID

	// RTSP only
	RTSPRequest *base.Request
	RTSPNonce   string

	// HTTP only
	HTTPRequest *http.Request
}

PathAccessRequest is a path access request.

func (*PathAccessRequest) ToAuthRequest added in v1.6.0

func (r *PathAccessRequest) ToAuthRequest() *auth.Request

ToAuthRequest converts a path access request into an authentication request.

type PathAddPublisherReq added in v1.4.0

type PathAddPublisherReq struct {
	Author        Publisher
	AccessRequest PathAccessRequest
	Res           chan PathAddPublisherRes
}

PathAddPublisherReq contains arguments of AddPublisher().

type PathAddPublisherRes added in v1.4.0

type PathAddPublisherRes struct {
	Path Path
	Err  error
}

PathAddPublisherRes contains the response of AddPublisher().

type PathAddReaderReq added in v1.4.0

type PathAddReaderReq struct {
	Author        Reader
	AccessRequest PathAccessRequest
	Res           chan PathAddReaderRes
}

PathAddReaderReq contains arguments of AddReader().

type PathAddReaderRes added in v1.4.0

type PathAddReaderRes struct {
	Path   Path
	Stream *stream.Stream
	Err    error
}

PathAddReaderRes contains the response of AddReader().

type PathDescribeReq added in v1.4.0

type PathDescribeReq struct {
	AccessRequest PathAccessRequest
	Res           chan PathDescribeRes
}

PathDescribeReq contains arguments of Describe().

type PathDescribeRes added in v1.4.0

type PathDescribeRes struct {
	Path     Path
	Stream   *stream.Stream
	Redirect string
	Err      error
}

PathDescribeRes contains the response of Describe().

type PathFindPathConfReq added in v1.5.0

type PathFindPathConfReq struct {
	AccessRequest PathAccessRequest
	Res           chan PathFindPathConfRes
}

PathFindPathConfReq contains arguments of FindPathConf().

type PathFindPathConfRes added in v1.5.0

type PathFindPathConfRes struct {
	Conf *conf.Path
	Err  error
}

PathFindPathConfRes contains the response of FindPathConf().

type PathNoOnePublishingError added in v1.4.2

type PathNoOnePublishingError struct {
	PathName string
}

PathNoOnePublishingError is returned when no one is publishing.

func (PathNoOnePublishingError) Error added in v1.4.2

func (e PathNoOnePublishingError) Error() string

Error implements the error interface.

type PathRemovePublisherReq added in v1.4.0

type PathRemovePublisherReq struct {
	Author Publisher
	Res    chan struct{}
}

PathRemovePublisherReq contains arguments of RemovePublisher().

type PathRemoveReaderReq added in v1.4.0

type PathRemoveReaderReq struct {
	Author Reader
	Res    chan struct{}
}

PathRemoveReaderReq contains arguments of RemoveReader().

type PathSourceStaticSetNotReadyReq

type PathSourceStaticSetNotReadyReq struct {
	Res chan struct{}
}

PathSourceStaticSetNotReadyReq contains arguments of SetNotReady().

type PathSourceStaticSetReadyReq

type PathSourceStaticSetReadyReq struct {
	Desc               *description.Session
	GenerateRTPPackets bool
	Res                chan PathSourceStaticSetReadyRes
}

PathSourceStaticSetReadyReq contains arguments of SetReady().

type PathSourceStaticSetReadyRes

type PathSourceStaticSetReadyRes struct {
	Stream *stream.Stream
	Err    error
}

PathSourceStaticSetReadyRes contains the response of SetReadu().

type PathStartPublisherReq added in v1.4.0

type PathStartPublisherReq struct {
	Author             Publisher
	Desc               *description.Session
	GenerateRTPPackets bool
	Res                chan PathStartPublisherRes
}

PathStartPublisherReq contains arguments of StartPublisher().

type PathStartPublisherRes added in v1.4.0

type PathStartPublisherRes struct {
	Stream *stream.Stream
	Err    error
}

PathStartPublisherRes contains the response of StartPublisher().

type PathStopPublisherReq added in v1.4.0

type PathStopPublisherReq struct {
	Author Publisher
	Res    chan struct{}
}

PathStopPublisherReq contains arguments of StopPublisher().

type Publisher added in v1.4.0

type Publisher interface {
	Source
	Close()
}

Publisher is an entity that can publish a stream.

type Reader added in v1.4.0

type Reader interface {
	Close()
	APIReaderDescribe() APIPathSourceOrReader
}

Reader is an entity that can read a stream.

type Source added in v1.4.0

type Source interface {
	logger.Writer
	APISourceDescribe() APIPathSourceOrReader
}

Source is an entity that can provide a stream. it can be: - publisher - staticSourceHandler - redirectSource

type StaticSource

type StaticSource interface {
	logger.Writer
	Run(StaticSourceRunParams) error
	APISourceDescribe() APIPathSourceOrReader
}

StaticSource is a static source.

type StaticSourceParent

type StaticSourceParent interface {
	logger.Writer
	SetReady(req PathSourceStaticSetReadyReq) PathSourceStaticSetReadyRes
	SetNotReady(req PathSourceStaticSetNotReadyReq)
}

StaticSourceParent is the parent of a static source.

type StaticSourceRunParams

type StaticSourceRunParams struct {
	Context        context.Context
	ResolvedSource string
	Conf           *conf.Path
	ReloadConf     chan *conf.Path
}

StaticSourceRunParams is the set of params passed to Run().

Jump to

Keyboard shortcuts

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