diff options
| author | 2024-01-22 09:42:41 +0000 | |
|---|---|---|
| committer | 2024-01-22 09:42:41 +0000 | |
| commit | 605b2fde913c9e9b2e503ec5f613791451a186b4 (patch) | |
| tree | 324c23e2d9c88ab06f184c0d5ed326d7ff1a0348 /vendor/github.com/abema/go-mp4/mp4.go | |
| parent | [chore]: Bump github.com/KimMachineGun/automemlimit from 0.4.0 to 0.5.0 (#2560) (diff) | |
| download | gotosocial-605b2fde913c9e9b2e503ec5f613791451a186b4.tar.xz | |
[chore]: Bump github.com/abema/go-mp4 from 1.1.1 to 1.2.0 (#2559)
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 } |
