Skip to content

Commit

Permalink
Merge pull request #161 from abema/update-getboxdef
Browse files Browse the repository at this point in the history
Reduce buildFields function call
  • Loading branch information
sunfish-shogi committed Jan 16, 2024
2 parents cad7ae8 + dd60972 commit 0341140
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 0341140

Please sign in to comment.