test dvrip
This commit is contained in:
@@ -2,9 +2,10 @@ package tsio
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"github.com/deepch/vdk/utils/bits/pio"
|
||||
"io"
|
||||
"time"
|
||||
|
||||
"github.com/deepch/vdk/utils/bits/pio"
|
||||
)
|
||||
|
||||
const (
|
||||
@@ -513,6 +514,7 @@ func NewTSWriter(pid uint16) *TSWriter {
|
||||
}
|
||||
return w
|
||||
}
|
||||
|
||||
//TSHeader func
|
||||
type TSHeader struct {
|
||||
PID uint
|
||||
@@ -524,6 +526,7 @@ type TSHeader struct {
|
||||
RandomAccessIndicator bool
|
||||
HeaderLength uint
|
||||
}
|
||||
|
||||
//WriteTSHeader func
|
||||
func WriteTSHeader(w io.Writer, element TSHeader, dataLength int) (written int, err error) {
|
||||
var flags, extFlags uint
|
||||
@@ -614,15 +617,6 @@ func (self *TSWriter) WritePackets(w io.Writer, datav [][]byte, pcr time.Duratio
|
||||
self.tshdr[3] = byte(self.ContinuityCounter)&0xf | 0x30
|
||||
self.tshdr[5] = 0 // flags
|
||||
hdrlen := 6
|
||||
//pid := uint16((self.tshdr[1]&0x1f))<<8 | uint16(self.tshdr[2])
|
||||
//if pid != 256 {
|
||||
//self.tshdr[3] = 0x01
|
||||
|
||||
//self.tshdr[3] = 0x47
|
||||
//self.tshdr[4]
|
||||
// log.Println(self.tshdr[:5])
|
||||
// log.Println("pid", pid,self.tshdr[3] )
|
||||
//}
|
||||
self.ContinuityCounter++
|
||||
|
||||
if writepos == 0 {
|
||||
@@ -716,9 +710,10 @@ func WriteUInt64(w io.Writer, val uint64, n int) (err error) {
|
||||
func WriteUInt(w io.Writer, val uint, n int) (err error) {
|
||||
return WriteUInt64(w, uint64(val), n)
|
||||
}
|
||||
|
||||
//PCRToUInt func
|
||||
func PCRToUInt(pcr uint64) uint64 {
|
||||
base := pcr / 300
|
||||
ext := pcr % 300
|
||||
return base<<15 | 0x3f<<9 | ext
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user