-
Notifications
You must be signed in to change notification settings - Fork 0
/
stsc.go
34 lines (29 loc) · 806 Bytes
/
stsc.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
package bmff
import (
"encoding/binary"
)
type SampleToChunk struct {
*fullbox
Entries []SampleToChunkEntry
}
func (b *SampleToChunk) parse() error {
entryCount := binary.BigEndian.Uint32(b.raw[0:4])
offset := 4
b.Entries = make([]SampleToChunkEntry, 0, entryCount)
for i := 0; uint32(i) < entryCount; i++ {
entry := SampleToChunkEntry{
firstChunk: binary.BigEndian.Uint32(b.raw[offset : offset+4]),
samplesPerChunk: binary.BigEndian.Uint32(b.raw[offset+4 : offset+8]),
sampleDescriptionIndex: binary.BigEndian.Uint32(b.raw[offset+8 : offset+12]),
}
b.Entries = append(b.Entries, entry)
offset += 12
}
b.raw = nil
return nil
}
type SampleToChunkEntry struct {
firstChunk uint32
samplesPerChunk uint32
sampleDescriptionIndex uint32
}