Simplified code

This commit is contained in:
saxon 2018-08-18 01:00:51 +09:30
parent 6b2644a517
commit 05b9416aa4
1 changed files with 7 additions and 7 deletions

View File

@ -31,7 +31,7 @@ import (
"bitbucket.org/ausocean/av/pes"
)
const mpegtsPacketSize = 184
const psiPacketSize = 184
// TODO: really need to finish the at and pmt stuff - this is too hacky
var (
@ -43,10 +43,10 @@ var (
// with 0xFFs - because it looks ugly to hardcode above. This is called through
// NewMpegtsgenerator
func genPatAndPmt() {
for len(patTable) < mpegtsPacketSize {
for len(patTable) < psiPacketSize {
patTable = append(patTable, 255)
}
for len(pmtTable) < mpegtsPacketSize {
for len(pmtTable) < psiPacketSize {
pmtTable = append(pmtTable, 255)
}
}
@ -160,10 +160,10 @@ func (g *tsGenerator) generate() {
Data: nalUnit,
HeaderLength: 5,
}
g.pesPktChan <- pesPkt.ToByteSlice()
case pesPkt := <-g.pesPktChan:
for ii := range pesPkt {
g.payloadByteChan <- pesPkt[ii]
pesPktSlice := pesPkt.ToByteSlice()
for ii := range pesPktSlice {
g.payloadByteChan <- pesPktSlice[ii]
}
pusi := true
for len(g.payloadByteChan) > 0 {