mirror of https://bitbucket.org/ausocean/av.git
container/mts/mpegts.go: removed unused const
This commit is contained in:
parent
1e7d3508e3
commit
9dcf866162
|
@ -35,11 +35,7 @@ import (
|
|||
"github.com/Comcast/gots/packet"
|
||||
)
|
||||
|
||||
// General mpegts packet properties.
|
||||
const (
|
||||
PacketSize = 188
|
||||
MaxPayloadSize = 176
|
||||
)
|
||||
const PacketSize = 188
|
||||
|
||||
// Program ID for various types of ts packets.
|
||||
const (
|
||||
|
@ -230,14 +226,14 @@ func (p *Packet) Bytes(buf []byte) []byte {
|
|||
buf[3] = (p.TSC<<6 | p.AFC<<4 | p.CC)
|
||||
|
||||
var maxPayloadSize int
|
||||
if p.AFC & 0x2 != 0 {
|
||||
if p.AFC&0x2 != 0 {
|
||||
maxPayloadSize = PacketSize - 6 - asInt(p.PCRF)*6
|
||||
} else {
|
||||
maxPayloadSize = PacketSize - 4
|
||||
}
|
||||
|
||||
stuffingLen := maxPayloadSize -len(p.Payload)
|
||||
if p.AFC & 0x2 != 0 {
|
||||
stuffingLen := maxPayloadSize - len(p.Payload)
|
||||
if p.AFC&0x2 != 0 {
|
||||
buf[4] = byte(1 + stuffingLen + asInt(p.PCRF)*6)
|
||||
buf[5] = (asByte(p.DI)<<7 | asByte(p.RAI)<<6 | asByte(p.ESPI)<<5 | asByte(p.PCRF)<<4 | asByte(p.OPCRF)<<3 | asByte(p.SPF)<<2 | asByte(p.TPDF)<<1 | asByte(p.AFEF))
|
||||
} else {
|
||||
|
@ -253,11 +249,10 @@ func (p *Packet) Bytes(buf []byte) []byte {
|
|||
}
|
||||
curLen := len(buf)
|
||||
buf = buf[:PacketSize]
|
||||
copy(buf[curLen:],p.Payload)
|
||||
copy(buf[curLen:], p.Payload)
|
||||
return buf
|
||||
}
|
||||
|
||||
|
||||
func asInt(b bool) int {
|
||||
if b {
|
||||
return 1
|
||||
|
|
Loading…
Reference in New Issue