m3u8

package
v1.19.1 Latest Latest
Warning

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

Go to latest
Published: Mar 15, 2025 License: GPL-3.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ParentHeadComments = map[string]struct{}{
	"#EXTM3U": {}, "#EXT-X-VERSION": {}, "#EXT-X-MEDIA-SEQUENCE": {},
	"#EXT-X-TARGETDURATION": {}, "#EXT-X-MEDIA": {}, "#EXT-X-INDEPENDENT-SEGMENTS": {},
	"#EXT-X-STREAM-INF": {}, "#EXT-X-DISCONTINUITY-SEQUENCE": {},
}

ParentHeadComments 记录文件头注释

View Source
var ParentTailComments = map[string]struct{}{
	"#EXT-X-ENDLIST": {},
}

ParentTailComments 记录文件尾注释

Functions

This section is empty.

Types

type Info

type Info struct {
	HeadComments []string // 头注释
	TailComments []string // 尾注释
	TsInfos      []TsInfo // ts 切片信息
}

Info m3u8 信息

func ReadContent

func ReadContent(urlInfo UrlInfo, content string) (Info, error)

ReadContent 将 m3u8 原始文件整理成 Info 信息

有的 m3u 切片地址是相对路径, 需要手动拼接前缀

func (*Info) Content

func (i *Info) Content() string

Content 返回 m3u 文本

func (*Info) ContentFunc

func (i *Info) ContentFunc(f func(tsIdx int, tsUrl string) string) string

ContentFunc 返回 m3u 文本, 允许修改 ts

type TsInfo

type TsInfo struct {
	ExtInf string
	Url    string
}

TsInfo ts 切片信息

type UrlInfo added in v1.13.2

type UrlInfo struct {
	Host    string // 主机地址
	BaseDir string // url 对应资源所在的目录路径
}

UrlInfo m3u url 地址信息

func ExtractUrl added in v1.13.2

func ExtractUrl(m3uLink string) (info UrlInfo)

ExtractUrl 提取 m3u 地址信息

Jump to

Keyboard shortcuts

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