streaming

Media streaming and broadcast systems in Go
Log | Files | Refs | README | LICENSE

commit 314f50a588e4e749071e0aa8d51a1b4aa16fad7b
parent 0042f8fa6a2d2e9069555926bc13803f22dffe16
Author: Oliver Lowe <o@olowe.co>
Date:   Thu, 23 May 2024 18:26:42 +1000

m3u8: handle writing basic master playlists

This is enough just for big bug bunny from test-streams.mux.dev.

Diffstat:
Mm3u8/write.go | 18++++++++++++++++++
1 file changed, 18 insertions(+), 0 deletions(-)

diff --git a/m3u8/write.go b/m3u8/write.go @@ -36,6 +36,24 @@ func Encode(w io.Writer, p *Playlist) error { fmt.Fprintln(w, seg.URI) } + for _, v := range p.Variants { + fmt.Fprint(w, tagVariant+":") + if v.Bandwidth > 0 { + fmt.Fprintf(w, "BANDWIDTH=%d,", v.Bandwidth) + } + if v.AverageBandwidth > 0 { + fmt.Fprintf(w, "AVERAGE-BANDWIDTH=%d", v.AverageBandwidth) + } + if len(v.Codecs) > 0 { + fmt.Fprintf(w, "CODECS=%q,", strings.Join(v.Codecs, ",")) + } + if v.Resolution != [2]int{0, 0} { + fmt.Fprintf(w, "RESOLUTION=%dx%d", v.Resolution[0], v.Resolution[1]) + } + fmt.Fprintln(w) + fmt.Fprintln(w, v.URI) + } + if p.End { fmt.Fprintln(w, tagEndList) }