Package hls (v1.33.5) [up] [repository]

Index

Functions

func Bandwidth(s1, s2 *StreamInf) int
func GroupId(m1, m2 *Media) int

Types

type Key

Key represents encryption info from a #EXT-X-KEY tag.

type Key struct {
	Method            string
	Uri               *url.URL
	KeyFormat         string
	KeyFormatVersions string
	Characteristics   string
}

Methods

func (k *Key) DecodeData() ([]byte, error)

DecodeData extracts and decodes the Base64 data directly from the URL Opaque field.

type MasterPlaylist

type MasterPlaylist struct {
	Medias     []*Media
	StreamInfs []*StreamInf
}

Functions

func DecodeMaster(content string) (*MasterPlaylist, error)

DecodeMaster parses a Master Playlist.

Methods

func (mp *MasterPlaylist) ResolveUris(base *url.URL)

type Media

Media represents an #EXT-X-MEDIA tag.

type Media struct {
	AutoSelect bool
	Channels   string
	GroupId    string
	Id         int
	Language   string
	Name       string
	Type       string
	Uri        *url.URL
}

Methods

func (r *Media) String() string

String returns a multi-line summary of the Media.

type MediaPlaylist

type MediaPlaylist struct {
	TargetDuration int
	MediaSequence  int
	Version        int
	PlaylistType   string
	Segments       []*Segment
	Keys           []*Key   // A slice of all keys found in the playlist
	Map            *url.URL // The playlist's initialization map
	EndList        bool
}

Functions

func DecodeMedia(content string) (*MediaPlaylist, error)

DecodeMedia parses a Media Playlist.

Methods

func (mp *MediaPlaylist) ResolveUris(base *url.URL)

type Segment

type Segment struct {
	Uri      *url.URL
	Duration float64
	Title    string
}

type StreamInf

StreamInf represents a single media playlist (URI) from a #EXT-X-STREAM-INF tag. It aggregates information from all tags that point to the same URI. The primary attributes are taken from the variant with the lowest bandwidth.

type StreamInf struct {
	Audio            []string // A list of associated audio Media GROUP-IDs
	AverageBandwidth int
	Bandwidth        int
	Codecs           string
	FrameRate        string
	Id               int
	Resolution       string
	Subtitles        string // Refers to a Media GROUP-ID for subtitles
	Uri              *url.URL
}

Methods

func (s *StreamInf) String() string

String returns a multi-line summary of the StreamInf.