Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixes for boxes.py checks #65

Merged
merged 2 commits into from
Sep 1, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
33 changes: 26 additions & 7 deletions src/construct/boxes.py
Original file line number Diff line number Diff line change
Expand Up @@ -211,11 +211,20 @@ def main():
for container in _box.containers:
if isinstance(container, dict):
if "type" in container:
if container["type"] not in [_box.type for _box in all_boxes]:
# Ignore '*'
if container["type"] == "*":
continue
buffer.append(f"{container['type']}")
# If type is already in all_boxes, skip
if container["type"] in [_box.type for _box in all_boxes]:
continue

# If type is in TYPE_HIERARCHY, skip
if container["type"] in TYPE_HIERARCHY:
continue

# If type is *, skip
if container["type"] == "*":
continue

# Could not find the type
buffer.append(f"{container['type']}")

if len(buffer) > 0:
logger.error(f"Unknown types ({len(set(buffer))}): {set(sorted(buffer))}")
Expand Down Expand Up @@ -260,12 +269,22 @@ def main():
if _box.type == "":
buffer.append(f"{_box.fourcc} ({_box.type})")

# FIXME: This should be an error
if len(buffer) > 0:
logger.warning(
logger.error(
f"Boxes with empty type ({len(set(buffer))}): {set(sorted(buffer))}"
)

# Show boxes with empty fourcc
buffer = []
for _box in all_boxes:
if _box.incomplete:
continue
if _box.fourcc == "":
buffer.append(f"{_box.fourcc} ({_box.type})")

if len(buffer) > 0:
logger.error(f"There are {len(set(buffer))} box(es) with empty fourcc")

# Show duplicates (same fourcc)
buffer = []
for _box in all_boxes:
Expand Down
Loading