1
1
mirror of https://github.com/wader/fq.git synced 2024-12-25 06:12:30 +03:00

Merge pull request #207 from wader/mp4-more-heif-boxes

mp4: Add some more HEIF boxes
This commit is contained in:
Mattias Wadman 2022-03-23 21:48:00 +01:00 committed by GitHub
commit fdb0e83f10
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 81 additions and 5 deletions

View File

@ -1299,5 +1299,54 @@ func init() {
d.FieldRawLen("data", d.BitsLeft())
}
},
"ispe": func(_ *decodeContext, d *decode.D) {
d.FieldU8("version")
d.FieldU24("flags")
d.FieldU32("image_width")
d.FieldU32("image_height")
},
"ipma": func(_ *decodeContext, d *decode.D) {
version := d.FieldU8("version")
flags := d.FieldU24("flags")
entryCount := d.FieldU32("entry_count")
d.FieldArray("entries", func(d *decode.D) {
for i := uint64(0); i < entryCount; i++ {
d.FieldStruct("entry", func(d *decode.D) {
if version < 1 {
d.FieldU16("item_id")
} else {
d.FieldU32("item_id")
}
associationCount := d.FieldU8("association_count")
d.FieldArray("associations", func(d *decode.D) {
for j := uint64(0); j < associationCount; j++ {
d.FieldStruct("association", func(d *decode.D) {
d.FieldBool("essential")
if flags&0b1 != 0 {
d.FieldU15("property_index")
} else {
d.FieldU7("item_id")
}
})
}
})
})
}
})
},
"pitm": func(_ *decodeContext, d *decode.D) {
version := d.FieldU8("version")
d.FieldU24("flags")
if version < 1 {
d.FieldU16("item_id")
} else {
d.FieldU32("item_id")
}
},
"iref": func(ctx *decodeContext, d *decode.D) {
d.FieldU8("version")
d.FieldU24("flags")
decodeBoxes(ctx, d)
},
}
}

View File

