streamer

package
v1.2.0 Latest Latest
Warning

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

Go to latest
Published: Feb 17, 2023 License: MIT Imports: 9 Imported by: 0

Documentation

Index

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

	CodecELD = "ELD" // AAC-ELD

	CodecAll = "ALL"
	CodecAny = "ANY"
)
View Source
const PayloadTypeRAW byte = 255

Variables

This section is empty.

Functions

func Between

func Between(s, sub1, sub2 string) string

func Contains

func Contains(medias []*Media, media *Media, codec *Codec) bool

func GetKind

func GetKind(name string) string

func MarshalSDP

func MarshalSDP(name string, medias []*Media) ([]byte, error)

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
}

Codec take best from: - deepch/vdk/av.CodecData - pion/webrtc.RTPCodecCapability

func UnmarshalCodec

func UnmarshalCodec(md *sdp.MediaDescription, payloadType string) *Codec

func (*Codec) Clone

func (c *Codec) Clone() *Codec

func (*Codec) IsRTP

func (c *Codec) IsRTP() bool

func (*Codec) Match

func (c *Codec) Match(codec *Codec) bool

func (*Codec) String

func (c *Codec) String() string

type Consumer

type Consumer interface {
	Listen(f EventFunc)
	GetMedias() []*Media
	AddTrack(media *Media, track *Track) *Track
}

type Element

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

Element base struct for all classes with support feedback

func (*Element) Fire

func (e *Element) Fire(msg interface{})

func (*Element) Listen

func (e *Element) Listen(f EventFunc)

func (*Element) Push

func (e *Element) Push(msg interface{})

type EventFunc

type EventFunc func(msg interface{})

type EventType

type EventType byte
const (
	StateNull EventType = iota
	StateReady
	StatePaused
	StatePlaying
)

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"`
	Tracks     []*Track `json:"tracks,omitempty"`
	Recv       uint32   `json:"recv,omitempty"`
	Send       uint32   `json:"send,omitempty"`
}

type Media

type Media struct {
	Kind      string   `json:"kind,omitempty"` // video or audio
	Direction string   `json:"direction,omitempty"`
	Codecs    []*Codec `json:"codecs,omitempty"`

	MID     string `json:"mid,omitempty"`     // TODO: fixme?
	Control string `json:"control,omitempty"` // TODO: fixme?
}

Media take best from: - deepch/vdk/format/rtsp/sdp.Media - pion/sdp.MediaDescription

func ParseQuery added in v1.1.0

func ParseQuery(query map[string][]string) (medias []*Media)

func UnmarshalMedia

func UnmarshalMedia(md *sdp.MediaDescription) *Media

func UnmarshalMedias added in v1.1.2

func UnmarshalMedias(descriptions []*sdp.MediaDescription) (medias []*Media)

func (*Media) AV

func (m *Media) AV() bool

func (*Media) Clone

func (m *Media) Clone() *Media

func (*Media) MarshalJSON

func (m *Media) MarshalJSON() ([]byte, error)

func (*Media) MatchAll added in v1.1.0

func (m *Media) MatchAll() bool

func (*Media) MatchCodec

func (m *Media) MatchCodec(codec *Codec) *Codec

func (*Media) MatchMedia

func (m *Media) MatchMedia(media *Media) *Codec

func (*Media) String

func (m *Media) String() string

type Probe added in v1.2.0

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

func NewProbe added in v1.2.0

func NewProbe(enable bool) *Probe

func (*Probe) Active added in v1.2.0

func (p *Probe) Active() bool

Active return true if probe enabled and not finish

func (*Probe) Append added in v1.2.0

func (p *Probe) Append(v interface{})

Append safe to run if Probe is nil

type Producer

type Producer interface {
	Listen(f EventFunc)
	GetMedias() []*Media
	GetTrack(media *Media, codec *Codec) *Track
	Start() error
	Stop() error
}

type Track

type Track struct {
	Codec     *Codec
	Direction string
	// contains filtered or unexported fields
}

func NewTrack

func NewTrack(codec *Codec, direction string) *Track

func NewTrack2 added in v1.2.0

func NewTrack2(media *Media, codec *Codec) *Track

func (*Track) Bind

func (t *Track) Bind(w WriterFunc) *Track

func (*Track) GetSink

func (t *Track) GetSink(from *Track)

func (*Track) HasSink

func (t *Track) HasSink() bool

func (*Track) MarshalJSON

func (t *Track) MarshalJSON() ([]byte, error)

func (*Track) String

func (t *Track) String() string

func (*Track) Unbind

func (t *Track) Unbind()

func (*Track) WriteRTP

func (t *Track) WriteRTP(p *rtp.Packet) error

type WrapperFunc

type WrapperFunc func(push WriterFunc) WriterFunc

type WriterFunc

type WriterFunc func(packet *rtp.Packet) error

Jump to

Keyboard shortcuts

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