Skip to content
This repository has been archived by the owner on Dec 8, 2024. It is now read-only.

Add INSTREAM-ID attribute for CLOSED-CAPTIONS #150

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
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 @@ -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