joy4/ts/stream.go
nareix 3bd15c08fd Add 'ts/' from commit '7530d353fdefcc59d83c3c8ebea0a147dcbab234'
git-subtree-dir: ts
git-subtree-mainline: 92528599badd9da7f5b10d64f10186a1646bb520
git-subtree-split: 7530d353fdefcc59d83c3c8ebea0a147dcbab234
2016-07-01 21:33:16 +08:00

37 lines
495 B
Go

package ts
import (
"time"
"bytes"
"github.com/nareix/av"
)
type Stream struct {
av.CodecData
pid uint
buf bytes.Buffer
peshdr *PESHeader
tshdr TSHeader
demuxer *Demuxer
muxer *Muxer
streamId uint
streamType uint
tsw *TSWriter
dataBuf *iovec
cacheSize int
idx int
}
func timeToPesTs(tm time.Duration) uint64 {
return uint64(tm*PTS_HZ/time.Second) + PTS_HZ
}
func timeToPCR(tm time.Duration) uint64 {
return uint64(tm*PCR_HZ/time.Second) + PCR_HZ
}