Documentation ¶
Index ¶
- Constants
- Variables
- func AddWriter(wn io.Writer)
- func InstallPlugin(opt *PluginConfig)
- func MayBeError(info error) (hasError bool)
- func Print(v ...interface{})
- func Printf(format string, v ...interface{})
- func Println(v ...interface{})
- func Run(configFile string) (err error)
- type AuthHook
- type ChangeRoomCmd
- type Collection
- type InputStream
- type ListenerConfig
- type LogWriter
- type MultiLogWriter
- type NetWorkInfo
- type OnDropHook
- type OnPublishHook
- type OnRoomClosedHook
- type OnSubscribeHook
- type OnSummaryHook
- type OnUnSubscribeHook
- type OutputStream
- type PluginConfig
- type Publisher
- type Room
- type RoomInfo
- type ServerSummary
- type SubscribeCmd
- type Subscriber
- type SubscriberInfo
- type UnSubscribeCmd
Constants ¶
View Source
const ( PLUGIN_NONE = 0 //独立插件 PLUGIN_SUBSCRIBER = 1 //订阅者插件 PLUGIN_PUBLISHER = 1 << 1 //发布者插件 PLUGIN_HOOK = 1 << 2 //钩子插件 )
Variables ¶
View Source
var ( // ConfigRaw 配置信息的原始数据 ConfigRaw []byte // Version 引擎版本号 Version string // EngineInfo 引擎信息 EngineInfo = &struct { Version *string StartTime time.Time //启动时间 }{&Version, time.Now()} )
View Source
var (
AllRoom = Collection{}
)
View Source
var AuthHooks = make(AuthHook, 0)
View Source
var OnDropHooks = make(OnDropHook, 0)
View Source
var OnPublishHooks = make(OnPublishHook, 0)
View Source
var OnRoomClosedHooks = make(OnRoomClosedHook, 0)
View Source
var OnSubscribeHooks = make(OnSubscribeHook, 0)
View Source
var OnSummaryHooks = make(OnSummaryHook, 0)
View Source
var OnUnSubscribeHooks = make(OnUnSubscribeHook, 0)
View Source
var Plugins = make(map[string]*PluginConfig)
Plugins 所有的插件配置
View Source
var Summary = ServerSummary{}
Summary 系统摘要数据
Functions ¶
func Printf ¶ added in v1.2.0
func Printf(format string, v ...interface{})
Printf calls Output to print to the standard logger. Arguments are handled in the manner of fmt.Printf.
Types ¶
type Collection ¶
Collection 对sync.Map的包装
type InputStream ¶
type InputStream struct {
*Room
}
InputStream 发布者实体定义
type ListenerConfig ¶
type ListenerConfig struct {
ListenAddr string
}
ListenerConfig 带有监听地址端口的插件配置类型
type MultiLogWriter ¶ added in v1.2.0
type NetWorkInfo ¶
type NetWorkInfo struct { Name string Receive uint64 Sent uint64 ReceiveSpeed uint64 SentSpeed uint64 }
NetWorkInfo 网速信息
type OnDropHook ¶
type OnDropHook []func(s *OutputStream)
func (OnDropHook) AddHook ¶
func (h OnDropHook) AddHook(hook func(s *OutputStream))
func (OnDropHook) Trigger ¶
func (h OnDropHook) Trigger(s *OutputStream)
type OnPublishHook ¶
type OnPublishHook []func(r *Room)
func (OnPublishHook) AddHook ¶
func (h OnPublishHook) AddHook(hook func(r *Room))
func (OnPublishHook) Trigger ¶
func (h OnPublishHook) Trigger(r *Room)
type OnRoomClosedHook ¶ added in v1.1.2
type OnRoomClosedHook []func(*Room)
func (OnRoomClosedHook) AddHook ¶ added in v1.1.2
func (h OnRoomClosedHook) AddHook(hook func(*Room))
func (OnRoomClosedHook) Trigger ¶ added in v1.1.2
func (h OnRoomClosedHook) Trigger(v *Room)
type OnSubscribeHook ¶
type OnSubscribeHook []func(s *OutputStream)
func (OnSubscribeHook) AddHook ¶
func (h OnSubscribeHook) AddHook(hook func(s *OutputStream))
func (OnSubscribeHook) Trigger ¶
func (h OnSubscribeHook) Trigger(s *OutputStream)
type OnSummaryHook ¶
type OnSummaryHook []func(bool)
func (OnSummaryHook) AddHook ¶
func (h OnSummaryHook) AddHook(hook func(bool))
func (OnSummaryHook) Trigger ¶
func (h OnSummaryHook) Trigger(v bool)
type OnUnSubscribeHook ¶ added in v1.1.2
type OnUnSubscribeHook []func(s *OutputStream)
func (OnUnSubscribeHook) AddHook ¶ added in v1.1.2
func (h OnUnSubscribeHook) AddHook(hook func(s *OutputStream))
func (OnUnSubscribeHook) Trigger ¶ added in v1.1.2
func (h OnUnSubscribeHook) Trigger(s *OutputStream)
type OutputStream ¶
type OutputStream struct { context.Context *Room SubscriberInfo SendHandler func(*avformat.SendPacket) error Cancel context.CancelFunc Sign string VTSent bool ATSent bool VSentTime uint32 ASentTime uint32 OffsetTime uint32 // contains filtered or unexported fields }
OutputStream 订阅者实体定义
type PluginConfig ¶
type PluginConfig struct { Name string //插件名称 Type byte //类型 Config interface{} //插件配置 UIDir string //界面目录 // Deprecated: 界面文件,兼容老版本 UI string Version string //插件版本 Dir string //插件代码路径 Run func() //插件启动函数 }
PluginConfig 插件配置定义
type Room ¶
type Room struct { context.Context Publisher RoomInfo Control chan interface{} Cancel context.CancelFunc Subscribers map[string]*OutputStream // 订阅者 VideoTag *avformat.AVPacket // 每个视频包都是这样的结构,区别在于Payload的大小.FMS在发送AVC sequence header,需要加上 VideoTags,这个tag 1个字节(8bits)的数据 AudioTag *avformat.AVPacket // 每个音频包都是这样的结构,区别在于Payload的大小.FMS在发送AAC sequence header,需要加上 AudioTags,这个tag 1个字节(8bits)的数据 FirstScreen []*avformat.AVPacket AudioChan chan *avformat.AVPacket VideoChan chan *avformat.AVPacket UseTimestamp bool //是否采用数据包中的时间戳 }
Room 房间定义
type RoomInfo ¶
type RoomInfo struct { StreamPath string StartTime time.Time SubscriberInfo []*SubscriberInfo Type string VideoInfo struct { PacketCount int CodecID byte SPSInfo avformat.SPSInfo } AudioInfo struct { PacketCount int SoundFormat byte //4bit SoundRate int //2bit SoundSize byte //1bit SoundType byte //1bit } }
RoomInfo 房间可序列化信息,用于控制台显示
type ServerSummary ¶
type ServerSummary 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 Rooms []*RoomInfo Children map[string]*ServerSummary // contains filtered or unexported fields }
ServerSummary 系统摘要定义
func (*ServerSummary) StartSummary ¶
func (s *ServerSummary) StartSummary()
StartSummary 开始定时采集数据,每秒一次
Source Files ¶
Click to show internal directories.
Click to hide internal directories.