Documentation ¶
Index ¶
- Constants
- Variables
- func EmitEvent[T any](event T)
- func InviteTrack(name string, suber ISubscriber)
- func ListenEvent[T any](handler func(event T))
- func Run(ctx context.Context, conf any) (err error)
- func TryInvitePublish(streamPath string)
- type AddTrackEvent
- type AudioDeConf
- type AudioFrame
- type AudioRTP
- type AuthPub
- type AuthSub
- type ClientConfig
- type ClientIO
- type DefaultYaml
- type ErrorEvent
- type Event
- type FLVFrame
- type FirstConfig
- type GlobalConfig
- func (conf *GlobalConfig) API_closeStream(w http.ResponseWriter, r *http.Request)
- func (conf *GlobalConfig) API_getConfig(w http.ResponseWriter, r *http.Request)
- func (conf *GlobalConfig) API_list_pull(w http.ResponseWriter, r *http.Request)
- func (conf *GlobalConfig) API_list_push(w http.ResponseWriter, r *http.Request)
- func (conf *GlobalConfig) API_modifyConfig(w http.ResponseWriter, r *http.Request)
- func (conf *GlobalConfig) API_plugins(rw http.ResponseWriter, r *http.Request)
- func (conf *GlobalConfig) API_replay_mp4(w http.ResponseWriter, r *http.Request)
- func (conf *GlobalConfig) API_replay_rtpdump(w http.ResponseWriter, r *http.Request)
- func (conf *GlobalConfig) API_replay_ts(w http.ResponseWriter, r *http.Request)
- func (conf *GlobalConfig) API_stop_push(w http.ResponseWriter, r *http.Request)
- func (conf *GlobalConfig) API_stop_subscribe(w http.ResponseWriter, r *http.Request)
- func (conf *GlobalConfig) API_stream(rw http.ResponseWriter, r *http.Request)
- func (conf *GlobalConfig) API_summary(rw http.ResponseWriter, r *http.Request)
- func (conf *GlobalConfig) API_sysInfo(rw http.ResponseWriter, r *http.Request)
- func (conf *GlobalConfig) API_updateConfig(w http.ResponseWriter, r *http.Request)
- func (conf *GlobalConfig) ServeHTTP(rw http.ResponseWriter, r *http.Request)
- type HasAnnexB
- type IO
- func (io *IO) GetStream() common.IStream
- func (io *IO) IsClosed() bool
- func (io *IO) IsShutdown() bool
- func (i *IO) OnEvent(event any)
- func (i *IO) SetIO(conn any)
- func (i *IO) SetLogger(logger *log.Logger)
- func (i *IO) SetParentCtx(parent context.Context)
- func (io *IO) Stop(reason ...zapcore.Field)
- type IOConfig
- type IPublisher
- type IPuller
- type IPusher
- type ISubscriber
- type InvitePublish
- type InviteTrackEvent
- type MP4Publisher
- type MemoryTs
- func (ts *MemoryTs) WriteAudioFrame(frame AudioFrame, pes *mpegts.MpegtsPESFrame) (err error)
- func (ts *MemoryTs) WritePESPacket(frame *mpegts.MpegtsPESFrame, packet mpegts.MpegTsPESPacket) (err error)
- func (ts *MemoryTs) WritePMTPacket(audio codec.AudioCodecID, video codec.VideoCodecID)
- func (ts *MemoryTs) WriteTo(w io.Writer) (int64, error)
- func (ts *MemoryTs) WriteVideoFrame(frame VideoFrame, pes *mpegts.MpegtsPESFrame) (err error)
- type NetWorkInfo
- type NoMoreTrack
- type Plugin
- func (opt *Plugin) AssignPubConfig(puber *Publisher)
- func (opt *Plugin) AssignSubConfig(suber *Subscriber)
- func (opt *Plugin) Publish(streamPath string, pub IPublisher) error
- func (opt *Plugin) Pull(streamPath string, url string, puller IPuller, save int) (err error)
- func (opt *Plugin) Push(streamPath string, url string, pusher IPusher, save bool) (err error)
- func (opt *Plugin) Save() error
- func (opt *Plugin) Subscribe(streamPath string, sub ISubscriber) error
- func (opt *Plugin) SubscribeBlock(streamPath string, sub ISubscriber, t byte) (err error)
- func (opt *Plugin) SubscribeExist(streamPath string, sub ISubscriber) error
- func (opt *Plugin) Update(conf *config.Config)
- type Publisher
- func (p *Publisher) CreateAudioTrack(codecID codec.AudioCodecID, stuff ...any) common.AudioTrack
- func (p *Publisher) CreateVideoTrack(codecID codec.VideoCodecID, stuff ...any) common.VideoTrack
- func (p *Publisher) GetAudioTrack() common.AudioTrack
- func (p *Publisher) GetConfig() *config.Publish
- func (p *Publisher) GetPublisher() *Publisher
- func (p *Publisher) GetVideoTrack() common.VideoTrack
- func (p *Publisher) Publish(streamPath string, pub common.IPuber) error
- func (p *Publisher) WriteAVCCAudio(ts uint32, frame *util.BLL, pool util.BytesPool)
- func (p *Publisher) WriteAVCCVideo(ts uint32, frame *util.BLL, pool util.BytesPool)
- type Puller
- type PulseEvent
- type Pusher
- type RTPDumpPublisher
- type SEKick
- type SEclose
- type SEcreate
- type SEpublish
- type SErepublish
- type SEtrackAvaliable
- type SEwaitClose
- type SEwaitPublish
- type StateEvent
- type StopError
- type Stream
- func (s *Stream) AddTrack(t common.Track) (promise *util.Promise[common.Track])
- func (r *Stream) Close()
- func (s *Stream) GetPath() string
- func (s *Stream) GetPublisherConfig() *config.Publish
- func (s *Stream) GetStartTime() time.Time
- func (s *Stream) GetType() string
- func (r *Stream) IsClosed() bool
- func (r *Stream) IsShutdown() bool
- func (s *Stream) Pause()
- func (s *Stream) Receive(event any) bool
- func (s *Stream) RemoveTrack(t common.Track)
- func (s *Stream) Resume()
- func (s *Stream) SSRC() uint32
- func (s *Stream) SetIDR(video common.Track)
- func (s *Stream) Summary() (r StreamSummay)
- type StreamAction
- type StreamEvent
- type StreamState
- type StreamSummay
- type StreamTimeoutConfig
- type SubPulse
- type Subscriber
- func (s *Subscriber) AddTrack(t common.Track) bool
- func (s *Subscriber) CreateTrackReader(t *track.Media) (result *track.AVRingReader)
- func (s *Subscriber) GetSubscriber() *Subscriber
- func (s *Subscriber) IsPlaying() bool
- func (s *Subscriber) OnEvent(event any)
- func (s *Subscriber) PlayBlock(subType byte)
- func (s *Subscriber) PlayFLV()
- func (s *Subscriber) PlayRTP()
- func (s *Subscriber) PlayRaw()
- func (s *Subscriber) SetIO(i any)
- func (s *Subscriber) SubPulse()
- func (s *Subscriber) Subscribe(streamPath string, sub ISubscriber) error
- type Subscribers
- func (s *Subscribers) AbortWait()
- func (s *Subscribers) Add(suber ISubscriber, wait *waitTracks)
- func (s *Subscribers) Broadcast(event any)
- func (s *Subscribers) Delete(suber ISubscriber)
- func (s *Subscribers) Dispose()
- func (s *Subscribers) Find(id string) ISubscriber
- func (s *Subscribers) Init()
- func (s *Subscribers) Len() int
- func (s *Subscribers) MarshalJSON() ([]byte, error)
- func (s *Subscribers) OnPublisherLost(event StateEvent)
- func (s *Subscribers) OnTrack(track common.Track)
- func (s *Subscribers) Pick() ISubscriber
- func (s *Subscribers) RangeAll(f func(sub ISubscriber))
- func (s *Subscribers) SendInviteTrack(stream *Stream)
- type Summary
- type SummaryUtil
- type TSPublisher
- type TSReader
- type TrackPlayer
- type TrackRemoved
- type Tracks
- type Unsubscribe
- type UnsubscribeEvent
- type UpdateConfig
- type VideoDeConf
- type VideoFrame
- type VideoRTP
Constants ¶
View Source
const ( NO_SUCH_CONIFG = "no such config" NO_SUCH_STREAM = "no such stream" )
View Source
const ( SUBTYPE_RAW = iota SUBTYPE_RTP SUBTYPE_FLV )
View Source
const ( SUBSTATE_INIT = iota SUBSTATE_FIRST SUBSTATE_NORMAL )
Variables ¶
View Source
var ( ErrDuplicatePublish = errors.New("Duplicate Publish") ErrBadStreamName = errors.New("StreamPath Illegal") ErrBadTrackName = errors.New("Track Already Exist") ErrTrackMute = errors.New("Track Mute") ErrStreamIsClosed = errors.New("Stream Is Closed") ErrPublisherLost = errors.New("Publisher Lost") ErrAuth = errors.New("Auth Failed") OnAuthSub func(p *util.Promise[ISubscriber]) error OnAuthPub func(p *util.Promise[IPublisher]) error )
View Source
var ( SysInfo struct { StartTime time.Time //启动时间 LocalIP string Version string } ExecPath = os.Args[0] ExecDir = filepath.Dir(ExecPath) // ConfigRaw 配置信息的原始数据 ConfigRaw []byte Plugins = make(map[string]*Plugin) // Plugins 所有的插件配置 EngineConfig = &GlobalConfig{} Engine = InstallPlugin(EngineConfig) SettingDir = filepath.Join(ExecDir, ".m7s") //配置缓存目录,该目录按照插件名称作为文件名存储修改过的配置 MergeConfigs = []string{"Publish", "Subscribe", "HTTP"} //需要合并配置的属性项,插件若没有配置则使用全局配置 EventBus chan any )
View Source
var ActionNames = [...]string{"publish", "track available", "timeout", "publish close", "close", "last leave", "first enter", "no tracks"}
View Source
var ErrNoPullConfig = errors.New("no pull config")
View Source
var ErrNoPushConfig = errors.New("no push config")
View Source
var ErrStreamNotExist = errors.New("stream not exist")
View Source
var Pullers sync.Map
View Source
var Pushers sync.Map
View Source
var StateNames = [...]string{"⌛", "🟡", "🟢", "🟠", "🔴"}
View Source
var StreamFSM = [len(StateNames)]map[StreamAction]StreamState{ { ACTION_PUBLISH: STATE_WAITTRACK, ACTION_TIMEOUT: STATE_CLOSED, ACTION_LASTLEAVE: STATE_CLOSED, ACTION_CLOSE: STATE_CLOSED, }, { ACTION_TRACKAVAILABLE: STATE_PUBLISHING, ACTION_TIMEOUT: STATE_CLOSED, ACTION_LASTLEAVE: STATE_WAITCLOSE, ACTION_CLOSE: STATE_CLOSED, }, { ACTION_TIMEOUT: STATE_WAITPUBLISH, ACTION_LASTLEAVE: STATE_WAITCLOSE, ACTION_CLOSE: STATE_CLOSED, }, { ACTION_TIMEOUT: STATE_CLOSED, ACTION_FIRSTENTER: STATE_PUBLISHING, ACTION_CLOSE: STATE_CLOSED, }, {}, }
View Source
var Streams util.Map[string, *Stream]
Streams 所有的流集合
Functions ¶
func InviteTrack ¶
func InviteTrack(name string, suber ISubscriber)
func ListenEvent ¶
func ListenEvent[T any](handler func(event T))
func TryInvitePublish ¶
func TryInvitePublish(streamPath string)
Types ¶
type AddTrackEvent ¶
type AudioDeConf ¶
type AudioDeConf []byte
AVCC 格式的序列帧
func (AudioDeConf) WithOutRTMP ¶
func (a AudioDeConf) WithOutRTMP() []byte
type AudioFrame ¶
func (AudioFrame) GetADTS ¶
func (a AudioFrame) GetADTS() (r net.Buffers)
func (AudioFrame) WriteRawTo ¶
func (a AudioFrame) WriteRawTo(w io.Writer) (n int64, err error)
type ClientIO ¶
type ClientIO[C ClientConfig] struct { Config *C StreamPath string // 本地流标识 RemoteURL string // 远程服务器地址(用于推拉) ReConnectCount int //重连次数 }
ClientIO 作为Client角色(Puller,Pusher)的公共结构体
type DefaultYaml ¶
type DefaultYaml string
type Event ¶
func CreateEvent ¶
type FirstConfig ¶
type GlobalConfig ¶
func (*GlobalConfig) API_closeStream ¶
func (conf *GlobalConfig) API_closeStream(w http.ResponseWriter, r *http.Request)
func (*GlobalConfig) API_getConfig ¶
func (conf *GlobalConfig) API_getConfig(w http.ResponseWriter, r *http.Request)
API_getConfig 获取指定的配置信息
func (*GlobalConfig) API_list_pull ¶
func (conf *GlobalConfig) API_list_pull(w http.ResponseWriter, r *http.Request)
func (*GlobalConfig) API_list_push ¶
func (conf *GlobalConfig) API_list_push(w http.ResponseWriter, r *http.Request)
func (*GlobalConfig) API_modifyConfig ¶
func (conf *GlobalConfig) API_modifyConfig(w http.ResponseWriter, r *http.Request)
API_modifyConfig 修改并保存配置
func (*GlobalConfig) API_plugins ¶
func (conf *GlobalConfig) API_plugins(rw http.ResponseWriter, r *http.Request)
func (*GlobalConfig) API_replay_mp4 ¶
func (conf *GlobalConfig) API_replay_mp4(w http.ResponseWriter, r *http.Request)
func (*GlobalConfig) API_replay_rtpdump ¶
func (conf *GlobalConfig) API_replay_rtpdump(w http.ResponseWriter, r *http.Request)
func (*GlobalConfig) API_replay_ts ¶
func (conf *GlobalConfig) API_replay_ts(w http.ResponseWriter, r *http.Request)
func (*GlobalConfig) API_stop_push ¶
func (conf *GlobalConfig) API_stop_push(w http.ResponseWriter, r *http.Request)
func (*GlobalConfig) API_stop_subscribe ¶
func (conf *GlobalConfig) API_stop_subscribe(w http.ResponseWriter, r *http.Request)
func (*GlobalConfig) API_stream ¶
func (conf *GlobalConfig) API_stream(rw http.ResponseWriter, r *http.Request)
func (*GlobalConfig) API_summary ¶
func (conf *GlobalConfig) API_summary(rw http.ResponseWriter, r *http.Request)
func (*GlobalConfig) API_sysInfo ¶
func (conf *GlobalConfig) API_sysInfo(rw http.ResponseWriter, r *http.Request)
func (*GlobalConfig) API_updateConfig ¶
func (conf *GlobalConfig) API_updateConfig(w http.ResponseWriter, r *http.Request)
API_updateConfig 热更新配置
func (*GlobalConfig) ServeHTTP ¶
func (conf *GlobalConfig) ServeHTTP(rw http.ResponseWriter, r *http.Request)
type IO ¶
type IO struct { ID string Type string RemoteAddr string context.Context `json:"-" yaml:"-"` //不要直接设置,应当通过SetParentCtx传入父级Context context.CancelCauseFunc `json:"-" yaml:"-"` //流关闭是关闭发布者或者订阅者 *log.Logger `json:"-" yaml:"-"` StartTime time.Time //创建时间 Stream *Stream `json:"-" yaml:"-"` io.Reader `json:"-" yaml:"-"` io.Writer `json:"-" yaml:"-"` io.Closer `json:"-" yaml:"-"` Args url.Values Spesific common.IIO `json:"-" yaml:"-"` }
发布者或者订阅者的共用结构体
func (*IO) IsShutdown ¶
type IPublisher ¶
type IPuller ¶
type IPuller interface { IPublisher Connect() error OnConnected() Disconnect() Pull() error Reconnect() bool // contains filtered or unexported methods }
type IPusher ¶
type IPusher interface { ISubscriber Push() error Connect() error Disconnect() Reconnect() bool // contains filtered or unexported methods }
type ISubscriber ¶
type ISubscriber interface { common.IIO GetSubscriber() *Subscriber IsPlaying() bool PlayRaw() PlayBlock(byte) PlayFLV() Stop(reason ...zapcore.Field) Subscribe(streamPath string, sub ISubscriber) error }
type InviteTrackEvent ¶
type InviteTrackEvent struct { Event[string] ISubscriber }
InviteTrackEvent 邀请推送指定 Track 事件(转码需要)
type MP4Publisher ¶
type MP4Publisher struct { Publisher *mp4.MovDemuxer `json:"-" yaml:"-"` }
func (*MP4Publisher) ReadMP4Data ¶
func (p *MP4Publisher) ReadMP4Data(source io.ReadSeeker) error
Start reading the MP4 file
type MemoryTs ¶
func (*MemoryTs) WriteAudioFrame ¶
func (ts *MemoryTs) WriteAudioFrame(frame AudioFrame, pes *mpegts.MpegtsPESFrame) (err error)
func (*MemoryTs) WritePESPacket ¶
func (ts *MemoryTs) WritePESPacket(frame *mpegts.MpegtsPESFrame, packet mpegts.MpegTsPESPacket) (err error)
func (*MemoryTs) WritePMTPacket ¶
func (ts *MemoryTs) WritePMTPacket(audio codec.AudioCodecID, video codec.VideoCodecID)
func (*MemoryTs) WriteVideoFrame ¶
func (ts *MemoryTs) WriteVideoFrame(frame VideoFrame, pes *mpegts.MpegtsPESFrame) (err error)
type NetWorkInfo ¶
type NetWorkInfo struct { Name string Receive uint64 Sent uint64 ReceiveSpeed uint64 SentSpeed uint64 }
NetWorkInfo 网速信息
type NoMoreTrack ¶
type NoMoreTrack struct{}
type Plugin ¶
type Plugin struct { context.Context `json:"-" yaml:"-"` context.CancelFunc `json:"-" yaml:"-"` Name string //插件名称 Config config.Plugin `json:"-" yaml:"-"` //类型化的插件配置 Version string //插件版本 RawConfig config.Config //最终合并后的配置的map形式方便查询 *log.Logger `json:"-" yaml:"-"` Disabled bool // contains filtered or unexported fields }
Plugin 插件信息
func InstallPlugin ¶
InstallPlugin 安装插件,传入插件配置生成插件信息对象
func (*Plugin) AssignPubConfig ¶
func (*Plugin) AssignSubConfig ¶
func (opt *Plugin) AssignSubConfig(suber *Subscriber)
func (*Plugin) Subscribe ¶
func (opt *Plugin) Subscribe(streamPath string, sub ISubscriber) error
Subscribe 订阅一个流,如果流不存在则创建一个等待流
func (*Plugin) SubscribeBlock ¶
func (opt *Plugin) SubscribeBlock(streamPath string, sub ISubscriber, t byte) (err error)
SubscribeBlock 阻塞订阅一个流,直到订阅结束
func (*Plugin) SubscribeExist ¶
func (opt *Plugin) SubscribeExist(streamPath string, sub ISubscriber) error
SubscribeExist 订阅已经存在的流
type Publisher ¶
type Publisher struct { IO Config *config.Publish common.AudioTrack `json:"-" yaml:"-"` common.VideoTrack `json:"-" yaml:"-"` }
func (*Publisher) CreateAudioTrack ¶
func (p *Publisher) CreateAudioTrack(codecID codec.AudioCodecID, stuff ...any) common.AudioTrack
func (*Publisher) CreateVideoTrack ¶
func (p *Publisher) CreateVideoTrack(codecID codec.VideoCodecID, stuff ...any) common.VideoTrack
func (*Publisher) GetAudioTrack ¶
func (p *Publisher) GetAudioTrack() common.AudioTrack
func (*Publisher) GetPublisher ¶
func (*Publisher) GetVideoTrack ¶
func (p *Publisher) GetVideoTrack() common.VideoTrack
func (*Publisher) WriteAVCCAudio ¶
type RTPDumpPublisher ¶
type RTPDumpPublisher struct { Publisher VCodec codec.VideoCodecID ACodec codec.AudioCodecID VPayloadType uint8 APayloadType uint8 sync.Mutex // contains filtered or unexported fields }
func (*RTPDumpPublisher) Feed ¶
func (t *RTPDumpPublisher) Feed(file *os.File)
func (*RTPDumpPublisher) WriteRTP ¶
func (t *RTPDumpPublisher) WriteRTP(raw []byte)
type SEclose ¶
type SEclose struct {
StateEvent
}
type SEcreate ¶
type SEcreate struct {
StreamEvent
}
type SEpublish ¶
type SEpublish struct {
StateEvent
}
type SErepublish ¶
type SErepublish struct {
StateEvent
}
type SEtrackAvaliable ¶
type SEtrackAvaliable struct {
StateEvent
}
type SEwaitClose ¶
type SEwaitClose struct {
StateEvent
}
type SEwaitPublish ¶
type SEwaitPublish struct { StateEvent Publisher IPublisher }
type StateEvent ¶
type StateEvent struct { StreamEvent Action StreamAction From StreamState }
StateEvent 状态机事件
func (StateEvent) Next ¶
func (se StateEvent) Next() (next StreamState, ok bool)
type Stream ¶
type Stream struct { ID uint32 // 流ID *log.Logger StartTime time.Time //创建时间 StreamTimeoutConfig Path string Publisher IPublisher State StreamState SEHistory []StateEvent // 事件历史 Subscribers Subscribers // 订阅者 Tracks Tracks AppName string StreamName string IsPause bool // 是否处于暂停状态 // contains filtered or unexported fields }
Stream 流定义
func FilterStreams ¶
func FilterStreams[T IPublisher]() (ss []*Stream)
func (*Stream) GetPublisherConfig ¶
func (*Stream) GetStartTime ¶
func (*Stream) IsShutdown ¶
func (*Stream) RemoveTrack ¶
type StreamAction ¶
type StreamAction byte
const ( ACTION_PUBLISH StreamAction = iota ACTION_TRACKAVAILABLE // 音视频轨道激活 ACTION_TIMEOUT // 发布流长时间没有数据/长时间没有发布者发布流/等待关闭时间到 ACTION_PUBLISHCLOSE // 发布者关闭 ACTION_CLOSE // 主动关闭流 ACTION_LASTLEAVE // 最后一个订阅者离开 ACTION_FIRSTENTER // 第一个订阅者进入 ACTION_NOTRACK // 没有音视频轨道 )
func (StreamAction) String ¶
func (s StreamAction) String() string
type StreamEvent ¶
type StreamState ¶
type StreamState byte
const ( STATE_WAITPUBLISH StreamState = iota // 等待发布者状态 STATE_WAITTRACK // 等待音视频轨道激活 STATE_PUBLISHING // 正在发布流状态 STATE_WAITCLOSE // 等待关闭状态(自动关闭延时开启) STATE_CLOSED // 流已关闭,不可使用 )
四状态机
func (StreamState) String ¶
func (s StreamState) String() string
type StreamSummay ¶
type StreamTimeoutConfig ¶
type SubPulse ¶
type SubPulse struct {
ISubscriber
}
type Subscriber ¶
type Subscriber struct { IO Config *config.Subscribe TrackPlayer `json:"-" yaml:"-"` // contains filtered or unexported fields }
Subscriber 订阅者实体定义
func (*Subscriber) CreateTrackReader ¶
func (s *Subscriber) CreateTrackReader(t *track.Media) (result *track.AVRingReader)
func (*Subscriber) GetSubscriber ¶
func (s *Subscriber) GetSubscriber() *Subscriber
func (*Subscriber) IsPlaying ¶
func (s *Subscriber) IsPlaying() bool
func (*Subscriber) OnEvent ¶
func (s *Subscriber) OnEvent(event any)
func (*Subscriber) PlayFLV ¶
func (s *Subscriber) PlayFLV()
func (*Subscriber) PlayRTP ¶
func (s *Subscriber) PlayRTP()
func (*Subscriber) PlayRaw ¶
func (s *Subscriber) PlayRaw()
func (*Subscriber) SetIO ¶
func (s *Subscriber) SetIO(i any)
func (*Subscriber) SubPulse ¶
func (s *Subscriber) SubPulse()
func (*Subscriber) Subscribe ¶
func (s *Subscriber) Subscribe(streamPath string, sub ISubscriber) error
type Subscribers ¶
type Subscribers struct {
// contains filtered or unexported fields
}
func (*Subscribers) AbortWait ¶
func (s *Subscribers) AbortWait()
func (*Subscribers) Add ¶
func (s *Subscribers) Add(suber ISubscriber, wait *waitTracks)
func (*Subscribers) Broadcast ¶
func (s *Subscribers) Broadcast(event any)
func (*Subscribers) Delete ¶
func (s *Subscribers) Delete(suber ISubscriber)
func (*Subscribers) Dispose ¶
func (s *Subscribers) Dispose()
func (*Subscribers) Find ¶
func (s *Subscribers) Find(id string) ISubscriber
func (*Subscribers) Init ¶
func (s *Subscribers) Init()
func (*Subscribers) Len ¶
func (s *Subscribers) Len() int
func (*Subscribers) MarshalJSON ¶
func (s *Subscribers) MarshalJSON() ([]byte, error)
func (*Subscribers) OnPublisherLost ¶
func (s *Subscribers) OnPublisherLost(event StateEvent)
func (*Subscribers) OnTrack ¶
func (s *Subscribers) OnTrack(track common.Track)
func (*Subscribers) Pick ¶
func (s *Subscribers) Pick() ISubscriber
func (*Subscribers) RangeAll ¶
func (s *Subscribers) RangeAll(f func(sub ISubscriber))
func (*Subscribers) SendInviteTrack ¶
func (s *Subscribers) SendInviteTrack(stream *Stream)
SendInviteTrack 广播需要的 Track(转码插件可以用到)
type Summary ¶
type Summary struct { Address string Memory struct { Total uint64 Free uint64 Used uint64 Usage float64 } CPUUsage float64 HardDisk struct { Total uint64 Free uint64 Used uint64 Usage float64 } NetWork []NetWorkInfo Streams []StreamSummay // contains filtered or unexported fields }
ServerSummary 系统摘要定义
type SummaryUtil ¶
type SummaryUtil Summary
func (*SummaryUtil) MarshalJSON ¶
func (s *SummaryUtil) MarshalJSON() ([]byte, error)
func (*SummaryUtil) MarshalYAML ¶
func (s *SummaryUtil) MarshalYAML() (any, error)
type TSPublisher ¶
type TSPublisher struct { Publisher // contains filtered or unexported fields }
func (*TSPublisher) OnEvent ¶
func (t *TSPublisher) OnEvent(event any)
func (*TSPublisher) OnPmtStream ¶
func (t *TSPublisher) OnPmtStream(s mpegts.MpegTsPmtStream)
type TSReader ¶
type TSReader struct { *TSPublisher mpegts.MpegTsStream }
func NewTSReader ¶
func NewTSReader(pub *TSPublisher) (r *TSReader)
type TrackPlayer ¶
type TrackPlayer struct { context.Context context.CancelFunc AudioReader, VideoReader *track.AVRingReader Audio *track.Audio Video *track.Video }
type TrackRemoved ¶
type Tracks ¶
type Tracks struct { sync.Map Video []*track.Video Audio []*track.Audio Data []common.Track MainVideo *track.Video MainAudio *track.Audio // contains filtered or unexported fields }
func (*Tracks) MarshalJSON ¶
type Unsubscribe ¶
type Unsubscribe ISubscriber
type UnsubscribeEvent ¶
type UnsubscribeEvent struct { Event[ISubscriber] }
type UpdateConfig ¶
type VideoDeConf ¶
type VideoDeConf []byte
AVCC 格式的序列帧
func (VideoDeConf) WithOutRTMP ¶
func (v VideoDeConf) WithOutRTMP() []byte
type VideoFrame ¶
func (VideoFrame) GetAnnexB ¶
func (v VideoFrame) GetAnnexB() (r net.Buffers)
func (VideoFrame) WriteAnnexBTo ¶
func (v VideoFrame) WriteAnnexBTo(w io.Writer) (n int64, err error)
Source Files ¶
Click to show internal directories.
Click to hide internal directories.