Merge branch 'feat-hjj-FileExpand' into dev
This commit is contained in:
commit
8a99771951
@ -484,6 +484,22 @@ func isLikelyMP4(b []byte) bool {
|
||||
}
|
||||
// 找到 ftyp 就放行(只做基本合法性检查)
|
||||
if typ == "ftyp" {
|
||||
|
||||
major := b[i+int(hdr) : i+int(hdr)+4]
|
||||
minor := binary.BigEndian.Uint32(b[i+int(hdr)+4 : i+int(hdr)+8])
|
||||
compatStart := i + int(hdr) + 8
|
||||
compatEnd := i + int(size)
|
||||
if compatEnd > len(b) {
|
||||
compatEnd = len(b)
|
||||
}
|
||||
brands := make([]string, 0, 5)
|
||||
for j := compatStart; j+4 <= compatEnd && len(brands) < 5; j += 4 {
|
||||
brands = append(brands, string(b[j:j+4]))
|
||||
}
|
||||
fmt.Printf("ftyp found: offset=%d size=%d hdr=%d major=%q minor=%d compatTop5=%v\n",
|
||||
i, size, hdr, string(major), minor, brands,
|
||||
)
|
||||
|
||||
if size < 16 {
|
||||
return false
|
||||
}
|
||||
@ -491,7 +507,6 @@ func isLikelyMP4(b []byte) bool {
|
||||
if i+int(hdr)+8 > len(b) {
|
||||
return false
|
||||
}
|
||||
major := b[i+int(hdr) : i+int(hdr)+4]
|
||||
// fourcc 通常都是可打印字符(允许空格0x20)
|
||||
for _, c := range major {
|
||||
if c == 0x00 {
|
||||
|
||||
Loading…
Reference in New Issue
Block a user