Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/Comcast/gots
MPEG Transport Stream handling in Go
https://github.com/Comcast/gots
Last synced: about 2 months ago
JSON representation
MPEG Transport Stream handling in Go
- Host: GitHub
- URL: https://github.com/Comcast/gots
- Owner: Comcast
- License: other
- Created: 2016-07-11T14:26:42.000Z (about 8 years ago)
- Default Branch: master
- Last Pushed: 2024-05-28T08:42:26.000Z (4 months ago)
- Last Synced: 2024-06-20T14:35:37.555Z (3 months ago)
- Language: Go
- Homepage:
- Size: 1.49 MB
- Stars: 303
- Watchers: 35
- Forks: 87
- Open Issues: 17
-
Metadata Files:
- Readme: Readme.md
- Contributing: CONTRIBUTING
- License: LICENSE
- Code of conduct: CODE_OF_CONDUCT.md
Awesome Lists containing this project
README
[![Go Reference](https://pkg.go.dev/badge/github.com/Comcast/gots/v2.svg)](https://pkg.go.dev/github.com/Comcast/gots/v2)
[![Build Status](https://travis-ci.org/Comcast/gots.svg?branch=master)](https://travis-ci.org/Comcast/gots)
[![Go Report Card](https://goreportcard.com/badge/github.com/Comcast/gots)](https://goreportcard.com/report/github.com/Comcast/gots)
[![Coverage Status](https://coveralls.io/repos/github/Comcast/gots/badge.svg?branch=master)](https://coveralls.io/github/Comcast/gots?branch=master)# goTS (Go Transport Streams)
gots (Go Transport Streams) is a library for working with MPEG transport streams. It provides abstractions for reading packet information and program specific information (psi)
## Bug / Feature Reporting
Add requests to Github issues. To submit a PR see [CONTRIBUTING](./CONTRIBUTING)
## Tests
```bash
go test -race ./...
```
Travis-CI will run these tests:```bash
go test -v ./...
```
## License
This software is licensed under the MIT license. For full text see [LICENSE](./LICENSE)## Code of Conduct
We take our [code of conduct](CODE_OF_CONDUCT.md) very seriously. Please abide by it.## Examples
This is a simple example that extracts all PIDs from a ts file and prints them. [CLI example parser can be found here](cli/parsefile.go)
```go
func main() {
pidSet := make(map[uint16]bool, 5)
filename := "./scenario1.ts"
file, err := os.Open(filename)
if err == nil {
pkt := make([]byte, packet.PacketSize)
for read, err := file.Read(pkt); read > 0 && err == nil; read, err = file.Read(pkt) {
if err != nil {
println(err)
return
}
pid, err := packet.Pid(pkt)
if err != nil {
println(err)
continue
}
pidSet[pid] = true
}for v := range pidSet {
fmt.Printf("Found pid %d\n", v)
}
} else {
fmt.Printf("Unable to open file [%s] due to [%s]\n", filename, err.Error())
}
```