m3u

package
v1.1.0 Latest Latest
Warning

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

Go to latest
Published: Nov 2, 2024 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DecodeAttributeList

func DecodeAttributeList(line string) map[string]string

DecodeAttributeList turns an attribute list into a key, value map. You should trim any characters not part of the attribute list, such as the tag and ':'.

func Marshal

func Marshal(v Marshaler) ([]byte, error)

func Unmarshal

func Unmarshal(data []byte, v Unmarshaler) error

Unmarshal parses the M3U-encoded data and stores the result in the value pointed to by v.

Types

type Encoder

type Encoder struct {
	// contains filtered or unexported fields
}

func NewEncoder

func NewEncoder(w io.Writer) *Encoder

func (*Encoder) Encode

func (e *Encoder) Encode(v Marshaler) error

type Marshaler

type Marshaler interface {
	MarshalM3U() ([]byte, error)
}

type Playlist

type Playlist struct {
	Tracks         []Track
	VariantStreams []VariantStream
	Version        int
	Tags           []Tag
}

Playlist is a type that represents an m3u playlist containing 0 or more tracks or streams

func NewPlaylist

func NewPlaylist() Playlist

func (*Playlist) MarshalM3U

func (p *Playlist) MarshalM3U() ([]byte, error)

func (*Playlist) UnmarshalM3U

func (p *Playlist) UnmarshalM3U(data []byte) error

UnmarshalM3U implements the Unmarshaler interface

type Tag

type Tag struct {
	Name  string
	Value string
}

A Tag is a key/value pair

type Track

type Track struct {
	Name     string
	Duration float64
	URI      string
	Tags     []Tag
}

Track represents an m3u track with a Name, Lengh, URI and a set of tags

func (*Track) MarshalM3U

func (track *Track) MarshalM3U() ([]byte, error)

func (*Track) UnmarshalM3U

func (t *Track) UnmarshalM3U(data []byte) error

type Unmarshaler

type Unmarshaler interface {
	UnmarshalM3U([]byte) error
}

type VariantStream

type VariantStream struct {
	Name            string
	URI             string
	Resolution      string
	Bandwidth       int
	AverageBandwith int
	Codecs          string
	FrameRate       float64
	HdcpLevel       string
	Video           string
	Audio           string
	Subtitle        string
	ClosedCaptions  string

	Tags []Tag
}

VariantStream represents an m3u variant stream with a set of attributes

func (*VariantStream) MarshalM3U

func (s *VariantStream) MarshalM3U() ([]byte, error)

func (*VariantStream) UnmarshalM3U

func (s *VariantStream) UnmarshalM3U(data []byte) error

Jump to

Keyboard shortcuts

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