Skip to content

Commit 30ceb65

Browse files
Attempt to reconcile modules
1 parent 975de6e commit 30ceb65

33 files changed

+1124
-330
lines changed

.github/workflows/pull-request.yaml

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ jobs:
66
test:
77
strategy:
88
matrix:
9-
go-version: [1.14.x, 1.15.x, 1.16.x]
9+
go-version: [1.14.x, 1.15.x, 1.16.x, 1.17.x, 1.18.x, 1.19.x]
1010
os: [ubuntu-latest]
1111
runs-on: ${{ matrix.os }}
1212
steps:

go.mod

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
module github.com/Comcast/gots
22

3-
go 1.16
3+
go 1.18

v2/ebp/cablelabsebp.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ import (
2929
"encoding/binary"
3030
"time"
3131

32-
"github.com/Comcast/gots/v2/"
32+
"github.com/Comcast/gots/v2"
3333
)
3434

3535
// cableLabsEbp is an encoder boundary point

v2/ebp/comcastebp.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ import (
2929
"encoding/binary"
3030
"time"
3131

32-
"github.com/Comcast/gots/v2/"
32+
"github.com/Comcast/gots/v2"
3333
)
3434

3535
// cableLabsEbp is an encoder boundary point

v2/ebp/ebp.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ import (
2828
"encoding/binary"
2929
"time"
3030

31-
"github.com/Comcast/gots/v2/"
31+
"github.com/Comcast/gots/v2"
3232
)
3333

3434
// EBP tags

v2/ebp/ebp_test.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ import (
2727
"testing"
2828
"time"
2929

30-
"github.com/Comcast/gots/v2/"
30+
"github.com/Comcast/gots/v2"
3131
)
3232

