Add new box that contain a fullbox
Opened this issue · 1 comments
TimYao18 commented
Hi, I want to add a new box 'grpl' and I write it as below.
I added it into init.py, but I don't know what's wrong that it ran and stop.
Can you tell me how to fix this?
# -*- coding: utf-8 -*-
from .box import Box
from .box import FullBox
from .box import Quantity
from .box import read_uint
from .box import read_fixed_size_string
from .box import read_utf8string
# ISO/IEC 14496-12:2022, Section 8.18.2
class GroupListBox(Box):
box_type = b"grpl"
is_mandatory = False
quantity = Quantity.ZERO_OR_ONE
def read(self, file):
self.ster_box = self.read_box(file)
self.group_id = read_uint(file, 4)
self.num_entities_in_group = read_uint(file, 4)
self.entity_ids = []
for _ in range(self.num_entities_in_group):
self.entity_ids.append(read_uint(file, 4))
def contents(self):
tuples = super().contents()
tuples += (("entity_group", self.ster_box.contents()),)
tuples += (("group_id", self.group_id),)
tuples += (("num_entities_in_group", self.num_entities_in_group),)
for id in enumerate(self.entity_ids):
tuples += (("entity_id", id),)
return tuples
# ISO/IEC 23008-12:2022, Section 6.8.5
class StereoPairBox(FullBox):
box_type = b"ster"
is_mandatory = True
quantity = Quantity.EXACTLY_ONE
chemag commented
You need to provide an example of how this breaks. Make sure you add the binary file that you're trying to parse