Skip to content

Commit

Permalink
add INSTREAM-ID attribute for alternative renditions
Browse files Browse the repository at this point in the history
  • Loading branch information
rkollar committed Oct 21, 2019
1 parent 036100c commit 8626046
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 0 deletions.
2 changes: 2 additions & 0 deletions reader.go
Original file line number Diff line number Diff line change
Expand Up @@ -323,6 +323,8 @@ func decodeLineOfMasterPlaylist(p *MasterPlaylist, state *decodingState, line st
alt.Autoselect = v
case "FORCED":
alt.Forced = v
case "INSTREAM-ID":
alt.InstreamID = v
case "CHARACTERISTICS":
alt.Characteristics = v
case "SUBTITLES":
Expand Down
1 change: 1 addition & 0 deletions structure.go
Original file line number Diff line number Diff line change
Expand Up @@ -192,6 +192,7 @@ type Alternative struct {
Default bool
Autoselect string
Forced string
InstreamID string
Characteristics 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 @@ -140,6 +140,11 @@ func (p *MasterPlaylist) Encode() *bytes.Buffer {
p.buf.WriteString(alt.Forced)
p.buf.WriteRune('"')
}
if alt.Type == "CLOSED-CAPTIONS" && alt.InstreamID != "" {
p.buf.WriteString(",INSTREAM-ID=\"")
p.buf.WriteString(alt.InstreamID)
p.buf.WriteRune('"')
}
if alt.Characteristics != "" {
p.buf.WriteString(",CHARACTERISTICS=\"")
p.buf.WriteString(alt.Characteristics)
Expand Down

0 comments on commit 8626046

Please sign in to comment.