mirror of https://bitbucket.org/ausocean/av.git
made tsGenerator implement Generator
This commit is contained in:
parent
de7b80adfb
commit
94e174b641
|
@ -86,6 +86,7 @@ type tsGenerator struct {
|
|||
fps uint
|
||||
pesPktChan chan []byte
|
||||
ccMap map[int]int
|
||||
isGenerating bool
|
||||
}
|
||||
|
||||
// getInputChan returns a handle to the nalInputChan (inputChan) so that nal units
|
||||
|
@ -117,6 +118,7 @@ func NewTsGenerator(fps uint) (g *tsGenerator) {
|
|||
g.ccMap[pmtPid] = 0
|
||||
g.ccMap[videoPid] = 0
|
||||
genPatAndPmt()
|
||||
g.isGenerating = false
|
||||
return
|
||||
}
|
||||
|
||||
|
@ -137,9 +139,14 @@ func (g *tsGenerator) genPcr() (pcr uint64) {
|
|||
// Start is called when we would like generation to begin, i.e. we would like
|
||||
// the generator to start taking input data and creating mpegts packets
|
||||
func (g *tsGenerator) Start() {
|
||||
g.isGenerating = true
|
||||
go g.generate()
|
||||
}
|
||||
|
||||
func (g *tsGenerator) Stop() {
|
||||
g.isGenerating = false
|
||||
}
|
||||
|
||||
// getCC returns the next continuity counter for a particular pid
|
||||
func (g *tsGenerator) getCC(pid int) int {
|
||||
temp := g.ccMap[pid]
|
||||
|
|
Loading…
Reference in New Issue