engine

package module
v1.0.1 Latest Latest
Warning

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

Go to latest
Published: Sep 18, 2021 License: MIT Imports: 14 Imported by: 0

README

m7s核心引擎

该项目为m7s的引擎部分,该部分逻辑是流媒体服务器的核心转发逻辑。仅包含最基础的功能,不含任何网络协议部分,但包含了一个插件的引入机制,其他功能均由插件实现

引擎的基本功能

  • 引擎初始化会加载配置文件,并逐个调用插件的Run函数

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ConfigRaw     []byte
	StartTime     time.Time                        //启动时间
	Plugins       = make(map[string]*PluginConfig) // Plugins 所有的插件配置
	HasTranscoder bool
)
View Source
var BigEndian bigEndian

BigEndian is the big-endian implementation of ByteOrder.

View Source
var LittleEndian littleEndian
View Source
var Version = "1.0.0"

Functions

func AddWriter

func AddWriter(wn io.Writer)

AddWriter 添加日志输出端

func BigLittleSwap added in v1.0.1

func BigLittleSwap(v uint) uint

func CurrentDir

func CurrentDir(path ...string) string

func GetUev added in v1.0.1

func GetUev(buff []byte, start int) (value int, pos int)

哥伦布解码

func InstallPlugin

func InstallPlugin(opt *PluginConfig)

InstallPlugin 安装插件

func MayBeError

func MayBeError(info error) (hasError bool)

MayBeError 优雅错误判断加日志辅助函数

func Print

func Print(v ...interface{})

Print 带颜色识别

func Printf

func Printf(format string, v ...interface{})

Printf calls Output to print to the standard logger. Arguments are handled in the manner of fmt.Printf.

func Println

func Println(v ...interface{})

Println calls Output to print to the standard logger. Arguments are handled in the manner of fmt.Println.

func Run

func Run(ctx context.Context, configFile string) (err error)

Run 启动Monibuca引擎

Types

type MultiLogWriter

type MultiLogWriter struct {
	io.Writer
	// contains filtered or unexported fields
}

MultiLogWriter 多端写日志类

type PluginConfig

type PluginConfig struct {
	Name      string                       //插件名称
	Config    interface{}                  //插件配置
	Version   string                       //插件版本
	Dir       string                       //插件代码路径
	Run       func(ctx context.Context)    //插件启动函数
	HotConfig map[string]func(interface{}) //热修改配置
}

PluginConfig 插件配置定义

Jump to

Keyboard shortcuts

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