add track.go
This commit is contained in:
parent
7f98b69834
commit
21888f54d7
34
demuxer.go
34
demuxer.go
@ -109,6 +109,40 @@ func (self *Track) setSampleIndex(index int) (err error) {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
start = 0
|
||||||
|
found = false
|
||||||
|
self.ptsEntryIndex = 0
|
||||||
|
for self.ptsEntryIndex < len(self.sample.TimeToSample.Entries) {
|
||||||
|
n := self.sample.TimeToSample.Entries[self.ptsEntryIndex].Count
|
||||||
|
if index >= start && index < start+n {
|
||||||
|
self.sampleIndexInPtsEntry = index-start
|
||||||
|
break
|
||||||
|
}
|
||||||
|
start += n
|
||||||
|
self.ptsEntryIndex++
|
||||||
|
}
|
||||||
|
if !found {
|
||||||
|
err = io.EOF
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
start = 0
|
||||||
|
found = false
|
||||||
|
self.dtsEntryIndex = 0
|
||||||
|
for self.dtsEntryIndex < len(self.sample.CompositionOffset.Entries) {
|
||||||
|
n := self.sample.CompositionOffset.Entries[self.dtsEntryIndex].Count
|
||||||
|
if index >= start && index < start+n {
|
||||||
|
self.sampleIndexInDtsEntry = index-start
|
||||||
|
break
|
||||||
|
}
|
||||||
|
start += n
|
||||||
|
self.dtsEntryIndex++
|
||||||
|
}
|
||||||
|
if !found {
|
||||||
|
err = io.EOF
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
self.sampleIndex = index
|
self.sampleIndex = index
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
7
track.go
7
track.go
@ -20,6 +20,13 @@ type Track struct {
|
|||||||
|
|
||||||
sample *atom.SampleTable
|
sample *atom.SampleTable
|
||||||
sampleIndex int
|
sampleIndex int
|
||||||
|
|
||||||
|
ptsEntryIndex int
|
||||||
|
sampleIndexInPtsEntry int
|
||||||
|
|
||||||
|
dtsEntryIndex int
|
||||||
|
sampleIndexInDtsEntry int
|
||||||
|
|
||||||
chunkGroupIndex int
|
chunkGroupIndex int
|
||||||
chunkIndex int
|
chunkIndex int
|
||||||
sampleIndexInChunk int
|
sampleIndexInChunk int
|
||||||
|
Loading…
x
Reference in New Issue
Block a user