Skip to content

Commit 70b1b0d

Browse files
committed
mp4: Decode uinf box
1 parent a3f5e29 commit 70b1b0d

File tree

3 files changed

+31
-0
lines changed

3 files changed

+31
-0
lines changed

format/mp4/boxes.go

+9
Original file line numberDiff line numberDiff line change
@@ -1823,6 +1823,15 @@ func decodeBox(ctx *decodeContext, d *decode.D, typ string) {
18231823
d.FieldRawLen("signature", 4*8, d.AssertBitBuf([]byte{0x0d, 0x0a, 0x87, 0x0a}))
18241824
case "jp2c":
18251825
d.FieldFormat("segments", &jp2cGroup, nil)
1826+
case "uinf":
1827+
decodeBoxes(ctx, d)
1828+
case "ulst":
1829+
nu := d.FieldU16("nu")
1830+
d.FieldArray("uids", func(d *decode.D) {
1831+
for i := 0; i < int(nu); i++ {
1832+
d.FieldRawLen("uid", 128)
1833+
}
1834+
})
18261835

18271836
default:
18281837
// there are at least 4 ways to encode udta metadata in mov/mp4 files.

format/mp4/testdata/uinf.mp4

100 Bytes
Binary file not shown.

format/mp4/testdata/uinf.mp4.fqtest

+22
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
$ fq -d mp4 -o force=true dv uinf.mp4
2+
|00 01 02 03 04 05 06 07 08 09 0a 0b 0c 0d 0e 0f|0123456789abcdef|.{}: uinf.mp4 (mp4) 0x0-0x64 (100)
3+
| | | boxes[0:1]: 0x0-0x64 (100)
4+
| | | [0]{}: box 0x0-0x64 (100)
5+
0x00|00 00 00 64 |...d | size: 100 0x0-0x4 (4)
6+
0x00| 75 69 6e 66 | uinf | type: "uinf" (A tool by which a vendor may provide access to additional information associated with a UUID) 0x4-0x8 (4)
7+
| | | boxes[0:2]: 0x8-0x64 (92)
8+
| | | [0]{}: box 0x8-0x32 (42)
9+
0x00| 00 00 00 2a | ...* | size: 42 0x8-0xc (4)
10+
0x00| 75 6c 73 74| ulst| type: "ulst" (A list of UUID’s) 0xc-0x10 (4)
11+
0x10|00 02 |.. | nu: 2 0x10-0x12 (2)
12+
| | | uids[0:2]: 0x12-0x32 (32)
13+
0x10| 6a 70 6a 70 6a 70 6a 70 6a 70 6a 70 6a 70| jpjpjpjpjpjpjp| [0]: raw bits uid 0x12-0x22 (16)
14+
0x20|6a 70 |jp |
15+
0x20| 61 62 61 62 61 62 61 62 61 62 61 62 61 62| ababababababab| [1]: raw bits uid 0x22-0x32 (16)
16+
0x30|61 62 |ab |
17+
| | | [1]{}: box 0x32-0x64 (50)
18+
0x30| 00 00 00 32 | ...2 | size: 50 0x32-0x36 (4)
19+
0x30| 75 72 6c 20 | url | type: "url" (A URL) 0x36-0x3a (4)
20+
0x30| 00 00 00 00 68 74| ....ht| data: raw bits 0x3a-0x64 (42)
21+
0x40|74 70 3a 2f 2f 77 77 77 2e 6f 70 65 6e 70 6c 61|tp://www.openpla|
22+
* |until 0x63.7 (end) (42) | |

0 commit comments

Comments
 (0)