Skip to content

Commit

Permalink
Reduce buildFields function call
Browse files Browse the repository at this point in the history
  • Loading branch information
sunfish-shogi committed Jan 16, 2024
1 parent cad7ae8 commit dd60972
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions mp4.go
Original file line number Diff line number Diff line change
Expand Up @@ -100,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-- {
Expand All @@ -111,11 +113,10 @@ func (boxType BoxType) getBoxDef(ctx Context) *boxDef {
if ctx.UnderIlst {
typeID := int(binary.BigEndian.Uint32(boxType[:]))
if typeID >= 1 && typeID <= ctx.QuickTimeKeysMetaEntryCount {
payload := &Item{}
return &boxDef{
dataType: reflect.TypeOf(payload).Elem(),
dataType: reflect.TypeOf(Item{}),
isTarget: isIlstMetaContainer,
fields: buildFields(payload),
fields: itemBoxFields,
}
}
}
Expand Down

0 comments on commit dd60972

Please sign in to comment.