Remove fields in AV2CodecConfigurationBox - #40
Conversation
📄 Specification PreviewThe AV2 ISOBMFF specification has been built and published for this PR. 🔗 Live preview
Built from commit 75d8fb2 · Updated: Mon, 10 Aug 2026 14:02:39 GMT |
| unsigned int(16) max_frame_width_minus_1; | ||
| unsigned int(16) max_frame_height_minus_1; | ||
|
|
||
| unsigned int(8) reserved1 = 0; |
There was a problem hiding this comment.
My recommendation would be to add the following fields. This will allow us to extend this box by adding new fields after the configOBUs[] and make the parsing more deterministic.
bit(24) flags;
unsigned int(32) config_obus_length;
There was a problem hiding this comment.
bit(24) flags;
- Regarding the name, I do not mind using
flagsinstead ofreserved, but I do not see the benefit of it. - For the length, I would argue 8 bits is enough. It is rare for a box to need more than 8 flags, and even so more can be added in another field at the end of the box.
unsigned int(32) config_obus_length;
Good point. I was hoping everything would be handled by the contents of config_obus but it has to be flexible just in case.
To avoid adding 4 bytes to all AV2-ISOBMFF files forever "just in case", I can think of these alternatives:
- Use a flag bit to signal trailing fields:
aligned(8) class AV2CodecConfigurationBox extends Box('av2C') unsigned int(8) flags; if (flags & 1) { unsigned int(32) config_obus_length; } unsigned int(8) config_obus[config_obus_length]; if (flags & 1) { unsigned int(8) reserved[]; } }
- Use a flag bit to signal heading fields:
aligned(8) class AV2CodecConfigurationBox extends Box('av2C') unsigned int(8) flags; if (flags & 1) { unsigned int(32) reserved_length; unsigned int(8) reserved[reserved_length]; } unsigned int(8) config_obus[]; }
- I assume 256 OBUs to be enough (no need for flags because fields can be added at the end of the box in the future):
aligned(8) class AV2CodecConfigurationBox extends Box('av2C') unsigned int(8) config_obus_count_minus1; for (i = 0; i <= config_obus_count_minus1; ++i) { unsigned int(8) config_obu[]; // leb128() num_bytes_in_obu + a single OBU } }
- Variable-length length field (no need for flags because fields can be added at the end of the box in the future):
aligned(8) class AV2CodecConfigurationBox extends Box('av2C') leb128() config_obus_length; // Or similar behavior; ISOBMFF has no vl type defined so far unsigned int(8) config_obus[config_obus_length]; }
- Never append anything to
AV2CodecConfigurationBox, but introduce a new box inAV2SampleEntrylater if necessary:class AV2SampleEntry extends VisualSampleEntry('av02') { AV2CodecConfigurationBox config; AV2MultistreamCodecConfigurationBox multistream_config; } aligned(8) class AV2CodecConfigurationBox extends Box('av2C') { unsigned int(8) reserved1 = 0; unsigned int(8) config_obus[]; // Till end of box } aligned(8) class AV2MultistreamCodecConfigurationBox extends Box('av2M') { // whatever }
Any other approach in mind?
No description provided.