configs

package
v0.7.18 Latest Latest
Warning

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

Go to latest
Published: Oct 9, 2023 License: GPL-3.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	File                 string               `yaml:"-"`                      // 配置文件路径
	RPC                  RPC                  `yaml:"rpc"`                    // RPC配置
	Debug                bool                 `yaml:"debug"`                  // 是否启用调试模式
	Interval             int                  `yaml:"interval"`               // 采集间隔
	OutPutPath           string               `yaml:"out_put_path"`           // 输出路径
	FfmpegPath           string               `yaml:"ffmpeg_path"`            // FFmpeg路径
	Log                  Log                  `yaml:"log"`                    // 日志配置
	Feature              Feature              `yaml:"feature"`                // 特性配置
	LiveRooms            []LiveRoom           `yaml:"live_rooms"`             // 直播房间配置
	OutputTmpl           string               `yaml:"out_put_tmpl"`           // 输出模板
	VideoSplitStrategies VideoSplitStrategies `yaml:"video_split_strategies"` // 视频分割策略
	Cookies              map[string]string    `yaml:"cookies"`                // Cookies配置
	OnRecordFinished     OnRecordFinished     `yaml:"on_record_finished"`     // 录制完成后的操作配置
	TimeoutInUs          int                  `yaml:"timeout_in_us"`          // 超时时间(微秒)
	// contains filtered or unexported fields
}

Config包含所有配置信息。

func NewConfig

func NewConfig() *Config

NewConfig 创建新的Config对象。

func NewConfigWithBytes

func NewConfigWithBytes(b []byte) (*Config, error)

NewConfigWithBytes 使用字节数组创建Config对象。

func NewConfigWithFile

func NewConfigWithFile(file string) (*Config, error)

NewConfigWithFile 使用文件创建Config对象。

func (Config) GetFilePath

func (c Config) GetFilePath() (string, error)

GetFilePath 获取配置文件路径。

func (*Config) GetLiveRoomByUrl

func (c *Config) GetLiveRoomByUrl(url string) (*LiveRoom, error)

GetLiveRoomByUrl 通过URL获取直播房间。

func (*Config) Marshal

func (c *Config) Marshal() error

Marshal 将配置对象序列化为字节数组并保存到文件。

func (*Config) RefreshLiveRoomIndexCache

func (c *Config) RefreshLiveRoomIndexCache()

RefreshLiveRoomIndexCache 刷新直播房间索引缓存。

func (*Config) RemoveLiveRoomByUrl

func (c *Config) RemoveLiveRoomByUrl(url string) error

RemoveLiveRoomByUrl 通过URL移除直播房间。

func (*Config) UpdateLiveRoomByUrl

func (c *Config) UpdateLiveRoomByUrl(url string, room *LiveRoom) error

UpdateLiveRoomByUrl 通过URL更新直播房间。

func (*Config) Verify

func (c *Config) Verify() error

Verify 验证配置的有效性。

type Feature

type Feature struct {
	UseNativeFlvParser         bool `yaml:"use_native_flv_parser"`         // 是否使用本地FLV解析器
	RemoveSymbolOtherCharacter bool `yaml:"remove_symbol_other_character"` // 是否删除特殊符号
}

Feature包含特性相关信息。

type LiveRoom

type LiveRoom struct {
	Url       string  `yaml:"url"`          // 直播房间URL
	Listen    bool    `yaml:"listen"`       // 监听
	Listening bool    `yaml:"is_listening"` // 监听状态
	Record    bool    `yaml:"record"`       // 录制
	Recordind bool    `yaml:"is_recording"` // 录制状态
	LiveId    live.ID `yaml:"-"`            // 直播ID
	Quality   int     `yaml:"quality"`      // 视频质量
	Rtmp      string  `yaml:"rtmp"`         // 转推地址
	Push      bool    `yaml:"push"`         // 转推
	Pushing   bool    `yaml:"is_pushing"`   // 转推状态
}

LiveRoom包含直播房间信息。

func NewLiveRoomsWithStrings

func NewLiveRoomsWithStrings(strings []string) []LiveRoom

NewLiveRoomsWithStrings 从字符串数组创建LiveRoom列表。

func (*LiveRoom) UnmarshalYAML

func (l *LiveRoom) UnmarshalYAML(unmarshal func(interface{}) error) error

UnmarshalYAML 实现了LiveRoom的自定义反序列化。

type Log

type Log struct {
	OutPutFolder string `yaml:"out_put_folder"` // 输出日志文件夹
	SaveLastLog  bool   `yaml:"save_last_log"`  // 是否保存最后一条日志
	SaveEveryLog bool   `yaml:"save_every_log"` // 是否保存每一条日志
}

Log包含日志相关信息。

type OnRecordFinished

type OnRecordFinished struct {
	ConvertToMp4          bool   `yaml:"convert_to_mp4"`           // 是否转换为MP4格式
	DeleteFlvAfterConvert bool   `yaml:"delete_flv_after_convert"` // 转换后是否删除FLV文件
	CustomCommandline     string `yaml:"custom_commandline"`       // 自定义命令行操作
}

OnRecordFinished包含录制完成后的操作信息。

type RPC

type RPC struct {
	Enable bool   `yaml:"enable"` // 是否启用RPC
	Bind   string `yaml:"bind"`   // 绑定的地址和端口
}

RPC包含RPC相关信息。

type VideoSplitStrategies

type VideoSplitStrategies struct {
	OnRoomNameChanged bool          `yaml:"on_room_name_changed"` // 当房间名称更改时是否分割视频
	MaxDuration       time.Duration `yaml:"max_duration"`         // 最大分割视频时长
	MaxFileSize       int           `yaml:"max_file_size"`        // 最大分割文件大小
}

VideoSplitStrategies包含视频分割策略信息。

Jump to

Keyboard shortcuts

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