untangledco / streaming

Media streaming and broadcast systems in Go
https://twitch.tv/untangledco
ISC License
82 stars 5 forks source link

m3u8: inclued tag string in String() methods for all structs representing tags #14

Closed ollytom closed 2 months ago

ollytom commented 2 months ago

Without the tag, the string is essentially invalid. Since we're not exporting the HLS tag names (e.g. "#EXT-STREAM-INF") the String() method is not useful. For example, for our Variant struct, we want String() to return the tag and all the attributes and values its already returning:

func (v Variant) String() string {
    // existing stuff...
    return tagVariant + ":" + strings.Join(attrs, ",")
}

I think tests will need to be updated, too. We'll omit the trailing newline as that is already handled by fmt.Println, the log package etc.; it's what is idiomatic for implementing the Stringer interface, too.