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

Index

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
	IV                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 {
	StreamInfs []*StreamInf
	Medias     []*Media
}

Functions

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

DecodeMaster parses a Master Playlist.

Methods

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

ResolveURIs converts relative URLs to absolute URLs using the base URL.

func (mp *MasterPlaylist) Sort()

Sort sorts the StreamInfs and Medias slices in place. StreamInfs are sorted by their minimum average bandwidth (if available), otherwise falling back to minimum bandwidth. Medias are sorted by GroupID.

type Media

Media represents an #EXT-X-MEDIA tag.

type Media struct {
	Type            string
	GroupID         string
	Name            string
	Language        string
	URI             *url.URL
	AutoSelect      bool
	Default         bool
	Forced          bool
	Channels        string
	Characteristics string
	ID              int
}

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)

ResolveURIs converts relative URLs to absolute URLs using the base 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 {
	URI              *url.URL
	ID               int
	Bandwidth        int
	AverageBandwidth int
	Codecs           string
	Resolution       string
	FrameRate        string
	Subtitles        string   // Refers to a Media GROUP-ID for subtitles
	Audio            []string // A list of associated audio Media GROUP-IDs
}

Methods

func (s *StreamInf) SortBandwidth() int

SortBandwidth determines the value to use for sorting, prioritizing average bandwidth.

func (s *StreamInf) String() string

String returns a multi-line summary of the StreamInf.