diff options
Diffstat (limited to 'vendor/github.com/abema/go-mp4/mp4.go')
-rw-r--r-- | vendor/github.com/abema/go-mp4/mp4.go | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/vendor/github.com/abema/go-mp4/mp4.go b/vendor/github.com/abema/go-mp4/mp4.go index 6aa5b307a..2fab24da7 100644 --- a/vendor/github.com/abema/go-mp4/mp4.go +++ b/vendor/github.com/abema/go-mp4/mp4.go @@ -1,6 +1,7 @@ package mp4 import ( + "encoding/binary" "errors" "fmt" "reflect" @@ -19,6 +20,13 @@ func StrToBoxType(code string) BoxType { return BoxType{code[0], code[1], code[2], code[3]} } +// Uint32ToBoxType returns a new BoxType from the provied uint32 +func Uint32ToBoxType(i uint32) BoxType { + b := make([]byte, 4) + binary.BigEndian.PutUint32(b, i) + return BoxType{b[0], b[1], b[2], b[3]} +} + func (boxType BoxType) String() string { if isPrintable(boxType[0]) && isPrintable(boxType[1]) && isPrintable(boxType[2]) && isPrintable(boxType[3]) { s := string([]byte{boxType[0], boxType[1], boxType[2], boxType[3]}) @@ -92,6 +100,8 @@ func AddAnyTypeBoxDefEx(payload IAnyType, boxType BoxType, isTarget func(Context }) } +var itemBoxFields = buildFields(&Item{}) + func (boxType BoxType) getBoxDef(ctx Context) *boxDef { boxDefs := boxMap[boxType] for i := len(boxDefs) - 1; i >= 0; i-- { @@ -100,6 +110,16 @@ func (boxType BoxType) getBoxDef(ctx Context) *boxDef { return boxDef } } + if ctx.UnderIlst { + typeID := int(binary.BigEndian.Uint32(boxType[:])) + if typeID >= 1 && typeID <= ctx.QuickTimeKeysMetaEntryCount { + return &boxDef{ + dataType: reflect.TypeOf(Item{}), + isTarget: isIlstMetaContainer, + fields: itemBoxFields, + } + } + } return nil } |