mformat

package
v1.25.5 Latest Latest
Warning

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

Go to latest
Published: Oct 21, 2024 License: MIT Imports: 13 Imported by: 0

Documentation

Index

Constants

View Source
const (
	EncryptMethod_NONE       = `NONE`
	EncryptMethod_AES128     = `AES-128`
	EncryptMethod_SIMPLE_AES = `SAMPLE-AES` // TODO
)

https://datatracker.ietf.org/doc/html/rfc8216#section-4.3.2.4

Variables

This section is empty.

Functions

func AesDecrypt

func AesDecrypt(encrypted []byte, key TsKeyInfo) ([]byte, error)

AesDecrypt 解密加密后的ts文件

Types

type M3U8File

type M3U8File struct {
	Version        int
	MediaSequence  int
	TargetDuration float64 // 秒
	PartList       []M3U8Part
}

func M3U8Parse

func M3U8Parse(content []byte) (info M3U8File, ok bool)

func (*M3U8File) ContainsMediaSegment

func (this *M3U8File) ContainsMediaSegment() bool

func (*M3U8File) GetTsList

func (this *M3U8File) GetTsList() (list []TsInfo)

GetTsList 获取ts文件列表, 此处不组装url, 不下载key内容

func (*M3U8File) IsNestedPlaylists

func (this *M3U8File) IsNestedPlaylists() bool

IsNestedPlaylists 返回是否为 嵌套播放列表

func (*M3U8File) LookupHDPlaylist

func (this *M3U8File) LookupHDPlaylist() (playlist *M3U8Playlist)

LookupHDPlaylist 找个最高清的播放列表

type M3U8Key

type M3U8Key struct {
	Method string
	URI    string
	IV     string
}

type M3U8Part

type M3U8Part struct {
	Key                    *M3U8Key
	Segment                *M3U8Segment
	Playlist               *M3U8Playlist
	Is_EXT_X_DISCONTINUITY bool //#EXT-X-DISCONTINUITY
	Is_EXT_X_ENDLIST       bool //#EXT-X-ENDLIST
}

type M3U8Playlist

type M3U8Playlist struct {
	URI        string
	Bandwidth  int
	Resolution M3U8Resolution
}

type M3U8Resolution

type M3U8Resolution struct {
	Width  int
	Height int
}

type M3U8Segment

type M3U8Segment struct {
	URI      string
	Duration float64 // 秒
	Title    string
}

type TsInfo

type TsInfo struct {
	Idx                     uint32 // 从1开始, 每个ts增加1
	Name                    string
	Url                     string // 后续填充
	URI                     string
	Seq                     uint64  // 如果是aes加密并且没有iv, 这个seq需要充当iv
	TimeSec                 float64 // 此ts片段占用多少秒
	Idx_EXT_X_DISCONTINUITY int     // 分段编号
	Key                     TsKeyInfo

	SkipByHttpCode bool
	HttpCode       int
}

TsInfo 用于保存 ts 文件的下载地址和文件名

type TsKeyInfo

type TsKeyInfo struct {
	Method     string
	KeyContent []byte // 后续填充
	KeyURI     string
	Iv         []byte
}

Jump to

Keyboard shortcuts

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