parse

package
v1.0.15 Latest Latest
Warning

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

Go to latest
Published: Nov 11, 2023 License: MIT Imports: 12 Imported by: 0

Documentation

Overview

Package parse

Index

Constants

View Source
const (
	PlaylistTypeVOD   PlaylistType = "VOD"
	PlaylistTypeEvent PlaylistType = "EVENT"

	CryptMethodAES  CryptMethod = "AES-128"
	CryptMethodNONE CryptMethod = "NONE"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type CryptMethod

type CryptMethod string

type KeyInfo

type KeyInfo struct {
	// 'AES-128' or 'NONE'
	// If the encryption method is NONE, the URI and the IV attributes MUST NOT be present
	Method              CryptMethod
	URI                 string
	Key                 string
	IV                  string
	AliyunVoDEncryption bool
}

KeyInfo #EXT-X-KEY:METHOD=AES-128,URI="key.key"

type LoadKeyFunc added in v1.0.7

type LoadKeyFunc func(m3u8Url, keyUrl string) (string, error)

type M3u8

type M3u8 struct {
	Version        int8   // EXT-X-VERSION:version
	MediaSequence  uint64 // Default 0, #EXT-X-MEDIA-SEQUENCE:sequence
	Segments       []*Segment
	MasterPlaylist []*MasterPlaylist
	Keys           map[int]*KeyInfo
	EndList        bool         // #EXT-X-ENDLIST
	PlaylistType   PlaylistType // VOD or EVENT
	TargetDuration float64      // #EXT-X-TARGETDURATION:duration
}

type MasterPlaylist

type MasterPlaylist struct {
	URI        string
	BandWidth  uint32
	Resolution string
	Codecs     string
	ProgramID  uint32
}

MasterPlaylist #EXT-X-STREAM-INF:PROGRAM-ID=1,BANDWIDTH=240000,RESOLUTION=416x234,CODECS="avc1.42e00a,mp4a.40.2"

type PlaylistType

type PlaylistType string

type Result

type Result struct {
	URL  *url.URL
	M3u8 *M3u8
}

func FromM3u8Content added in v1.0.10

func FromM3u8Content(url, m3u8Str string, loadKeyFunc LoadKeyFunc) (*Result, error)

func FromM3u8URL added in v1.0.10

func FromM3u8URL(m3u8Url string, loadKeyFunc LoadKeyFunc) (*Result, error)

type Segment

type Segment struct {
	URI      string
	KeyIndex int
	Title    string  // #EXTINF: duration,<title>
	Duration float32 // #EXTINF: duration,<title>
	Length   uint64  // #EXT-X-BYTERANGE: length[@offset]
	Offset   uint64  // #EXT-X-BYTERANGE: length[@offset]
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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