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

Deprecated boxes support #106

Open
wants to merge 5 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 4 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
21 changes: 20 additions & 1 deletion data/schemas/standard.schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,9 @@
"fourcc": {
"type": "string"
},
"deprecated": {
"type": "boolean"
},
"description": {
"type": "string"
},
Expand Down Expand Up @@ -104,7 +107,23 @@
}
}
},
"required": ["fourcc", "description", "type", "containers", "syntax"]
"required": ["fourcc"],
"allOf": [
{
"if": {
"properties": {
"deprecated": {
"not": {
"const": true
}
}
}
},
"then": {
"required": ["description", "type", "containers", "syntax"]
}
}
]
},
"minItems": 1
}
Expand Down
25 changes: 25 additions & 0 deletions data/standard_features/14496-12/boxes.json
Original file line number Diff line number Diff line change
Expand Up @@ -1492,6 +1492,31 @@
],
"type": "Box",
"syntax": "class URIBox extends FullBox('uri ', version = 0, 0) {\n\tutf8string theURI;\n}"
},
{
"fourcc": "mere",
"description": "Metabox Relation box",
"deprecated": true
},
{
"fourcc": "meco",
"description": "Additional metadata container box",
"deprecated": true
},
{
"fourcc": "imif",
"description": "IPMPInfoBox",
"deprecated": true
},
{
"fourcc": "ipmc",
"description": "IPMP control box",
"deprecated": true
},
{
"fourcc": "stsl",
"description": "Sample scale box",
"deprecated": true
}
]
}
14 changes: 10 additions & 4 deletions src/construct/boxes.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
from common import get_mp4ra_boxes

BOXES = {}
DEPRECATED_BOXES = set()
EXTENSIONS = {}
TYPE_HIERARCHY = {}

Expand Down Expand Up @@ -76,6 +77,11 @@ def get_all_boxes(json_file):
_spec = os.path.basename(os.path.dirname(json_file))

for entry in entries:
# Handle deprecated boxes
if "deprecated" in entry and entry["deprecated"]:
DEPRECATED_BOXES.add(entry["fourcc"])
continue

_boxes.add(
Box(
fourcc=entry["fourcc"],
Expand Down Expand Up @@ -343,10 +349,9 @@ def main():
if _box.fourcc not in get_mp4ra_boxes():
buffer.append(_box.fourcc)

buffer = set(buffer) - DEPRECATED_BOXES
if len(buffer) > 0:
logger.warning(
f"Missing boxes in MP4RA ({len(set(buffer))}): {set(sorted(buffer))}"
)
logger.warning(f"Missing boxes in MP4RA ({len(buffer)}): {sorted(buffer)}")

# Check missing boxes in standard features
all_fourccs = set(_box.fourcc for _box in all_boxes)
Expand All @@ -355,10 +360,11 @@ def main():
if _box not in all_fourccs:
buffer.append(_box)

buffer = set(buffer) - DEPRECATED_BOXES
# FIXME: This should be an error
if len(buffer) > 0:
logger.warning(
f"Missing boxes in standard features ({len(set(buffer))}): {set(sorted(buffer))}"
f"Missing boxes in standard features ({len(buffer)}): {sorted(buffer)}"
)

# Sort all boxes by fourcc
Expand Down
Loading