diff --git a/examples/decode/decode.go b/examples/decode/decode.go index 014fc99..712f654 100644 --- a/examples/decode/decode.go +++ b/examples/decode/decode.go @@ -14,7 +14,7 @@ http://example.com/low.m3u8 http://example.com/mid.m3u8 #EXT-X-STREAM-INF:BANDWIDTH=7680000,AVERAGE-BANDWIDTH=6000000 http://example.com/hi.m3u8 -#EXT-X-STREAM-INF:BANDWIDTH=65000,CODECS="mp4a.40.5" +#EXT-X-STREAM-INF:BANDWIDTH=65000,CODECS="mp4a.40.5",UNKNOWN-ATTR="non-standard" http://example.com/audio-only.m3u8 ` @@ -32,8 +32,14 @@ func main() { for i, stream := range playlist.Master().Streams { fmt.Printf(" %d:\n", i) height, width, _ := stream.Attributes.Resolution() + bandwidth, _ := stream.Attributes.Bandwidth() + averageBandwidth, _ := stream.Attributes.AverageBandwidth() fmt.Println(" Height:", height) fmt.Println(" Width:", width) + fmt.Println(" Bandwidth:", bandwidth) + fmt.Println(" AverageBandwidth:", averageBandwidth) + fmt.Println(" Codecs:", stream.Attributes.Codecs()) + fmt.Println(" UnknownAttr:", stream.Attributes["UNKNOWN-ATTR"]) fmt.Println(" URI:", stream.URI) } } @@ -46,17 +52,33 @@ Streams: 0: Height: 0 Width: 0 + Bandwidth: 1280000 + AverageBandwidth: 1000000 + Codecs: [] + UnknownAttr: URI: http://example.com/low.m3u8 1: Height: 0 Width: 0 + Bandwidth: 2560000 + AverageBandwidth: 2000000 + Codecs: [] + UnknownAttr: URI: http://example.com/mid.m3u8 2: Height: 0 Width: 0 + Bandwidth: 7680000 + AverageBandwidth: 6000000 + Codecs: [] + UnknownAttr: URI: http://example.com/hi.m3u8 3: Height: 0 Width: 0 + Bandwidth: 65000 + AverageBandwidth: 0 + Codecs: [mp4a.40.5] + UnknownAttr: "non-standard" URI: http://example.com/audio-only.m3u8 */