Skip to content

Commit

Permalink
fix #86: ComplianceWarden does not complain about files where entries…
Browse files Browse the repository at this point in the history
… in 'iinf' is not sorted according to item ID
  • Loading branch information
rbouqueau committed Jan 3, 2025
1 parent cf0dfc4 commit 6b71bec
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 1 deletion.
27 changes: 27 additions & 0 deletions src/specs/isobmff/isobmff.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -651,6 +651,33 @@ const SpecDesc specIsobmff = {

auto boxes = findBoxes(root, FOURCC("hdlr"));

for(auto box : boxes)
check(box);
} },
{ "Section 8.11.6.1\n"
"'iinf box': contains an array of entries, and each entry is formatted as a box. This array\n"
" is sorted by increasing item_ID in the entry records.",
[](Box const &root, IReport *out) {
uint32_t lastItemId = 0;

auto check = [&](const Box *box) {
for(auto &iinfChild : box->children)
if(iinfChild.fourcc == FOURCC("infe")) {
for(auto &sym : iinfChild.syms) {
if(!strcmp(sym.name, "item_ID")) {
if(sym.value <= lastItemId)
out->error(
"'iinf box' entry: previous item_ID(%u) shall be less than current(%u)", lastItemId,
(uint32_t)sym.value);
else
lastItemId = sym.value;
}
}
}
};

auto boxes = findBoxes(root, FOURCC("iinf"));

for(auto box : boxes)
check(box);
} },
Expand Down
7 changes: 6 additions & 1 deletion tests/isobmff/invalid-ipma.ref
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,10 @@ MPEG-4 part 12 - ISO/IEC 14496-12 - m17277 (6th+FDAM1+FDAM2+COR1-R4)
[isobmff][Rule #5] Error: Each ItemPropertyAssociationBox shall be ordered by increasing item_ID (1, last=2)
[isobmff][Rule #5] Error: Each ItemPropertyAssociationBox shall be ordered by increasing item_ID (1, last=1)
[isobmff][Rule #5] Error: There shall be at most one occurrence of a given item_ID but item_ID=1 found several times
[isobmff][Rule #17] Error: 'iinf box' entry: previous item_ID(2) shall be less than current(1)

========================================
[isobmff] 3 error(s), 0 warning(s).
[isobmff] 4 error(s), 0 warning(s).
========================================

===== Involved rules descriptions:
Expand All @@ -20,3 +21,7 @@ Each ItemPropertyAssociationBox shall be ordered by increasing item_ID,
and there shall be at most one occurrence of a given item_ID, in the set of
ItemPropertyAssociationBox boxes

[isobmff][Rule #17] Section 8.11.6.1
'iinf box': contains an array of entries, and each entry is formatted as a box. This array
is sorted by increasing item_ID in the entry records.

0 comments on commit 6b71bec

Please sign in to comment.