@ -11,6 +11,7 @@ var boxDescriptions = scalar.StrToScalar{
"angl": {Description: "Name of the camera angle through which the clip was shot"},
"assp": {Description: "Alternative startup sequence properties"},
"auth": {Description: "Author of the media"},
"auxC": {Description: "Image properties for auxiliary images clap clean aperture"},
"avcn": {Description: "AVC NAL Unit Storage Box"},
"bidx": {Description: "Box Index"},
"bloc": {Description: "Base location and purchase location for license acquisition"},
@ -98,6 +99,8 @@ var boxDescriptions = scalar.StrToScalar{
"ipro": {Description: "Item protection"},
"iprp": {Description: "Item Properties Box"},
"iref": {Description: "Item reference"},
"irot": {Description: "Image rotation imir image mirroring"},
"ispe": {Description: "Image spatial extents"},
"j2kH": {Description: "JPEG 2000 header item property"},
"jP ": {Description: "JPEG 2000 Signature"},
"jp2c": {Description: "JPEG 2000 contiguous codestream"},
@ -160,6 +163,7 @@ var boxDescriptions = scalar.StrToScalar{
"pfhd": {Description: "Partial File Header"},
"pfil": {Description: "Partial File"},
"pitm": {Description: "Primary item reference"},
"pixi": {Description: "Pixel information"},
"ploc": {Description: "Partial Segment Location"},
"pnot": {Description: "Preview container"},
"prft": {Description: "Producer reference time"},
@ -172,6 +176,7 @@ var boxDescriptions = scalar.StrToScalar{
"resc": {Description: "Grid resolution at which the image was captured"},
"resd": {Description: "Default grid resolution at which the image should be displayed"},
"rinf": {Description: "Restricted scheme information box"},
"rloc": {Description: "Relative location"},
"rtng": {Description: "Media rating"},
"saio": {Description: "Sample auxiliary information offsets"},
"saiz": {Description: "Sample auxiliary information sizes"},

View File

@ -74,8 +74,11 @@ $ fq -d mp4 dv /heic.mp4
| | | boxes[0:4]: 0xac-0x154.7 (169)
| | | [0]{}: box 0xac-0xbf.7 (20)
0x0a0| 00 00 00 14| ....| size: 20 0xac-0xaf.7 (4)
0x0b0|69 73 70 65 |ispe | type: "ispe" 0xb0-0xb3.7 (4)
0x0b0| 00 00 00 00 00 00 00 10 00 00 00 10| ............| data: raw bits 0xb4-0xbf.7 (12)
0x0b0|69 73 70 65 |ispe | type: "ispe" (Image spatial extents) 0xb0-0xb3.7 (4)
0x0b0| 00 | . | version: 0 0xb4-0xb4.7 (1)
0x0b0| 00 00 00 | ... | flags: 0 0xb5-0xb7.7 (3)
0x0b0| 00 00 00 10 | .... | image_width: 16 0xb8-0xbb.7 (4)
0x0b0| 00 00 00 10| ....| image_height: 16 0xbc-0xbf.7 (4)
| | | [1]{}: box 0xc0-0xcf.7 (16)
0x0c0|00 00 00 10 |.... | size: 16 0xc0-0xc3.7 (4)
0x0c0| 70 61 73 70 | pasp | type: "pasp" (Pixel aspect ratio) 0xc4-0xc7.7 (4)
@ -158,14 +161,33 @@ $ fq -d mp4 dv /heic.mp4
0x140| c1 73 d8 89 | .s.. | data: raw bits 0x141-0x144.7 (4)
| | | [3]{}: box 0x145-0x154.7 (16)
0x140| 00 00 00 10 | .... | size: 16 0x145-0x148.7 (4)
0x140| 70 69 78 69 | pixi | type: "pixi" 0x149-0x14c.7 (4)
0x140| 70 69 78 69 | pixi | type: "pixi" (Pixel information) 0x149-0x14c.7 (4)
0x140| 00 00 00| ...| data: raw bits 0x14d-0x154.7 (8)
0x150|00 03 08 08 08 |..... |
| | | [1]{}: box 0x155-0x16b.7 (23)
0x150| 00 00 00 17 | .... | size: 23 0x155-0x158.7 (4)
0x150| 69 70 6d 61 | ipma | type: "ipma" (ItemPropertyAssociation) 0x159-0x15c.7 (4)
0x150| 00 00 00| ...| data: raw bits 0x15d-0x16b.7 (15)
0x160|00 00 00 00 01 00 01 04 01 02 83 84 |............ |
0x150| 00 | . | version: 0 0x15d-0x15d.7 (1)
0x150| 00 00| ..| flags: 0 0x15e-0x160.7 (3)
0x160|00 |. |
0x160| 00 00 00 01 | .... | entry_count: 1 0x161-0x164.7 (4)
| | | entries[0:1]: 0x165-0x16b.7 (7)
| | | [0]{}: entry 0x165-0x16b.7 (7)
0x160| 00 01 | .. | item_id: 1 0x165-0x166.7 (2)
0x160| 04 | . | association_count: 4 0x167-0x167.7 (1)
| | | associations[0:4]: 0x168-0x16b.7 (4)
| | | [0]{}: association 0x168-0x168.7 (1)
0x160| 01 | . | essential: false 0x168-0x168 (0.1)
0x160| 01 | . | item_id: 1 0x168.1-0x168.7 (0.7)
| | | [1]{}: association 0x169-0x169.7 (1)
0x160| 02 | . | essential: false 0x169-0x169 (0.1)
0x160| 02 | . | item_id: 2 0x169.1-0x169.7 (0.7)
| | | [2]{}: association 0x16a-0x16a.7 (1)
0x160| 83 | . | essential: true 0x16a-0x16a (0.1)
0x160| 83 | . | item_id: 3 0x16a.1-0x16a.7 (0.7)
| | | [3]{}: association 0x16b-0x16b.7 (1)
0x160| 84 | . | essential: true 0x16b-0x16b (0.1)
0x160| 84 | . | item_id: 4 0x16b.1-0x16b.7 (0.7)
| | | [2]{}: box 0x16c-0xaf2.7 (2439)
0x160| 00 00 09 87| ....| size: 2439 0x16c-0x16f.7 (4)
0x170|6d 64 61 74 |mdat | type: "mdat" (Media data container) 0x170-0x173.7 (4)