Skip to content

Commit

Permalink
mp4: sidx version 1 segment_duration is s64
Browse files Browse the repository at this point in the history
  • Loading branch information
wader committed Dec 5, 2022
1 parent e17355b commit a23fe61
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 10 deletions.
20 changes: 10 additions & 10 deletions format/mp4/boxes.go
Expand Up @@ -400,16 +400,16 @@ func init() {
entryCount := d.FieldU32("entry_count")
var i uint64
d.FieldStructArrayLoop("entries", "entry", func() bool { return i < entryCount }, func(d *decode.D) {
d.FieldS32("segment_duration")
d.FieldSFn("media_time", func(d *decode.D) int64 {
var t int64
if version == 0 {
t = d.S32()
} else {
t = d.S64()
}
return t
}, mediaTimeNames)
switch version {
case 0:
d.FieldS32("segment_duration")
d.FieldS32("media_time", mediaTimeNames)
case 1:
d.FieldS64("segment_duration")
d.FieldS64("media_time", mediaTimeNames)
default:
return
}
d.FieldFP32("media_rate")
i++
})
Expand Down
Binary file added format/mp4/testdata/mp4-elst-version1
Binary file not shown.
14 changes: 14 additions & 0 deletions format/mp4/testdata/mp4-elst-version1.fqtest
@@ -0,0 +1,14 @@
$ fq -d mp4 -o force=true dv mp4-elst-version1
|00 01 02 03 04 05 06 07 08 09 0a 0b 0c 0d 0e 0f|0123456789abcdef|.{}: mp4-elst-version1 (mp4) 0x0-0x23.7 (36)
| | | boxes[0:1]: 0x0-0x23.7 (36)
| | | [0]{}: box 0x0-0x23.7 (36)
0x00|00 00 00 24 |...$ | size: 36 0x0-0x3.7 (4)
0x00| 65 6c 73 74 | elst | type: "elst" (An edit list) 0x4-0x7.7 (4)
0x00| 01 | . | version: 1 0x8-0x8.7 (1)
0x00| 00 00 00 | ... | flags: 0 0x9-0xb.7 (3)
0x00| 00 00 00 01| ....| entry_count: 1 0xc-0xf.7 (4)
| | | entries[0:1]: 0x10-0x23.7 (20)
| | | [0]{}: entry 0x10-0x23.7 (20)
0x10|00 00 00 00 00 00 00 00 |........ | segment_duration: 0 0x10-0x17.7 (8)
0x10| 00 00 00 00 00 00 04 20| ....... | media_time: 1056 0x18-0x1f.7 (8)
0x20|00 01 00 00| |....| | media_rate: 1 0x20-0x23.7 (4)

0 comments on commit a23fe61

Please sign in to comment.