forked from godeep/mp4
-
Notifications
You must be signed in to change notification settings - Fork 6
/
edts.go
51 lines (44 loc) · 808 Bytes
/
edts.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
40
41
42
43
44
45
46
47
48
49
50
51
package mp4
import "io"
// Edit Box (edts - optional)
//
// Contained in: Track Box ("trak")
//
// Status: decoded
//
// The edit box maps the presentation timeline to the media-time line
type EdtsBox struct {
Elst *ElstBox
}
func DecodeEdts(r io.Reader) (Box, error) {
l, err := DecodeContainer(r)
if err != nil {
return nil, err
}
e := &EdtsBox{}
for _, b := range l {
switch b.Type() {
case "elst":
e.Elst = b.(*ElstBox)
default:
return nil, ErrBadFormat
}
}
return e, nil
}
func (b *EdtsBox) Type() string {
return "edts"
}
func (b *EdtsBox) Size() int {
return BoxHeaderSize + b.Elst.Size()
}
func (b *EdtsBox) Dump() {
b.Elst.Dump()
}
func (b *EdtsBox) Encode(w io.Writer) error {
err := EncodeHeader(b, w)
if err != nil {
return err
}
return b.Elst.Encode(w)
}