mirror of
https://github.com/wader/fq.git
synced 2024-09-11 12:05:39 +03:00
Merge pull request #832 from wader/mp4-ctts-signed
mp4: ctts v0 sample_offset seems to be signed in practice
This commit is contained in:
commit
ebf809c045
@ -878,10 +878,10 @@ func decodeBox(ctx *decodeContext, d *decode.D, typ string) {
|
||||
var i uint64
|
||||
d.FieldStructArrayLoop("entries", "entry", func() bool { return i < entryCount }, func(d *decode.D) {
|
||||
d.FieldS32("sample_count")
|
||||
// ISO/IEC14496-12 says version 0 is unsigned and version 1 is signed
|
||||
// in preactice it seems muxers write it as signed for both version
|
||||
switch version {
|
||||
case 0:
|
||||
d.FieldU32("sample_offset")
|
||||
case 1:
|
||||
case 0, 1:
|
||||
d.FieldS32("sample_offset")
|
||||
}
|
||||
i++
|
||||
|
BIN
format/mp4/testdata/ctts_v0_signed
vendored
Normal file
BIN
format/mp4/testdata/ctts_v0_signed
vendored
Normal file
Binary file not shown.
22
format/mp4/testdata/ctts_v0_signed.fqtest
vendored
Normal file
22
format/mp4/testdata/ctts_v0_signed.fqtest
vendored
Normal file
@ -0,0 +1,22 @@
|
||||
$ fq -d mp4 -o force=true dv ctts_v0_signed
|
||||
|00 01 02 03 04 05 06 07 08 09 0a 0b 0c 0d 0e 0f|0123456789abcdef|.{}: ctts_v0_signed (mp4) 0x0-0x30 (48)
|
||||
| | | boxes[0:1]: 0x0-0x30 (48)
|
||||
| | | [0]{}: box 0x0-0x30 (48)
|
||||
0x00|00 00 00 30 |...0 | size: 48 0x0-0x4 (4)
|
||||
0x00| 63 74 74 73 | ctts | type: "ctts" (Composition time to sample) 0x4-0x8 (4)
|
||||
0x00| 00 | . | version: 0 0x8-0x9 (1)
|
||||
0x00| 00 00 00 | ... | flags: 0 0x9-0xc (3)
|
||||
0x00| 00 00 00 04| ....| entry_count: 4 0xc-0x10 (4)
|
||||
| | | entries[0:4]: 0x10-0x30 (32)
|
||||
| | | [0]{}: entry 0x10-0x18 (8)
|
||||
0x10|00 00 00 01 |.... | sample_count: 1 0x10-0x14 (4)
|
||||
0x10| 00 00 00 0a | .... | sample_offset: 10 0x14-0x18 (4)
|
||||
| | | [1]{}: entry 0x18-0x20 (8)
|
||||
0x10| 00 00 00 01 | .... | sample_count: 1 0x18-0x1c (4)
|
||||
0x10| ff ff ff f6| ....| sample_offset: -10 0x1c-0x20 (4)
|
||||
| | | [2]{}: entry 0x20-0x28 (8)
|
||||
0x20|00 00 00 01 |.... | sample_count: 1 0x20-0x24 (4)
|
||||
0x20| 00 00 00 0a | .... | sample_offset: 10 0x24-0x28 (4)
|
||||
| | | [3]{}: entry 0x28-0x30 (8)
|
||||
0x20| 00 00 00 01 | .... | sample_count: 1 0x28-0x2c (4)
|
||||
0x20| ff ff ff f6| ....| sample_offset: -10 0x2c-0x30 (4)
|
Loading…
Reference in New Issue
Block a user