diff --git a/packets/MpegTs.go b/packets/MpegTs.go index f9f58915..3cc5ea49 100644 --- a/packets/MpegTs.go +++ b/packets/MpegTs.go @@ -126,8 +126,27 @@ func (p *MpegTsPacket) ToByteSlice() (output []byte) { output[1] = boolToByte(p.TEI) << 7 | boolToByte(p.PUSI) << 6 | boolToByte(p.Priority) << 5 | byte((p.PID&0xFF00) >> 8) output[2] = byte(p.PID & 0x00FF) - output[3] = p.TSC << 6 | (p.AFC << 4) | p.CC + output[3] = p.TSC << 6 | p.AFC << 4 | p.CC output[4] = p.AFL - output[5] = - return + output[5] = boolToByte(p.DI) << 7 | boolToByte(p.RAI) << 6 | boolToByte(p.ESPI) << 5 | + boolToByte(p.PCRF) << 4 | boolToByte(p.OPCRF) << 3 | boolToByte(p.SPF) << 2 | + boolToByte(TPDF) << 1 | boolToByte(AFEF) + currentIndex := 6 + for ; p.PCRf && currentIndex < 12; currentIndex++ { + output[currentIndex] = p.PCR >> (22 - 2*currentIndex) + } + startIndex := currentIndex + for ; p.OPCRF && ( currentIndex < ( startIndex + 6 )); currentIndex++ { + output[currentIndex] = p.OPCR >> (10 - 2*(currentIndex-startIndex)) + } + if p.SPF { + output[(currentIndex++)-1] = p.SC + } + if p.TPDF { + output[(currentIndex++)-1] = p.TPDL + copy(output[currentIndex:len(p.TPD)],p.TPD[:]] + currentIndex += len(p.TPD) + } + copy() + } diff --git a/revid/mpegtsCompare b/revid/mpegtsCompare new file mode 100755 index 00000000..a40e59a5 Binary files /dev/null and b/revid/mpegtsCompare differ diff --git a/revid/video b/revid/video new file mode 100644 index 00000000..e69de29b