Skip to content
This repository was archived by the owner on Sep 11, 2025. It is now read-only.
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions reader.go
Original file line number Diff line number Diff line change
Expand Up @@ -325,6 +325,8 @@ func decodeLineOfMasterPlaylist(p *MasterPlaylist, state *decodingState, line st
alt.Forced = v
case "CHARACTERISTICS":
alt.Characteristics = v
case "CHANNELS":
alt.Channels = v
case "SUBTITLES":
alt.Subtitles = v
case "URI":
Expand Down
1 change: 1 addition & 0 deletions structure.go
Original file line number Diff line number Diff line change
Expand Up @@ -193,6 +193,7 @@ type Alternative struct {
Autoselect string
Forced string
Characteristics string
Channels string
Subtitles string
}

Expand Down
5 changes: 5 additions & 0 deletions writer.go
Original file line number Diff line number Diff line change
Expand Up @@ -145,6 +145,11 @@ func (p *MasterPlaylist) Encode() *bytes.Buffer {
p.buf.WriteString(alt.Characteristics)
p.buf.WriteRune('"')
}
if alt.Channels != "" {
p.buf.WriteString(",CHANNELS=\"")
p.buf.WriteString(alt.Channels)
p.buf.WriteRune('"')
}
if alt.Subtitles != "" {
p.buf.WriteString(",SUBTITLES=\"")
p.buf.WriteString(alt.Subtitles)
Expand Down
3 changes: 2 additions & 1 deletion writer_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -777,6 +777,7 @@ func TestNewMasterPlaylistWithAlternatives(t *testing.T) {
Name: "main",
Default: true,
Autoselect: "YES",
Channels: "2",
Language: "english",
}
p, e := NewMediaPlaylist(3, 5)
Expand All @@ -794,7 +795,7 @@ func TestNewMasterPlaylistWithAlternatives(t *testing.T) {
if m.ver != 4 {
t.Fatalf("Expected version 4, actual, %d", m.ver)
}
expected := `#EXT-X-MEDIA:TYPE=AUDIO,GROUP-ID="audio",NAME="main",DEFAULT=YES,AUTOSELECT=YES,LANGUAGE="english",URI="800/rendition.m3u8"`
expected := `#EXT-X-MEDIA:TYPE=AUDIO,GROUP-ID="audio",NAME="main",DEFAULT=YES,AUTOSELECT=YES,LANGUAGE="english",CHANNELS="2",URI="800/rendition.m3u8"`
if !strings.Contains(m.String(), expected) {
t.Fatalf("Master playlist did not contain: %s\nMaster Playlist:\n%v", expected, m.String())
}
Expand Down