Skip to content

Commit

Permalink
Use segment Keyformat and Keyformatversions on MediaPlaylist.Encode()
Browse files Browse the repository at this point in the history
Previously, when a segment has different encryption parameters than the
default playlist, the Encode() function uses the segment's parameters for
all parameters but Keyformat and Keyformatversions.

This change uses the segment's Keyformat and Keyformatversions when the
segments are encoded, allowing these parameters to change per segment and
not requiring a playlist to have a key set.
  • Loading branch information
bradleyfalzon committed Dec 7, 2015
1 parent a65d5bf commit be34e44
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions writer.go
Original file line number Diff line number Diff line change
Expand Up @@ -454,14 +454,14 @@ func (p *MediaPlaylist) Encode() *bytes.Buffer {
p.buf.WriteString(",IV=")
p.buf.WriteString(seg.Key.IV)
}
if p.Key.Keyformat != "" {
if seg.Key.Keyformat != "" {
p.buf.WriteString(",KEYFORMAT=\"")
p.buf.WriteString(p.Key.Keyformat)
p.buf.WriteString(seg.Key.Keyformat)
p.buf.WriteRune('"')
}
if p.Key.Keyformatversions != "" {
if seg.Key.Keyformatversions != "" {
p.buf.WriteString(",KEYFORMATVERSIONS=\"")
p.buf.WriteString(p.Key.Keyformatversions)
p.buf.WriteString(seg.Key.Keyformatversions)
p.buf.WriteRune('"')
}
p.buf.WriteRune('\n')
Expand Down

0 comments on commit be34e44

Please sign in to comment.