Documentation
¶
Index ¶
- Constants
- Variables
- func Assert(ok bool)
- func Between(s, sub1, sub2 string) string
- func Caller() string
- func DecodeH264(fmtp string) string
- func GetKind(name string) string
- func MarshalSDP(name string, medias []*Media) ([]byte, error)
- func RandString(size, base byte) string
- type Codec
- type Consumer
- type EventFunc
- type HandlerFunc
- type Info
- type Listener
- type Media
- func (m *Media) Clone() *Media
- func (m *Media) Equal(media *Media) bool
- func (m *Media) MarshalJSON() ([]byte, error)
- func (m *Media) MatchAll() bool
- func (m *Media) MatchCodec(remote *Codec) *Codec
- func (m *Media) MatchMedia(remote *Media) (codec, remoteCodec *Codec)
- func (m *Media) String() string
- type Mode
- type Probe
- type Producer
- type Receiver
- type Sender
- type Waiter
- type Worker
Constants ¶
View Source
const ( DirectionRecvonly = "recvonly" DirectionSendonly = "sendonly" DirectionSendRecv = "sendrecv" )
View Source
const ( KindVideo = "video" KindAudio = "audio" )
View Source
const ( CodecH264 = "H264" // payloadType: 96 CodecH265 = "H265" CodecVP8 = "VP8" CodecVP9 = "VP9" CodecAV1 = "AV1" CodecJPEG = "JPEG" // payloadType: 26 CodecPCMU = "PCMU" // payloadType: 0 CodecPCMA = "PCMA" // payloadType: 8 CodecAAC = "MPEG4-GENERIC" CodecOpus = "OPUS" // payloadType: 111 CodecG722 = "G722" CodecMP3 = "MPA" // payload: 14, aka MPEG-1 Layer III CodecPCM = "L16" // Linear PCM CodecELD = "ELD" // AAC-ELD CodecFLAC = "FLAC" CodecAll = "ALL" CodecAny = "ANY" )
View Source
const ( UnsupportedCodec = "unsupported codec" WrongMediaDirection = "wrong media direction" )
View Source
const PayloadTypeRAW byte = 255
Variables ¶
View Source
var ErrCantGetTrack = errors.New("can't get track")
Functions ¶
func DecodeH264 ¶
func RandString ¶
RandString base10 - numbers, base16 - hex, base36 - digits+letters, base64 - URL safe symbols
Types ¶
type Codec ¶
type Codec struct {
Name string // H264, PCMU, PCMA, opus...
ClockRate uint32 // 90000, 8000, 16000...
Channels uint16 // 0, 1, 2
FmtpLine string
PayloadType uint8
}
func UnmarshalCodec ¶
func UnmarshalCodec(md *sdp.MediaDescription, payloadType string) *Codec
type Info ¶
type Info struct {
Type string `json:"type,omitempty"`
URL string `json:"url,omitempty"`
RemoteAddr string `json:"remote_addr,omitempty"`
UserAgent string `json:"user_agent,omitempty"`
Medias []*Media `json:"medias,omitempty"`
Receivers []*Receiver `json:"receivers,omitempty"`
Senders []*Sender `json:"senders,omitempty"`
Recv int `json:"recv,omitempty"`
Send int `json:"send,omitempty"`
}
type Listener ¶
type Listener struct {
// contains filtered or unexported fields
}
Listener base struct for all classes with support feedback
type Media ¶
type Media struct {
Kind string `json:"kind,omitempty"` // video or audio
Direction string `json:"direction,omitempty"` // sendonly, recvonly
Codecs []*Codec `json:"codecs,omitempty"`
ID string `json:"id,omitempty"` // MID for WebRTC, Control for RTSP
}
Media take best from: - deepch/vdk/format/rtsp/sdp.Media - pion/sdp.MediaDescription
func ParseQuery ¶
func UnmarshalMedia ¶
func UnmarshalMedia(md *sdp.MediaDescription) *Media
func (*Media) MarshalJSON ¶
func (*Media) MatchCodec ¶
func (*Media) MatchMedia ¶
type Probe ¶
type Probe struct {
// contains filtered or unexported fields
}
type Producer ¶
type Producer interface {
// GetMedias - return Media(s) with local Media.Direction:
// - recvonly for Producer Video/Audio
// - sendonly for Producer backchannel
GetMedias() []*Media
// GetTrack - return Receiver, that can only produce rtp.Packet(s)
GetTrack(media *Media, codec *Codec) (*Receiver, error)
Start() error
Stop() error
}
type Receiver ¶
type Receiver struct {
Codec *Codec
Media *Media
ID byte // Channel for RTSP, PayloadType for MPEG-TS
// contains filtered or unexported fields
}
func NewReceiver ¶
func (*Receiver) MarshalJSON ¶
type Sender ¶
type Sender struct {
Codec *Codec
Media *Media
Handler HandlerFunc
// contains filtered or unexported fields
}
func (*Sender) MarshalJSON ¶
Click to show internal directories.
Click to hide internal directories.