Commit 9e456d8
Parse colr box CICP data for video tracks
Add parsing of the ISO BMFF `colr` box (ISO 14496-12:2020 §12.1.5) in
`read_video_sample_entry`, storing the result in a new `colour_info` field
on `VideoSampleEntry`. Expose the nclx CICP values through the C API via
four new fields on `Mp4parseTrackVideoSampleInfo`: `has_colour_info`,
`colour_primaries`, `transfer_characteristics`, `matrix_coefficients`, and
`full_range_flag`.
This enables Firefox's MP4 demuxer to set `mVideoInfo.mTransferFunction`
for fMP4 content (Netflix, Prime Video, DRM), fixing HDR10/HLG video
appearing near-black on Windows HDR displays.
- `read_video_sample_entry` now takes `strictness` (consistent with
`read_audio_sample_entry`) and passes it to `read_colr`.
- Duplicate `colr` boxes in a sample entry violate ISO 14496-12:2020
§12.1.5; we warn and keep the first rather than failing playback.
- `has_colour_info: bool` is the canonical "present" flag; avoids
misinterpreting MC=0 (Identity/GBR) as "absent".
- `NclxColourInformation` fields made public for Rust callers.
- Seven integration tests added. Test MP4 files were generated with ffmpeg
using `-movflags +write_colr` and `-x264-params colorprim/transfer/colormatrix`:
HDR10 (cp=9,tc=16,mc=9), HLG (tc=18), HDR10 full-range, HLG full-range,
RGB/Identity (mc=0, exercises has_colour_info), and no-colr variants.1 parent c6f33df commit 9e456d8
9 files changed
Lines changed: 208 additions & 10 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1175 | 1175 | | |
1176 | 1176 | | |
1177 | 1177 | | |
| 1178 | + | |
1178 | 1179 | | |
1179 | 1180 | | |
1180 | 1181 | | |
| |||
3722 | 3723 | | |
3723 | 3724 | | |
3724 | 3725 | | |
3725 | | - | |
3726 | | - | |
3727 | | - | |
3728 | | - | |
| 3726 | + | |
| 3727 | + | |
| 3728 | + | |
| 3729 | + | |
3729 | 3730 | | |
3730 | 3731 | | |
3731 | 3732 | | |
| |||
5533 | 5534 | | |
5534 | 5535 | | |
5535 | 5536 | | |
5536 | | - | |
| 5537 | + | |
| 5538 | + | |
| 5539 | + | |
| 5540 | + | |
5537 | 5541 | | |
5538 | 5542 | | |
5539 | 5543 | | |
| |||
5567 | 5571 | | |
5568 | 5572 | | |
5569 | 5573 | | |
| 5574 | + | |
5570 | 5575 | | |
5571 | 5576 | | |
5572 | 5577 | | |
| |||
5683 | 5688 | | |
5684 | 5689 | | |
5685 | 5690 | | |
| 5691 | + | |
| 5692 | + | |
| 5693 | + | |
| 5694 | + | |
| 5695 | + | |
| 5696 | + | |
| 5697 | + | |
| 5698 | + | |
| 5699 | + | |
| 5700 | + | |
| 5701 | + | |
| 5702 | + | |
| 5703 | + | |
5686 | 5704 | | |
5687 | 5705 | | |
5688 | 5706 | | |
| |||
5701 | 5719 | | |
5702 | 5720 | | |
5703 | 5721 | | |
| 5722 | + | |
5704 | 5723 | | |
5705 | 5724 | | |
5706 | 5725 | | |
| |||
5908 | 5927 | | |
5909 | 5928 | | |
5910 | 5929 | | |
5911 | | - | |
5912 | | - | |
5913 | | - | |
| 5930 | + | |
| 5931 | + | |
| 5932 | + | |
5914 | 5933 | | |
5915 | 5934 | | |
5916 | 5935 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1145 | 1145 | | |
1146 | 1146 | | |
1147 | 1147 | | |
1148 | | - | |
| 1148 | + | |
| 1149 | + | |
1149 | 1150 | | |
1150 | 1151 | | |
1151 | 1152 | | |
| |||
1245 | 1246 | | |
1246 | 1247 | | |
1247 | 1248 | | |
1248 | | - | |
| 1249 | + | |
1249 | 1250 | | |
1250 | 1251 | | |
1251 | 1252 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
264 | 264 | | |
265 | 265 | | |
266 | 266 | | |
| 267 | + | |
| 268 | + | |
| 269 | + | |
| 270 | + | |
| 271 | + | |
| 272 | + | |
| 273 | + | |
| 274 | + | |
| 275 | + | |
| 276 | + | |
| 277 | + | |
| 278 | + | |
267 | 279 | | |
268 | 280 | | |
269 | 281 | | |
| |||
1120 | 1132 | | |
1121 | 1133 | | |
1122 | 1134 | | |
| 1135 | + | |
| 1136 | + | |
| 1137 | + | |
| 1138 | + | |
| 1139 | + | |
| 1140 | + | |
| 1141 | + | |
| 1142 | + | |
1123 | 1143 | | |
1124 | 1144 | | |
1125 | 1145 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
| 122 | + | |
| 123 | + | |
| 124 | + | |
| 125 | + | |
| 126 | + | |
| 127 | + | |
| 128 | + | |
| 129 | + | |
| 130 | + | |
| 131 | + | |
| 132 | + | |
| 133 | + | |
| 134 | + | |
| 135 | + | |
| 136 | + | |
| 137 | + | |
| 138 | + | |
| 139 | + | |
| 140 | + | |
| 141 | + | |
| 142 | + | |
| 143 | + | |
| 144 | + | |
| 145 | + | |
| 146 | + | |
| 147 | + | |
| 148 | + | |
| 149 | + | |
| 150 | + | |
| 151 | + | |
| 152 | + | |
| 153 | + | |
| 154 | + | |
| 155 | + | |
| 156 | + | |
| 157 | + | |
| 158 | + | |
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
0 commit comments