[chore]: Bump github.com/abema/go-mp4 from 1.1.1 to 1.2.0 (#2559)

This commit is contained in:
dependabot[bot] 2024-01-22 09:42:41 +00:00 committed by GitHub
commit 605b2fde91
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
9 changed files with 170 additions and 5 deletions

View file

@ -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
}