Skip to content

Commit

Permalink
Update example
Browse files Browse the repository at this point in the history
  • Loading branch information
sunfish-shogi committed Dec 4, 2024
1 parent 9cbbe49 commit c346744
Showing 1 changed file with 23 additions and 1 deletion.
24 changes: 23 additions & 1 deletion examples/decode/decode.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
`

Expand All @@ -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)
}
}
Expand All @@ -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
*/

0 comments on commit c346744

Please sign in to comment.