mirror of
https://github.com/h2non/filetype.git
synced 2025-12-24 11:52:08 +08:00
fix(isobmff): format issues, again
This commit is contained in:
@@ -18,17 +18,17 @@ func IsISOBMFF(buf []byte) bool {
|
||||
// GetFtyp returns the major brand, minor version and compatible brands of the ISO-BMFF data
|
||||
func GetFtyp(buf []byte) (string, string, []string) {
|
||||
if len(buf) < 17 {
|
||||
return "", "", []string{""}
|
||||
return "", "", []string{""}
|
||||
}
|
||||
|
||||
ftypLength := binary.BigEndian.Uint32(buf[0:4])
|
||||
ftypLength := binary.BigEndian.Uint32(buf[0:4])
|
||||
|
||||
majorBrand := string(buf[8:12])
|
||||
minorVersion := string(buf[12:16])
|
||||
|
||||
compatibleBrands := []string{}
|
||||
for i := 16; i < int(ftypLength); i += 4 {
|
||||
if len(buf) >= (i+4) {
|
||||
if len(buf) >= (i + 4) {
|
||||
compatibleBrands = append(compatibleBrands, string(buf[i:i+4]))
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user