hls

package
v1.0.4 Latest Latest
Warning

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

Go to latest
Published: Jan 27, 2025 License: MIT Imports: 13 Imported by: 0

Documentation

Index

Constants

View Source
const (
	HookEventQueueLen  = 10000
	HookEventWorkerNum = 20
)
View Source
const (
	TSCacheNumMin = 3
)

Variables

View Source
var (
	ErrNoTsKey   = fmt.Errorf("no ts key for cache")
	ErrM3u8Empty = fmt.Errorf("m3u8 is empty")
)

Functions

func InitHook

func InitHook(c context.Context)

func OnHookEvent

func OnHookEvent(e *HookEvent)

Types

type HlsHookData

type HlsHookData struct {
	Action   string  `json:"action"`
	Ip       string  `json:"ip"`
	Vhost    string  `json:"vhost"`
	App      string  `json:"app"`
	Param    string  `json:"param"`
	Duration float32 `json:"duration"`
	File     string  `json:"file"`
	Url      string  `json:"url"`
	M3u8     string  `json:"m3u8"`
	M3u8Url  string  `json:"m3u8_url"`
	SeqNo    int     `json:"seq_no"`
}

type HookEvent

type HookEvent struct {
	Url  string
	Data interface{}
}

type TSCache

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

func NewTSCache

func NewTSCache(id, path string, hlsWindow int) *TSCache

func (*TSCache) DumpM3U8PlayList

func (c *TSCache) DumpM3U8PlayList()

func (*TSCache) DumpTsFile

func (c *TSCache) DumpTsFile(key string, item TSItem)

func (*TSCache) GetItem

func (c *TSCache) GetItem(key string) (TSItem, error)

func (*TSCache) GetM3U8PlayList

func (c *TSCache) GetM3U8PlayList() ([]byte, error)

func (*TSCache) ID

func (c *TSCache) ID() string

func (*TSCache) IsReady

func (c *TSCache) IsReady() bool

func (*TSCache) IsRecord

func (c *TSCache) IsRecord() bool

func (*TSCache) Reset

func (c *TSCache) Reset()

func (*TSCache) SetItem

func (c *TSCache) SetItem(key string, item TSItem)

type TSInfo

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

func NewTSInfo

func NewTSInfo() *TSInfo

func (*TSInfo) DurationMs

func (t *TSInfo) DurationMs() int32

func (*TSInfo) HasKeyFrame

func (t *TSInfo) HasKeyFrame() bool

func (*TSInfo) HasVideo

func (t *TSInfo) HasVideo() bool

func (*TSInfo) IsEmpty

func (t *TSInfo) IsEmpty() bool

func (*TSInfo) Reset

func (t *TSInfo) Reset()

func (*TSInfo) Update

func (t *TSInfo) Update(isVideo bool, isKeyFrame bool, timestamp int32)

type TSItem

type TSItem struct {
	Name     string
	SeqNum   int
	Duration int
	Data     []byte
}

func NewTSItem

func NewTSItem(name string, duration, seqNum int, b []byte) TSItem

Jump to

Keyboard shortcuts

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