1
1
mirror of https://github.com/wader/fq.git synced 2024-12-23 13:22:58 +03:00

Merge pull request #524 from wader/mp4-pdin-box

mp4: Add pdin box support
This commit is contained in:
Mattias Wadman 2022-12-15 11:57:52 +01:00 committed by GitHub
commit f092bff1ac
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 23 additions and 0 deletions

View File

@ -1622,6 +1622,17 @@ func decodeBox(ctx *decodeContext, d *decode.D, typ string) {
decodeBoxes(ctx, d)
case "hint":
decodeBoxes(ctx, d)
case "pdin":
d.FieldU8("version")
d.FieldU24("flags")
d.FieldArray("entries", func(d *decode.D) {
for !d.End() {
d.FieldStruct("entry", func(d *decode.D) {
d.FieldU32("rate")
d.FieldU32("initial_delay")
})
}
})
default:
if mb := ctx.currentMetaBox(); mb != nil && ctx.parent().typ == "ilst" {
// unknown type inside a metadata box with ilst as parent, decode item boxes

12
format/mp4/testdata/pdin_box.fqtest vendored Normal file
View File

@ -0,0 +1,12 @@
$ fq -o force=true '"000000147064696e00000000003087ca00000000" | fromhex | mp4 | dv'
|00 01 02 03 04 05 06 07 08 09 0a 0b 0c 0d 0e 0f|0123456789abcdef|.{}: (mp4) 0x0-0x13.7 (20)
| | | boxes[0:1]: 0x0-0x13.7 (20)
| | | [0]{}: box 0x0-0x13.7 (20)
0x00|00 00 00 14 |.... | size: 20 0x0-0x3.7 (4)
0x00| 70 64 69 6e | pdin | type: "pdin" (Progressive download information) 0x4-0x7.7 (4)
0x00| 00 | . | version: 0 0x8-0x8.7 (1)
0x00| 00 00 00 | ... | flags: 0 0x9-0xb.7 (3)
| | | entries[0:1]: 0xc-0x13.7 (8)
| | | [0]{}: entry 0xc-0x13.7 (8)
0x00| 00 30 87 ca| .0..| rate: 3180490 0xc-0xf.7 (4)
0x10|00 00 00 00| |....| | initial_delay: 0 0x10-0x13.7 (4)