3333
var CableLabsEBPBytes = []byte{

v2/go.mod

+1-12
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,3 @@
11
module github.com/Comcast/gots/v2
22

3-
go 1.16
4-
5-
require (
6-
github.com/cpuguy83/go-md2man/v2 v2.0.1 // indirect
7-
github.com/ksubedi/gomove v0.0.0-20200106182546-e1fa47256217 // indirect
8-
github.com/mattn/go-colorable v0.1.10 // indirect
9-
github.com/mattn/go-isatty v0.0.14 // indirect
10-
github.com/mgutz/ansi v0.0.0-20200706080929-d51e80ef957d // indirect
11-
github.com/urfave/cli v1.22.5 // indirect
12-
golang.org/x/sys v0.0.0-20210927094055-39ccf1dd6fa6 // indirect
13-
golang.org/x/tools v0.1.6 // indirect
14-
)
3+
go 1.18

v2/go.sum

-58
Original file line numberDiff line numberDiff line change
@@ -1,58 +0,0 @@
1-
github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU=
2-
github.com/cpuguy83/go-md2man/v2 v2.0.0-20190314233015-f79a8a8ca69d/go.mod h1:maD7wRr/U5Z6m/iR4s+kqSMx2CaBsrgA7czyZG/E6dU=
3-
github.com/cpuguy83/go-md2man/v2 v2.0.1 h1:r/myEWzV9lfsM1tFLgDyu0atFtJ1fXn261LKYj/3DxU=
4-
github.com/cpuguy83/go-md2man/v2 v2.0.1/go.mod h1:tgQtvFlXSQOSOSIRvRPT7W67SCa46tRHOmNcaadrF8o=
5-
github.com/ksubedi/gomove v0.0.0-20200106182546-e1fa47256217 h1:CYk3GRunz2nSWbGNXpDxlr5uU/YTkBf1p9zorauMvvc=
6-
github.com/ksubedi/gomove v0.0.0-20200106182546-e1fa47256217/go.mod h1:yq7Mn2Ip7t9irYr+JskEuBYdF3tKnikTKG49Qn5aDuY=
7-
github.com/mattn/go-colorable v0.1.4/go.mod h1:U0ppj6V5qS13XJ6of8GYAs25YV2eR4EVcfRqFIhoBtE=
8-
github.com/mattn/go-colorable v0.1.10 h1:KWqbp83oZ6YOEgIbNW3BM1Jbe2tz4jgmWA9FOuAF8bw=
9-
github.com/mattn/go-colorable v0.1.10/go.mod h1:u6P/XSegPjTcexA+o6vUJrdnUu04hMope9wVRipJSqc=
10-
github.com/mattn/go-isatty v0.0.8/go.mod h1:Iq45c/XA43vh69/j3iqttzPXn0bhXyGjM0Hdxcsrc5s=
11-
github.com/mattn/go-isatty v0.0.12/go.mod h1:cbi8OIDigv2wuxKPP5vlRcQ1OAZbq2CE4Kysco4FUpU=
12-
github.com/mattn/go-isatty v0.0.14 h1:yVuAays6BHfxijgZPzw+3Zlu5yQgKGP2/hcQbHb7S9Y=
13-
github.com/mattn/go-isatty v0.0.14/go.mod h1:7GGIvUiUoEMVVmxf/4nioHXj79iQHKdU27kJ6hsGG94=
14-
github.com/mgutz/ansi v0.0.0-20170206155736-9520e82c474b/go.mod h1:01TrycV0kFyexm33Z7vhZRXopbI8J3TDReVlkTgMUxE=
15-
github.com/mgutz/ansi v0.0.0-20200706080929-d51e80ef957d h1:5PJl274Y63IEHC+7izoQE9x6ikvDFZS2mDVS3drnohI=
16-
github.com/mgutz/ansi v0.0.0-20200706080929-d51e80ef957d/go.mod h1:01TrycV0kFyexm33Z7vhZRXopbI8J3TDReVlkTgMUxE=
17-
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
18-
github.com/russross/blackfriday/v2 v2.0.1/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM=
19-
github.com/russross/blackfriday/v2 v2.1.0 h1:JIOH55/0cWyOuilr9/qlrm0BSXldqnqwMsf35Ld67mk=
20-
github.com/russross/blackfriday/v2 v2.1.0/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM=
21-
github.com/shurcooL/sanitized_anchor_name v1.0.0 h1:PdmoCO6wvbs+7yrJyMORt4/BmY5IYyJwS/kOiWx8mHo=
22-
github.com/shurcooL/sanitized_anchor_name v1.0.0/go.mod h1:1NzhyTcUVG4SuEtjjoZeVRXNmyL/1OwPU0+IJeTBvfc=
23-
github.com/urfave/cli v1.22.2/go.mod h1:Gos4lmkARVdJ6EkW0WaNv/tZAAMe9V7XWyB60NtXRu0=
24-
github.com/urfave/cli v1.22.5 h1:lNq9sAHXK2qfdI8W+GRItjCEkI+2oR4d+MEHy1CKXoU=
25-
github.com/urfave/cli v1.22.5/go.mod h1:Gos4lmkARVdJ6EkW0WaNv/tZAAMe9V7XWyB60NtXRu0=
26-
github.com/yuin/goldmark v1.4.0/go.mod h1:mwnBkeHKe2W/ZEtQ+71ViKU8L12m81fl3OWwC1Zlc8k=
27-
golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w=
28-
golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI=
29-
golang.org/x/mod v0.4.2/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA=
30-
golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg=
31-
golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
32-
golang.org/x/net v0.0.0-20210805182204-aaa1db679c0d/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y=
33-
golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
34-
golang.org/x/sync v0.0.0-20210220032951-036812b2e83c/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
35-
golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
36-
golang.org/x/sys v0.0.0-20190222072716-a9d3bda3a223/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
37-
golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
38-
golang.org/x/sys v0.0.0-20200116001909-b77594299b42/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
39-
golang.org/x/sys v0.0.0-20200223170610-d5e6a3e2c0ae/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
40-
golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
41-
golang.org/x/sys v0.0.0-20210423082822-04245dca01da/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
42-
golang.org/x/sys v0.0.0-20210630005230-0f9fa26af87c/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
43-
golang.org/x/sys v0.0.0-20210809222454-d867a43fc93e/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
44-
golang.org/x/sys v0.0.0-20210927094055-39ccf1dd6fa6 h1:foEbQz/B0Oz6YIqu/69kfXPYeFQAuuMYFkjaqXzl5Wo=
45-
golang.org/x/sys v0.0.0-20210927094055-39ccf1dd6fa6/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
46-
golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo=
47-
golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
48-
golang.org/x/text v0.3.6/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
49-
golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ=
50-
golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo=
51-
golang.org/x/tools v0.0.0-20191204214957-d79e56da46fe/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo=
52-
golang.org/x/tools v0.1.6 h1:SIasE1FVIQOWz2GEAHFOmoW7xchJcqlucjSULTL0Ag4=
53-
golang.org/x/tools v0.1.6/go.mod h1:LGqMHiF4EqQNHR1JncWGqT5BVaXmza+X+BDGol+dOxo=
54-
golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
55-
golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
56-
golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
57-
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
58-
gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=

v2/packet/accumulator.go

+16-7
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ package packet
2727
import (
2828
"bytes"
2929

30-
"github.com/Comcast/gots/v2/"
30+
"github.com/Comcast/gots/v2"
3131
)
3232

3333
// Iotas to track the state of the accumulator
@@ -61,9 +61,10 @@ type accumulator struct {
6161
// the provided function returns done as true.
6262
func NewAccumulator(f func(data []byte) (done bool, err error)) Accumulator {
6363
return &accumulator{
64-
f: f,
65-
buf: &bytes.Buffer{},
66-
state: stateStarting}
64+
f: f,
65+
buf: &bytes.Buffer{},
66+
packets: []*Packet{},
67+
state: stateStarting}
6768
}
6869

6970
// Add a packet to the accumulator. If the added packet completes
@@ -77,7 +78,8 @@ func (a *accumulator) WritePacket(pkt *Packet) (int, error) {
7778
return PacketSize, gots.ErrNoPayloadUnitStartIndicator
7879
}
7980

80-
a.packets = []*Packet{}
81+
a.buf.Reset()
82+
a.packets = a.packets[:0]
8183
a.state = stateAccumulating
8284

8385
case stateAccumulating:
@@ -114,17 +116,24 @@ func (a *accumulator) WritePacket(pkt *Packet) (int, error) {
114116

115117
// Bytes returns the payload bytes from the underlying buffer
116118
func (a *accumulator) Bytes() []byte {
117-
return a.buf.Bytes()
119+
b := make([]byte, a.buf.Len())
120+
copy(b, a.buf.Bytes())
121+
122+
return b
118123
}
119124

120125
// Packets returns the packets used to fill the payload buffer
121126
// NOTE: Not thread safe
122127
func (a *accumulator) Packets() []*Packet {
123-
return a.packets
128+
b := make([]*Packet, len(a.packets))
129+
copy(b, a.packets)
130+
131+
return b
124132
}
125133

126134
// Reset resets the accumulator state
127135
func (a *accumulator) Reset() {
128136
a.state = stateStarting
129137
a.buf.Reset()
138+
a.packets = a.packets[:0]
130139
}

v2/packet/accumulator_test.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ import (
2828
"encoding/hex"
2929
"testing"
3030

31-
"github.com/Comcast/gots/v2/"
31+
"github.com/Comcast/gots/v2"
3232
)
3333

3434
// PacketAccumulator is not thread safe

v2/packet/adaptationfield.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ SOFTWARE.
2525
package packet
2626

2727
import (
28-
"github.com/Comcast/gots/v2/"
28+
"github.com/Comcast/gots/v2"
2929
)
3030

3131
const (

v2/packet/adaptationfield/adaptationfield.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
package adaptationfield
22

33
import (
4-
"github.com/Comcast/gots/v2/"
4+
"github.com/Comcast/gots/v2"
55
"github.com/Comcast/gots/v2/packet"
66
)
77

v2/packet/create.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ SOFTWARE.
2525
package packet
2626

2727
import (
28-
"github.com/Comcast/gots/v2/"
28+
"github.com/Comcast/gots/v2"
2929
)
3030

3131
var (

v2/packet/io.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ import (
2828
"encoding/binary"
2929
"io"
3030

31-
"github.com/Comcast/gots/v2/"
31+
"github.com/Comcast/gots/v2"
3232
)
3333

3434
// Peeker wraps the Peek method.

v2/packet/modify.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ SOFTWARE.
2525
package packet
2626

2727
import (
28-
"github.com/Comcast/gots/v2/"
28+
"github.com/Comcast/gots/v2"
2929
)
3030

3131
// flags that are reserved and should not be used.

v2/packet/packet.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ SOFTWARE.
2525
package packet
2626

2727
import (
28-
"github.com/Comcast/gots/v2/"
28+
"github.com/Comcast/gots/v2"
2929
)
3030

3131
const (

v2/packet/packetwriter.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ package packet
2727
import (
2828
"io"
2929

30-
"github.com/Comcast/gots/v2/"
30+
"github.com/Comcast/gots/v2"
3131
)
3232

3333
// PacketWriter is subject to all rules governing implementations of io.Writer

v2/pes/pesheader.go

+2-2
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ import (
2828
"errors"
2929
"fmt"
3030

31-
"github.com/Comcast/gots/v2/"
31+
"github.com/Comcast/gots/v2"
3232
)
3333

3434
// stream_id possibilities
@@ -170,7 +170,7 @@ func NewPESHeader(pesBytes []byte) (PESHeader, error) {
170170
pes := new(pESHeader)
171171
var err error
172172

173-
if CheckLength(pesBytes, "PES", 6) {
173+
if CheckLength(pesBytes, "PES", 7) {
174174

175175
pes.packetStartCodePrefix = uint32(pesBytes[0])<<16 | uint32(pesBytes[1])<<8 | uint32(pesBytes[2])
176176

v2/psi/pat.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ import (
2828
"errors"
2929
"io"
3030

31-
"github.com/Comcast/gots/v2/"
31+
"github.com/Comcast/gots/v2"
3232
"github.com/Comcast/gots/v2/packet"
3333
)
3434

v2/psi/pmt.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ import (
3030
"fmt"
3131
"io"
3232

33-
"github.com/Comcast/gots/v2/"
33+
"github.com/Comcast/gots/v2"
3434
"github.com/Comcast/gots/v2/packet"
3535
)
3636

v2/psi/pmt_test.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ import (
3030
"fmt"
3131
"testing"
3232

33-
"github.com/Comcast/gots/v2/"
33+
"github.com/Comcast/gots/v2"
3434
"github.com/Comcast/gots/v2/packet"
3535
)
3636

v2/psi/psi.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ SOFTWARE.
2525
package psi
2626

2727
import (
28-
"github.com/Comcast/gots/v2/"
28+
"github.com/Comcast/gots/v2"
2929
)
3030

3131
// TableHeader struct represents operations available on all PSI

v2/scte35/descriptormodify.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ SOFTWARE.
2525
package scte35
2626

2727
import (
28-
"github.com/Comcast/gots/v2/"
28+
"github.com/Comcast/gots/v2"
2929
)
3030

3131
// SetUPIDType will set the type of the UPID

0 commit comments

Comments
 (0)