1
1
mirror of https://github.com/wader/fq.git synced 2024-10-04 23:48:00 +03:00

mp4: Fix 64bit size regression

This commit is contained in:
Mattias Wadman 2021-11-23 11:24:09 +01:00
parent e6cb708d38
commit e47888e24c
3 changed files with 18 additions and 0 deletions

View File

@ -126,6 +126,7 @@ func decodeBox(ctx *decodeContext, d *decode.D) {
case boxSizeRestOfFile:
dataSize = uint64(d.Len()-d.Pos()) / 8
case boxSizeUse64bitSize:
boxSize = d.FieldU64("size64")
dataSize = boxSize - 16
default:
dataSize = boxSize - 8

BIN
format/mp4/testdata/size64 vendored Normal file

Binary file not shown.

17
format/mp4/testdata/size64.fqtest vendored Normal file
View File

@ -0,0 +1,17 @@
# ffmpeg -y -f lavfi -i anoisesrc -lpc_passes 1 -strict -2 -c:a flac -t 50000s size64.mp4
# fq -d raw 'tobytes[0:100]' size64.mp4 > size64
# TODO: test that don't uses decode failure?
$ fq -d mp4 '.boxes[] | d' /size64
|00 01 02 03 04 05 06 07 08 09 0a 0b 0c 0d 0e 0f|0123456789abcdef|.boxes[0]: {}
0x00|00 00 00 1c |.... | size: 28
0x00| 66 74 79 70 | ftyp | type: "ftyp" (File type and compatibility)
0x00| 69 73 6f 6d | isom | major_brand: "isom"
0x00| 00 00 02 00| ....| minor_version: 512
| | | brands: [3]
0x10|69 73 6f 6d |isom | [0]: "isom" (All files based on the ISO Base Media File Format)
0x10| 69 73 6f 32 | iso2 | [1]: "iso2" (All files based on the 2004 edition of the ISO file format)
0x10| 6d 70 34 31 | mp41 | [2]: "mp41" (MP4 version 1)
|00 01 02 03 04 05 06 07 08 09 0a 0b 0c 0d 0e 0f|0123456789abcdef|.boxes[1]: {}
0x10| 00 00 00 01| ....| size: 1 (Use 64 bit size)
0x20|6d 64 61 74 |mdat | type: "mdat" (Media data container)
0x20| 00 00 00 01 ad 85 9d aa | ........ | size64: 7206182314