-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathstco.go
39 lines (33 loc) · 784 Bytes
/
stco.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
35
36
37
38
39
package bmff
import (
"encoding/binary"
)
type ChunkOffset struct {
*fullbox
Entries []uint32
}
func (b *ChunkOffset) parse() error {
entryCount := binary.BigEndian.Uint32(b.raw[0:4])
b.Entries = make([]uint32, 0, entryCount)
offset := 4
for i := 0; uint32(i) < entryCount; i++ {
b.Entries = append(b.Entries, binary.BigEndian.Uint32(b.raw[offset:offset+4]))
offset += 4
}
return nil
}
type ChunkLargeOffset struct {
*fullbox
Entries []uint64
}
func (b *ChunkLargeOffset) parse() error {
entryCount := binary.BigEndian.Uint32(b.raw[0:4])
b.Entries = make([]uint64, 0, entryCount)
offset := 4
for i := 0; uint32(i) < entryCount; i++ {
b.Entries = append(b.Entries, binary.BigEndian.Uint64(b.raw[offset:offset+8]))
offset += 8
}
b.raw = nil
return nil
}