Metadata-Version: 2.4
Name: cs-iso14496
Version: 20260531
Summary: Facilities for ISO14496 files - the ISO Base Media File Format, the basis for several things including MP4 and MOV.
Keywords: python3
Author-email: Cameron Simpson <cs@cskk.id.au>
Description-Content-Type: text/markdown
Classifier: Development Status :: 4 - Beta
Classifier: Environment :: Console
Classifier: Intended Audience :: Developers
Classifier: Programming Language :: Python :: 3
Classifier: Topic :: Multimedia :: Video
Classifier: Operating System :: OS Independent
Classifier: License :: OSI Approved :: GNU General Public License v3 or later (GPLv3+)
Requires-Dist: cs.binary>=20260531
Requires-Dist: cs.buffer>=20250428
Requires-Dist: cs.cmdutils>=20260531
Requires-Dist: cs.fs>=20260526
Requires-Dist: cs.fstags>=20260531
Requires-Dist: cs.imageutils>=20260531
Requires-Dist: cs.lex>=20260526
Requires-Dist: cs.logutils>=20250323
Requires-Dist: cs.pfx>=20250914
Requires-Dist: cs.py.func>=20250914
Requires-Dist: cs.tagset>=20260531
Requires-Dist: cs.threads>=20260531
Requires-Dist: cs.units>=20260526
Requires-Dist: cs.upd>=20260526
Requires-Dist: icontract
Requires-Dist: typeguard
Project-URL: MonoRepo Commits, https://bitbucket.org/cameron_simpson/css/commits/branch/main
Project-URL: Monorepo Git Mirror, https://github.com/cameron-simpson/css
Project-URL: Monorepo Hg/Mercurial Mirror, https://hg.sr.ht/~cameron-simpson/css
Project-URL: Source, https://github.com/cameron-simpson/css/blob/main/lib/python/cs/iso14496.py

Facilities for ISO14496 files - the ISO Base Media File Format,
the basis for several things including MP4 and MOV.

*Latest release 20260531*:
* BoxBody: provide a default boxes=() class attribute; drop HasBoxesMixin, already covered by BoxBody.__getattr__.
* Box.ancestor: raise ValueError if no matching ancestor is found.
* Box.BOX_TYPE: raise AttributeError if we cannot derive the type from the class name.
* Box.walk: yield (level,box,subboxes) 3-tuples to allow the called to track depth.
* MP4Command: rename cmd_parse to cmd_scan.
* BoxBody.__iter__: iterate self.boxes, not (), now that we always have a self.boxes.
* Box,BoxHeader: support for boxes with a UUID as the type.
* drop dump_box() in favour of new Box.dump_table and box.dump methods, add a recursion limit to Box.walk.
* Box: new .descendants() method to scan a Box hierarchy for boxes of specified types.
* MP4Command.cmd_scan: accept just one filename, following arguments are box types of interest.
* BoxBody.parse_field: accept ... in addition to an int to parse raw bytes.
* Drop OverBox.
* @boxbodyclass: decorator wrapping @binclass which reregisters the new class as the body handler for its box type.
* New FulBoxBody2 @binclass based class, hopefully will replace FullBoxBody in the fullness of time.
* Drop parse_fields(), obsoleted by Box.scan().
* Refactor the ILST box schemas as namedtuples.
* New ListOfBoxes(ListOfBinary,item_type=Box) class.
* Reimplement several box classes using @binclass.
* Box.box_type_s: ensure an ASCII box type is entirely printable (no control characters).
* ILSTBoxBody: make a SUBBOX_SCHEMA_BY_LONG_ATTRIBUTE to avoid a linear search in __getattr__.
* Box.parse: new body_type_for=None parameter for providing a custom box_type->BoxBody-class function, intended for the ILST subboxes.
* Drop the top level parse() function.
* Box: new .report_table() and .report() analogues for .dump_table() and .dump() but with human friendly summary information.
* Drop top level report() function, supplanted by Box.report_table() and Box.report().
* Box: new __len__ returning the parsed length from .offset and .end_offset; new __bool__ returning True to avoid implied call of len() for truthiness.
* Assorted other changes.

ISO make the standard available here:
* [available standards main page](http://standards.iso.org/ittf/PubliclyAvailableStandards/index.html)
* [zip file download](http://standards.iso.org/ittf/PubliclyAvailableStandards/c068960_ISO_IEC_14496-12_2015.zip)

Short summary:
* `add_body_subclass`: Create and register a new `BoxBody` class that is simply a subclass of another. Return the new class.
* `add_generic_sample_boxbody`: Create and add a specific Time to Sample box - section 8.6.1.
* `add_time_to_sample_boxbody`: Add a Time to Sample box - section 8.6.1.
* `Box`: Base class for all boxes - ISO14496 section 4.2.
* `BoxBody`: The basis for all `Box` bodies. This base class does not parse any of the body content.
* `boxbodyclass`: A decorator for `@binclass` style `BoxBody` subclasses which reregisters the new binclass in the `BoxBody.SUBCLASSES_BY_BOXTYPE` mapping.
* `BoxHeader`: An ISO14496 `Box` header packet.
* `BTRTBoxBody`: BitRateBoxBody - section 8.5.2.2.
* `CO64BoxBody`: A 'c064' Chunk Offset box - section 8.7.5.
* `ContainerBoxBody`: Common superclass of several things with `.boxes`.
* `CPRTBoxBody`: A 'cprt' Copyright box - section 8.10.2.
* `CSLGBoxBody`: A 'cslg' Composition to Decode box - section 8.6.1.4.
* `decode_itunes_date_field`: The iTunes 'Date' meta field: a year or an ISO timestamp.
* `deref_box`: Dereference a path with respect to this Box.
* `DREFBoxBody`: A 'dref' Data Reference box containing Data Entry boxes - section 8.7.2.1.
* `ELNGBoxBody`: A `ELNGBoxBody` is a Extended Language Tag box - ISO14496 section 8.4.6.
* `ELSTBoxBody`: An 'elst' Edit List FullBoxBody - section 8.6.6.
* `EntryCountListOfBoxes`: An intermediate `FullBoxBody` subclass which contains more boxes whose number if specified with a leading `entry_count` whose defaut type is `UInt32BE`.
* `FREEBoxBody`: A 'free' or 'skip' box - ISO14496 section 8.1.2. Note the length and discard the data portion.
* `FTYPBoxBody`: An 'ftyp' File Type box - ISO14496 section 4.3. Decode the major_brand, minor_version and compatible_brands.
* `FullBoxBody`: A common extension of a basic `BoxBody`, with a version and flags field. ISO14496 section 4.2.
* `FullBoxBody2`: A common extension of a basic `BoxBody`, with a version and flags field. ISO14496 section 4.2.
* `get_deref_path`: Parse a `path` string from `offset`. Return the path components and the offset where the parse stopped.
* `HDLRBoxBody`: A HDLRBoxBody is a Handler Reference box - ISO14496 section 8.4.3.
* `ILSTAofBSchema`: Attribute name and type for ILST "A of B" schema.
* `ILSTBoxBody`: Apple iTunes Information List, container for iTunes metadata fields.
* `ILSTISOFormatSchema`: Attribute name and type for ILST ISO format schema.
* `ILSTRawSchema`: Attribute name and type for ILST raw schema.
* `ILSTTextSchema`: Attribute name and type for ILST text schema.
* `ILSTUInt32BESchema`: Attribute name and type for ILST `UInt32BE` schema.
* `ILSTUInt8Schema`: Attribute name and type for ILST `UInt8BE` schema.
* `itunes_media_type`: itunes_media_type(type, stik)
* `itunes_store_country_code`: itunes_store_country_code(country_name, iso_3166_1_code, itunes_store_code)
* `ListOfBoxes`: A `ListOfBinary` containing `Box`es.
* `main`: Command line mode.
* `MDATBoxBody`: A Media Data Box - ISO14496 section 8.1.1.
* `MDHDBoxBody`: A MDHDBoxBody is a Media Header box - ISO14496 section 8.4.2.
* `METABoxBody`: A 'meta' Meta BoxBody - section 8.11.1.
* `MOOVBoxBody`: An 'moov' Movie box - ISO14496 section 8.2.1. Decode the contained boxes.
* `MVHDBoxBody`: An 'mvhd' Movie Header box - ISO14496 section 8.2.2.
* `parse_tags`: Parse the tags from `path`. Yield `(box,tags)` for each subbox with tags.
* `PDINBoxBody`: A 'pdin' Progressive Download Information box - ISO14496 section 8.1.3.
* `SMHDBoxBody`: A 'smhd' Sound Media Headerbox - section 12.2.2.
* `STCOBoxBody`: A 'stco' Chunk Offset box - section 8.7.5.
* `STDPBoxBody`: A `STDPBoxBody` is a DegradationPriorityBox - ISO14496 section 8.5.3.2.
* `STSCBoxBody`: 'stsc' (Sample Table box - section 8.7.4.1.
* `STSDBoxBody`: A `STSDBoxBody` is a SampleDescriptionBoxBody - ISO14496 section 8.5.2.2.
* `STSZBoxBody`: A 'stsz' Sample Size box - section 8.7.3.2.
* `STZ2BoxBody`: A 'stz2' Compact Sample Size box - section 8.7.3.3.
* `TimeStamp32`: The 32 bit form of an ISO14496 timestamp.
* `TimeStamp64`: The 64 bit form of an ISO14496 timestamp.
* `TimeStampMixin`: Methods to assist with ISO14496 timestamps.
* `TKHDBoxBody`: A 'tkhd' Track Header box - ISO14496 section 8.2.2.
* `TrackGroupTypeBoxBody`: A TrackGroupTypeBoxBody contains a track group id - ISO14496 section 8.3.3.2.
* `TrackReferenceTypeBoxBody`: A TrackReferenceTypeBoxBody contains references to other tracks - ISO14496 section 8.3.3.2.
* `TREFBoxBody`: Track Reference BoxBody, container for trackReferenceTypeBoxes - ISO14496 section 8.3.3.
* `TTSB_Sample`: TTSB_Sample(count, delta).
* `URL_BoxBody`: An 'url ' Data Entry URL BoxBody - section 8.7.2.1.
* `URN_BoxBody`: An 'urn ' Data Entry URL BoxBody - section 8.7.2.1.
* `UTF8or16Field`: An ISO14496 UTF8 or UTF16 encoded string.
* `VMHDBoxBody`: A 'vmhd' Video Media Headerbox - section 12.1.2.

Module contents:
- <a name="add_body_subclass"></a>`add_body_subclass(superclass, box_type, section, desc)`: Create and register a new `BoxBody` class that is simply a subclass of
  another.
  Return the new class.
- <a name="add_generic_sample_boxbody"></a>`add_generic_sample_boxbody(box_type, section, desc, struct_format_v0, sample_fields, struct_format_v1=None, has_inferred_entry_count=False)`: Create and add a specific Time to Sample box - section 8.6.1.
- <a name="add_time_to_sample_boxbody"></a>`add_time_to_sample_boxbody(box_type, section, desc)`: Add a Time to Sample box - section 8.6.1.
- <a name="Box"></a>`class Box(cs.binary.SimpleBinary)`: Base class for all boxes - ISO14496 section 4.2.

  This has the following fields:
  * `header`: a `BoxHeader`
  * `body`: a `BoxBody` instance, usually a specific subclass
  * `unparsed`: any unconsumed bytes from the `Box` are stored as here

*`Box.BOX_TYPE`*:
The default `.BOX_TYPE` is inferred from the class name.

*`Box.__bool__(self)`*:
A `Box` is always true, prevents implied call of `len()` for truthiness.

*`Box.__getattr__(self, attr)`*:
If there is no direct attribute from `SimpleBinary.__getattr__`,
have a look in the `.header` and `.body`.

*`Box.__iter__(self)`*:
Iterating over a `Box` iterates over its body.
Typically that would be the `.body.boxes`
but might be the samples if the body is a sample box,
etc.

*`Box.ancestor(self, box_type)`*:
Return the closest ancestor box of type `box_type`.
Raise `ValueError` if there is no such ancestor.

*`Box.box_type`*:
The `Box` header type.

*`Box.box_type_path`*:
The type path to this Box.

*`Box.box_type_s`*:
The `Box` header type as a string.

If the header type is a UUID, return its `str` form.
Otherwise, if the header type bytes decode as ASCII, return that.
Otherwise the header bytes' repr().

*`Box.box_type_uuid`*:
The `Box` header type `UUID` for boxes whose `box_type` is `b'uuid'`.

*`Box.descendants(self, sub_box_types: Union[str, List])`*:
A generator to scan descendants of this box for boxes
matching `sub_box_types`.

The `sub_box_types` may be a dot separated string or a list.

*`Box.dump(self, file=None, **dump_table_kw)`*:
Dump this `Box` to `file` (default `sys.stdout` per `cs.lex.printt`.
Other keyword paramaters are passed to `Box.dump_table`.

*`Box.dump_table(self, table=None, columns=('box_type', 'size', 'description'), dump_fields=False, dump_offsets=False, recurse=False) -> List[Tuple[str, str]]`*:
Dump this `Box` as a table of descriptions.
Return a list of `(title,description)` 2-lists
with fields and subboxes in tuples
suitable for use with `cs.lex.printt()`.

*`Box.gather_metadata(self, prepath='') -> Iterable[Tuple[str, ForwardRef('Box'), cs.tagset.TagSet]]`*:
Walk the `Box` hierarchy looking for metadata.
Yield `(box_path,Box,TagSet)` 3-tuples for each `Box`
with a nonempty `.metatags`.

*`Box.merged_metadata(self) -> cs.tagset.TagSet`*:
Return a `TagSet` containing the merged metadata from this `Box` down.

*`Box.metatags(self) -> cs.tagset.TagSet`*:
Return a `TagSet` containing direct metadata for this box.
This default implementation returns an empty `TagSet`.

*`Box.parse(bfr: cs.buffer.CornuCopyBuffer, body_type_for=None)`*:
Decode a `Box` from `bfr` and return it.

*`Box.parse_field(self, field_name, bfr: cs.buffer.CornuCopyBuffer, binary_cls)`*:
`parse_field` delegates to the `Box` body `parse_field`.

*`Box.parse_length`*:
The length of the box as consumed from the buffer,
computed as `self.end_offset-self.offset`.

*`Box.reparse_buffer(self)`*:
A context manager for continuing a `Box` parse from the `unparsed` field.

Pops the final `unparsed` field from the `Box`,
yields a `CornuCopyBuffer` made from it,
then pushes the `unparsed` field again
with the remaining contents of the buffer
after the reparse is done.

*`Box.report(self, file=None, **report_table_kw)`*:
Report on this `Box` to `file` (default `sys.stdout` per `cs.lex.printt`.
Other keyword paramaters are passed to `Box.report_table`.

*`Box.report_table(self, table=None, indent='', subindent='  ')`*:
Report some human friendly information as a table.
Return a list of `(title,description)` 2-tuples
suitable for use with `cs.lex.printt()`.

*`Box.self_check(self)`*:
Sanity check this Box.

*`Box.transcribe(self)`*:
Transcribe the `Box`.

Before transcribing the data, we compute the total box_size
from the lengths of the current header, body and unparsed
components, then set the header length if that has changed.
Since setting the header length can change its representation
we compute the length again and abort if it isn't stable.
Otherwise we proceeed with a regular transcription.

*`Box.unparsed_bs`*:
The unparsed data as a single `bytes` instance.

*`Box.user_type`*:
The header user_type.

*`Box.walk(self, *, level=0, limit=None) -> Iterable[Tuple[int, ForwardRef('Box'), List[ForwardRef('Box')]]]`*:
Walk this `Box` hierarchy.

Yield `(level,self,subboxes)` 3-tuples starting with the top box (`self`)
and recursing into its subboxes.

As with `os.walk`, the returned `subboxes` list
may be modified in place to prune or reorder the subsequent walk.
- <a name="BoxBody"></a>`class BoxBody(cs.binary.SimpleBinary)`: The basis for all `Box` bodies.
  This base class does not parse any of the body content.

*`BoxBody.__getattr__(self, attr)`*:
The following virtual attributes are defined:
* *TYPE*`s`:
  "boxes of type *TYPE*",
  an uppercased box type name with a training `s`;
  a list of all elements whose `.box_type`
  equals *TYPE*`.lower().encode('ascii')`.
  The elements are obtained by iterating over `self`
  which normally means iterating over the `.boxes` attribute.
* *TYPE*:
  "the box of type *TYPE*",
  an uppercased box type name;
  the sole element whose box type matches the type,
  obtained from `.`*TYPE*`s[0]`
  with a requirement that there is exactly one match.
* *TYPE*`0`:
  "the optional box of type *TYPE*",
  an uppercased box type name with a trailing `0`;
  the sole element whose box type matches the type,
  obtained from `.`*TYPE*`s[0]`
  with a requirement that there is exactly zero or one match.
  If there are zero matches, return `None`.
  Otherwise return the matching box.

*`BoxBody.add_field(self, field_name, value)`*:
Add a field named `field_name` with the specified `value`
to the box fields.

*`BoxBody.boxbody_type_from_class()`*:
Compute the Box's 4 byte type field from the class name.

*`BoxBody.for_box_type(box_type: bytes)`*:
Return the `BoxBody` subclass suitable for the `box_type`.

*`BoxBody.parse(bfr: cs.buffer.CornuCopyBuffer)`*:
Create a new instance and gather the `Box` body fields from `bfr`.

Subclasses implement a `parse_fields` method to parse additional fields.

*`BoxBody.parse_boxes(self, bfr: cs.buffer.CornuCopyBuffer, field_name='boxes', **box_scan_kw)`*:
Utility method to parse the remainder of the buffer as a
sequence of `Box`es and to save them as the attribute named by `field_name`<
default `".boxes"`.

*`BoxBody.parse_field(self, field_name, bfr: cs.buffer.CornuCopyBuffer, binary_cls)`*:
Parse an instance of `binary_cls` from `bfr`
and store it as the attribute named `field_name`.

`binary_cls` may also be an `int`, in which case that many
bytes are read from `bfr`.

*`BoxBody.parse_field_value(self, field_name, bfr: cs.buffer.CornuCopyBuffer, binary_cls)`*:
Parse a single value binary, store the value as `field_name`,
store the instance as the field `field_name+'__Binary'`
for transcription.

Note that this disassociates the plain value attribute
from what gets transcribed.

*`BoxBody.parse_fields(self, bfr: cs.buffer.CornuCopyBuffer)`*:
Parse additional fields.
This base class implementation consumes nothing.

*`BoxBody.transcribe(self)`*:
Transcribe the binary structure.

This default implementation transcribes the fields parsed with the
`parse_field` method in the order parsed.

*`BoxBody.transcribe_fields(self)`*:
Transcribe the fields parsed with the `parse_field` method in the
order parsed.
- <a name="boxbodyclass"></a>`boxbodyclass(*da, **dkw)`: A decorator for `@binclass` style `BoxBody` subclasses
  which reregisters the new binclass in the
  `BoxBody.SUBCLASSES_BY_BOXTYPE` mapping.
- <a name="BoxHeader"></a>`class BoxHeader(cs.binary.BoxHeader)`: An ISO14496 `Box` header packet.

*`BoxHeader.parse(bfr: cs.buffer.CornuCopyBuffer)`*:
Decode a box header from `bfr`.
- <a name="BTRTBoxBody"></a>`class BTRTBoxBody(BTRTBoxBody__original)`: BitRateBoxBody - section 8.5.2.2.

*`BTRTBoxBody.__getattr__(self, attr: str)`*:
Return a data field value, the `.value` attribute if it is a single value field.

*`BTRTBoxBody.__setattr__(self, attr, value)`*:
Set a data field from `value`.

*`BTRTBoxBody.parse(bfr: cs.buffer.CornuCopyBuffer)`*:
Parse an instance from `bfr`.
This default implementation calls `cls(**cls.parse_fields(bfr))`.

*`BTRTBoxBody.parse_field(fieldname: str, bfr: cs.buffer.CornuCopyBuffer, fieldtypes: Optional[Mapping[str, type]] = None)`*:
Parse an instance of the field named `fieldname` from `bfr`.
Return the field instance.

*`BTRTBoxBody.parse_fields(bfr: cs.buffer.CornuCopyBuffer, fieldtypes: Union[Mapping[str, type], Iterable[str], str, NoneType] = None) -> Mapping[str, cs.binary.AbstractBinary]`*:
Parse all the fields from `cls._datafieldtypes` from `bfr`
by calling `cls.parse_field(fieldname,bfr)` for each.
Return a mapping of field names to values
suitable for passing to `cls`.

The `fieldtypes` defaults to `cls._datafieldtypes` but may be provided as:
- a mapping of field name to type
- an iterable of field names, whose types will come from
  `cls._datafieldtypes`
- a string being a space separated list of field names,
  whose types will come from `cls._datafieldtypes`

Each of these will be converted to a mapping and then
promoted with `promote_fieldtypemap`.

*`BTRTBoxBody.promote_field_value(fieldname: str, obj)`*:
Promote a received `obj` to the appropriate `AbstractBinary` instance.

*`BTRTBoxBody.self_check(self)`*:
An `@binclass` class instance's raw fields are in `self._data`.

*`BTRTBoxBody.transcribe(self)`*:
Transcribe this instance.
- <a name="CO64BoxBody"></a>`class CO64BoxBody(FullBoxBody)`: A 'c064' Chunk Offset box - section 8.7.5.

*`CO64BoxBody.parse_fields(self, bfr: cs.buffer.CornuCopyBuffer)`*:
Gather the `entry_count` and `chunk_offsets` fields.

*`CO64BoxBody.transcribe(self)`*:
Transcribe a `CO64BoxBody`.
- <a name="ContainerBoxBody"></a>`class ContainerBoxBody(ContainerBoxBody__original)`: Common superclass of several things with `.boxes`.

*`ContainerBoxBody.__getattr__(self, attr: str)`*:
Return a data field value, the `.value` attribute if it is a single value field.

*`ContainerBoxBody.__setattr__(self, attr, value)`*:
Set a data field from `value`.

*`ContainerBoxBody.parse(bfr: cs.buffer.CornuCopyBuffer)`*:
Parse an instance from `bfr`.
This default implementation calls `cls(**cls.parse_fields(bfr))`.

*`ContainerBoxBody.parse_field(fieldname: str, bfr: cs.buffer.CornuCopyBuffer, fieldtypes: Optional[Mapping[str, type]] = None)`*:
Parse an instance of the field named `fieldname` from `bfr`.
Return the field instance.

*`ContainerBoxBody.parse_fields(bfr: cs.buffer.CornuCopyBuffer, fieldtypes: Union[Mapping[str, type], Iterable[str], str, NoneType] = None) -> Mapping[str, cs.binary.AbstractBinary]`*:
Parse all the fields from `cls._datafieldtypes` from `bfr`
by calling `cls.parse_field(fieldname,bfr)` for each.
Return a mapping of field names to values
suitable for passing to `cls`.

The `fieldtypes` defaults to `cls._datafieldtypes` but may be provided as:
- a mapping of field name to type
- an iterable of field names, whose types will come from
  `cls._datafieldtypes`
- a string being a space separated list of field names,
  whose types will come from `cls._datafieldtypes`

Each of these will be converted to a mapping and then
promoted with `promote_fieldtypemap`.

*`ContainerBoxBody.promote_field_value(fieldname: str, obj)`*:
Promote a received `obj` to the appropriate `AbstractBinary` instance.

*`ContainerBoxBody.self_check(self)`*:
An `@binclass` class instance's raw fields are in `self._data`.

*`ContainerBoxBody.transcribe(self)`*:
Transcribe this instance.
- <a name="CPRTBoxBody"></a>`class CPRTBoxBody(FullBoxBody2)`: A 'cprt' Copyright box - section 8.10.2.

*`CPRTBoxBody.language`*:
The `language_field` as the 3 character ISO 639-2/T language code.
- <a name="CSLGBoxBody"></a>`class CSLGBoxBody(FullBoxBody)`: A 'cslg' Composition to Decode box - section 8.6.1.4.

*`CSLGBoxBody.CSLGParamsLong`*

*`CSLGBoxBody.CSLGParamsQuad`*

*`CSLGBoxBody.__getattr__(self, attr)`*:
Present the `params` attributes at the top level.

*`CSLGBoxBody.parse_fields(self, bfr: cs.buffer.CornuCopyBuffer)`*:
Gather the compositionToDTSShift`, `leastDecodeToDisplayDelta`,
`greatestDecodeToDisplayDelta`, `compositionStartTime` and
`compositionEndTime` fields.
- <a name="decode_itunes_date_field"></a>`decode_itunes_date_field(data) -> datetime.datetime`: The iTunes 'Date' meta field: a year or an ISO timestamp.
- <a name="deref_box"></a>`deref_box(B, path)`: Dereference a path with respect to this Box.
- <a name="DREFBoxBody"></a>`class DREFBoxBody(DREFBoxBody__original)`: A 'dref' Data Reference box containing Data Entry boxes - section 8.7.2.1.

*`DREFBoxBody.ENTRY_COUNT_TYPE`*

*`DREFBoxBody.__getattr__(self, attr: str)`*:
Return a data field value, the `.value` attribute if it is a single value field.

*`DREFBoxBody.__setattr__(self, attr, value)`*:
Set a data field from `value`.

*`DREFBoxBody.parse(bfr: cs.buffer.CornuCopyBuffer)`*:
Parse an instance from `bfr`.
This default implementation calls `cls(**cls.parse_fields(bfr))`.

*`DREFBoxBody.parse_field(fieldname: str, bfr: cs.buffer.CornuCopyBuffer, fieldtypes: Optional[Mapping[str, type]] = None)`*:
Parse an instance of the field named `fieldname` from `bfr`.
Return the field instance.

*`DREFBoxBody.parse_fields(bfr: cs.buffer.CornuCopyBuffer, fieldtypes: Union[Mapping[str, type], Iterable[str], str, NoneType] = None) -> Mapping[str, cs.binary.AbstractBinary]`*:
Parse all the fields from `cls._datafieldtypes` from `bfr`
by calling `cls.parse_field(fieldname,bfr)` for each.
Return a mapping of field names to values
suitable for passing to `cls`.

The `fieldtypes` defaults to `cls._datafieldtypes` but may be provided as:
- a mapping of field name to type
- an iterable of field names, whose types will come from
  `cls._datafieldtypes`
- a string being a space separated list of field names,
  whose types will come from `cls._datafieldtypes`

Each of these will be converted to a mapping and then
promoted with `promote_fieldtypemap`.

*`DREFBoxBody.promote_field_value(fieldname: str, obj)`*:
Promote a received `obj` to the appropriate `AbstractBinary` instance.

*`DREFBoxBody.self_check(self)`*:
An `@binclass` class instance's raw fields are in `self._data`.

*`DREFBoxBody.transcribe(self)`*:
Transcribe this instance.
- <a name="ELNGBoxBody"></a>`class ELNGBoxBody(ELNGBoxBody__original)`: A `ELNGBoxBody` is a Extended Language Tag box - ISO14496 section 8.4.6.

*`ELNGBoxBody.__getattr__(self, attr: str)`*:
Return a data field value, the `.value` attribute if it is a single value field.

*`ELNGBoxBody.__setattr__(self, attr, value)`*:
Set a data field from `value`.

*`ELNGBoxBody.parse(bfr: cs.buffer.CornuCopyBuffer)`*:
Parse an instance from `bfr`.
This default implementation calls `cls(**cls.parse_fields(bfr))`.

*`ELNGBoxBody.parse_field(fieldname: str, bfr: cs.buffer.CornuCopyBuffer, fieldtypes: Optional[Mapping[str, type]] = None)`*:
Parse an instance of the field named `fieldname` from `bfr`.
Return the field instance.

*`ELNGBoxBody.parse_fields(bfr: cs.buffer.CornuCopyBuffer, fieldtypes: Union[Mapping[str, type], Iterable[str], str, NoneType] = None) -> Mapping[str, cs.binary.AbstractBinary]`*:
Parse all the fields from `cls._datafieldtypes` from `bfr`
by calling `cls.parse_field(fieldname,bfr)` for each.
Return a mapping of field names to values
suitable for passing to `cls`.

The `fieldtypes` defaults to `cls._datafieldtypes` but may be provided as:
- a mapping of field name to type
- an iterable of field names, whose types will come from
  `cls._datafieldtypes`
- a string being a space separated list of field names,
  whose types will come from `cls._datafieldtypes`

Each of these will be converted to a mapping and then
promoted with `promote_fieldtypemap`.

*`ELNGBoxBody.promote_field_value(fieldname: str, obj)`*:
Promote a received `obj` to the appropriate `AbstractBinary` instance.

*`ELNGBoxBody.self_check(self)`*:
An `@binclass` class instance's raw fields are in `self._data`.

*`ELNGBoxBody.transcribe(self)`*:
Transcribe this instance.
- <a name="ELSTBoxBody"></a>`class ELSTBoxBody(FullBoxBody)`: An 'elst' Edit List FullBoxBody - section 8.6.6.

*`ELSTBoxBody.V0EditEntry`*

*`ELSTBoxBody.V1EditEntry`*

*`ELSTBoxBody.entry_class`*:
The class representing each entry.

*`ELSTBoxBody.entry_count`*:
The number of entries.

*`ELSTBoxBody.parse_fields(self, bfr: cs.buffer.CornuCopyBuffer)`*:
Parse the fields of an `ELSTBoxBody`.

*`ELSTBoxBody.transcribe(self)`*:
Transcribe an `ELSTBoxBody`.
- <a name="EntryCountListOfBoxes"></a>`class EntryCountListOfBoxes(FullBoxBody2)`: An intermediate `FullBoxBody` subclass which contains more boxes
  whose number if specified with a leading `entry_count`
  whose defaut type is `UInt32BE`.

  This is a common superclass of `_SampleTableContainerBoxBody` and

*`EntryCountListOfBoxes.entry_count`*:
The `entry_count` is the number of `Box`es.

*`EntryCountListOfBoxes.parse_fields(bfr: cs.buffer.CornuCopyBuffer)`*:
Gather the `entry_count` and `boxes`.

*`EntryCountListOfBoxes.transcribe(self)`*:
Transcribe a `EntryCountListOfBoxes`.
- <a name="FREEBoxBody"></a>`class FREEBoxBody(BoxBody)`: A 'free' or 'skip' box - ISO14496 section 8.1.2.
  Note the length and discard the data portion.

*`FREEBoxBody.parse_fields(self, bfr: cs.buffer.CornuCopyBuffer, end_offset=Ellipsis, **kw)`*:
Gather the `padding` field.

*`FREEBoxBody.transcribe(self)`*:
Transcribe a `FREEBoxBody`.
- <a name="FTYPBoxBody"></a>`class FTYPBoxBody(FTYPBoxBody__original)`: An 'ftyp' File Type box - ISO14496 section 4.3.
  Decode the major_brand, minor_version and compatible_brands.

*`FTYPBoxBody.__getattr__(self, attr: str)`*:
Return a data field value, the `.value` attribute if it is a single value field.

*`FTYPBoxBody.__setattr__(self, attr, value)`*:
Set a data field from `value`.

*`FTYPBoxBody.parse(bfr: cs.buffer.CornuCopyBuffer)`*:
Parse an instance from `bfr`.
This default implementation calls `cls(**cls.parse_fields(bfr))`.

*`FTYPBoxBody.parse_field(fieldname: str, bfr: cs.buffer.CornuCopyBuffer, fieldtypes: Optional[Mapping[str, type]] = None)`*:
Parse an instance of the field named `fieldname` from `bfr`.
Return the field instance.

*`FTYPBoxBody.parse_fields(bfr: cs.buffer.CornuCopyBuffer, fieldtypes: Union[Mapping[str, type], Iterable[str], str, NoneType] = None) -> Mapping[str, cs.binary.AbstractBinary]`*:
Parse all the fields from `cls._datafieldtypes` from `bfr`
by calling `cls.parse_field(fieldname,bfr)` for each.
Return a mapping of field names to values
suitable for passing to `cls`.

The `fieldtypes` defaults to `cls._datafieldtypes` but may be provided as:
- a mapping of field name to type
- an iterable of field names, whose types will come from
  `cls._datafieldtypes`
- a string being a space separated list of field names,
  whose types will come from `cls._datafieldtypes`

Each of these will be converted to a mapping and then
promoted with `promote_fieldtypemap`.

*`FTYPBoxBody.promote_field_value(fieldname: str, obj)`*:
Promote a received `obj` to the appropriate `AbstractBinary` instance.

*`FTYPBoxBody.self_check(self)`*:
An `@binclass` class instance's raw fields are in `self._data`.

*`FTYPBoxBody.transcribe(self)`*:
Transcribe this instance.
- <a name="FullBoxBody"></a>`class FullBoxBody(BoxBody)`: A common extension of a basic `BoxBody`, with a version and flags field.
  ISO14496 section 4.2.

*`FullBoxBody.flags`*:
The flags value, computed from the 3 flag bytes.

*`FullBoxBody.parse_fields(self, bfr: cs.buffer.CornuCopyBuffer)`*:
Gather the fields of `FullBoxBody`.
- <a name="FullBoxBody2"></a>`class FullBoxBody2(FullBoxBody2__original)`: A common extension of a basic `BoxBody`, with a version and flags field.
  ISO14496 section 4.2.

*`FullBoxBody2.__getattr__(self, attr: str)`*:
Return a data field value, the `.value` attribute if it is a single value field.

*`FullBoxBody2.__setattr__(self, attr, value)`*:
Set a data field from `value`.

*`FullBoxBody2.parse(bfr: cs.buffer.CornuCopyBuffer)`*:
Parse an instance from `bfr`.
This default implementation calls `cls(**cls.parse_fields(bfr))`.

*`FullBoxBody2.parse_field(fieldname: str, bfr: cs.buffer.CornuCopyBuffer, fieldtypes: Optional[Mapping[str, type]] = None)`*:
Parse an instance of the field named `fieldname` from `bfr`.
Return the field instance.

*`FullBoxBody2.parse_fields(bfr: cs.buffer.CornuCopyBuffer, fieldtypes: Union[Mapping[str, type], Iterable[str], str, NoneType] = None) -> Mapping[str, cs.binary.AbstractBinary]`*:
Parse all the fields from `cls._datafieldtypes` from `bfr`
by calling `cls.parse_field(fieldname,bfr)` for each.
Return a mapping of field names to values
suitable for passing to `cls`.

The `fieldtypes` defaults to `cls._datafieldtypes` but may be provided as:
- a mapping of field name to type
- an iterable of field names, whose types will come from
  `cls._datafieldtypes`
- a string being a space separated list of field names,
  whose types will come from `cls._datafieldtypes`

Each of these will be converted to a mapping and then
promoted with `promote_fieldtypemap`.

*`FullBoxBody2.promote_field_value(fieldname: str, obj)`*:
Promote a received `obj` to the appropriate `AbstractBinary` instance.

*`FullBoxBody2.self_check(self)`*:
An `@binclass` class instance's raw fields are in `self._data`.

*`FullBoxBody2.transcribe(self)`*:
Transcribe this instance.
- <a name="get_deref_path"></a>`get_deref_path(path, offset=0)`: Parse a `path` string from `offset`.
  Return the path components and the offset where the parse stopped.

  Path components:
  * _identifier_: an identifier represents a `Box` field or if such a
    field is not present, a the first subbox of this type
  * `[`_index_`]`: the subbox with index _index_

  Examples:

      >>> get_deref_path('.abcd[5]')
      (['abcd', 5], 8)
- <a name="HDLRBoxBody"></a>`class HDLRBoxBody(HDLRBoxBody__original)`: A HDLRBoxBody is a Handler Reference box - ISO14496 section 8.4.3.

*`HDLRBoxBody.__getattr__(self, attr: str)`*:
Return a data field value, the `.value` attribute if it is a single value field.

*`HDLRBoxBody.__setattr__(self, attr, value)`*:
Set a data field from `value`.

*`HDLRBoxBody.parse(bfr: cs.buffer.CornuCopyBuffer)`*:
Parse an instance from `bfr`.
This default implementation calls `cls(**cls.parse_fields(bfr))`.

*`HDLRBoxBody.parse_field(fieldname: str, bfr: cs.buffer.CornuCopyBuffer, fieldtypes: Optional[Mapping[str, type]] = None)`*:
Parse an instance of the field named `fieldname` from `bfr`.
Return the field instance.

*`HDLRBoxBody.parse_fields(bfr: cs.buffer.CornuCopyBuffer, fieldtypes: Union[Mapping[str, type], Iterable[str], str, NoneType] = None) -> Mapping[str, cs.binary.AbstractBinary]`*:
Parse all the fields from `cls._datafieldtypes` from `bfr`
by calling `cls.parse_field(fieldname,bfr)` for each.
Return a mapping of field names to values
suitable for passing to `cls`.

The `fieldtypes` defaults to `cls._datafieldtypes` but may be provided as:
- a mapping of field name to type
- an iterable of field names, whose types will come from
  `cls._datafieldtypes`
- a string being a space separated list of field names,
  whose types will come from `cls._datafieldtypes`

Each of these will be converted to a mapping and then
promoted with `promote_fieldtypemap`.

*`HDLRBoxBody.promote_field_value(fieldname: str, obj)`*:
Promote a received `obj` to the appropriate `AbstractBinary` instance.

*`HDLRBoxBody.self_check(self)`*:
An `@binclass` class instance's raw fields are in `self._data`.

*`HDLRBoxBody.transcribe(self)`*:
Transcribe this instance.
- <a name="ILSTAofBSchema"></a>`ILSTAofBSchema(attribute_name)`: Attribute name and type for ILST "A of B" schema.
- <a name="ILSTBoxBody"></a>`class ILSTBoxBody(ILSTBoxBody__original)`: Apple iTunes Information List, container for iTunes metadata fields.

  The basis of the format knowledge here comes from AtomicParsley's
  documentation here:

      http://atomicparsley.sourceforge.net/mpeg-4files.html

  and additional information from:

      https://github.com/sergiomb2/libmp4v2/wiki/iTunesMetadata

*`ILSTBoxBody.__getattr__(self, attr: str)`*:
Return a data field value, the `.value` attribute if it is a single value field.

*`ILSTBoxBody.__setattr__(self, attr, value)`*:
Set a data field from `value`.

*`ILSTBoxBody.parse(bfr: cs.buffer.CornuCopyBuffer)`*:
Parse an instance from `bfr`.
This default implementation calls `cls(**cls.parse_fields(bfr))`.

*`ILSTBoxBody.parse_field(fieldname: str, bfr: cs.buffer.CornuCopyBuffer, fieldtypes: Optional[Mapping[str, type]] = None)`*:
Parse an instance of the field named `fieldname` from `bfr`.
Return the field instance.

*`ILSTBoxBody.parse_fields(bfr: cs.buffer.CornuCopyBuffer, fieldtypes: Union[Mapping[str, type], Iterable[str], str, NoneType] = None) -> Mapping[str, cs.binary.AbstractBinary]`*:
Parse all the fields from `cls._datafieldtypes` from `bfr`
by calling `cls.parse_field(fieldname,bfr)` for each.
Return a mapping of field names to values
suitable for passing to `cls`.

The `fieldtypes` defaults to `cls._datafieldtypes` but may be provided as:
- a mapping of field name to type
- an iterable of field names, whose types will come from
  `cls._datafieldtypes`
- a string being a space separated list of field names,
  whose types will come from `cls._datafieldtypes`

Each of these will be converted to a mapping and then
promoted with `promote_fieldtypemap`.

*`ILSTBoxBody.promote_field_value(fieldname: str, obj)`*:
Promote a received `obj` to the appropriate `AbstractBinary` instance.

*`ILSTBoxBody.self_check(self)`*:
An `@binclass` class instance's raw fields are in `self._data`.

*`ILSTBoxBody.transcribe(self)`*:
Transcribe this instance.
- <a name="ILSTISOFormatSchema"></a>`ILSTISOFormatSchema(attribute_name)`: Attribute name and type for ILST ISO format schema.
- <a name="ILSTRawSchema"></a>`ILSTRawSchema(attribute_name)`: Attribute name and type for ILST raw schema.
- <a name="ILSTTextSchema"></a>`ILSTTextSchema(attribute_name)`: Attribute name and type for ILST text schema.
- <a name="ILSTUInt32BESchema"></a>`ILSTUInt32BESchema(attribute_name)`: Attribute name and type for ILST `UInt32BE` schema.
- <a name="ILSTUInt8Schema"></a>`ILSTUInt8Schema(attribute_name)`: Attribute name and type for ILST `UInt8BE` schema.
- <a name="itunes_media_type"></a>`class itunes_media_type(builtins.tuple)`: itunes_media_type(type, stik)

*`itunes_media_type.__replace__(self, /, **kwds)`*:
Return a new itunes_media_type object replacing specified fields with new values

*`itunes_media_type.stik`*:
Alias for field number 1

*`itunes_media_type.type`*:
Alias for field number 0
- <a name="itunes_store_country_code"></a>`class itunes_store_country_code(builtins.tuple)`: itunes_store_country_code(country_name, iso_3166_1_code, itunes_store_code)

*`itunes_store_country_code.__replace__(self, /, **kwds)`*:
Return a new itunes_store_country_code object replacing specified fields with new values

*`itunes_store_country_code.country_name`*:
Alias for field number 0

*`itunes_store_country_code.iso_3166_1_code`*:
Alias for field number 1

*`itunes_store_country_code.itunes_store_code`*:
Alias for field number 2
- <a name="ListOfBoxes"></a>`class ListOfBoxes(cs.binary.ListOfBinary)`: A `ListOfBinary` containing `Box`es.

*`ListOfBoxes.LIST_ITEM_TYPE`*
- <a name="main"></a>`main(argv=None)`: Command line mode.
- <a name="MDATBoxBody"></a>`class MDATBoxBody(BoxBody)`: A Media Data Box - ISO14496 section 8.1.1.

*`MDATBoxBody.parse_fields(self, bfr: cs.buffer.CornuCopyBuffer)`*:
Gather all data to the end of the field.

*`MDATBoxBody.transcribe(self)`*:
Transcribe the data.
Raise an `AssertionError` if we skipped the data during the parse.

*`MDATBoxBody.transcribed_length(self)`*:
Return the transcription length even if we didn't keep the data.
- <a name="MDHDBoxBody"></a>`class MDHDBoxBody(FullBoxBody)`: A MDHDBoxBody is a Media Header box - ISO14496 section 8.4.2.

*`MDHDBoxBody.language`*:
The ISO 639‐2/T language code as decoded from the packed form.

*`MDHDBoxBody.parse_fields(self, bfr: cs.buffer.CornuCopyBuffer)`*:
Gather the `creation_time`, `modification_time`, `timescale`,
`duration` and `language_short` fields.

*`MDHDBoxBody.transcribe(self)`*:
Transcribe a `MDHDBoxBody`.
- <a name="METABoxBody"></a>`class METABoxBody(METABoxBody__original)`: A 'meta' Meta BoxBody - section 8.11.1.

*`METABoxBody.__getattr__(self, attr: str)`*:
Return a data field value, the `.value` attribute if it is a single value field.

*`METABoxBody.__setattr__(self, attr, value)`*:
Set a data field from `value`.

*`METABoxBody.parse(bfr: cs.buffer.CornuCopyBuffer)`*:
Parse an instance from `bfr`.
This default implementation calls `cls(**cls.parse_fields(bfr))`.

*`METABoxBody.parse_field(fieldname: str, bfr: cs.buffer.CornuCopyBuffer, fieldtypes: Optional[Mapping[str, type]] = None)`*:
Parse an instance of the field named `fieldname` from `bfr`.
Return the field instance.

*`METABoxBody.parse_fields(bfr: cs.buffer.CornuCopyBuffer, fieldtypes: Union[Mapping[str, type], Iterable[str], str, NoneType] = None) -> Mapping[str, cs.binary.AbstractBinary]`*:
Parse all the fields from `cls._datafieldtypes` from `bfr`
by calling `cls.parse_field(fieldname,bfr)` for each.
Return a mapping of field names to values
suitable for passing to `cls`.

The `fieldtypes` defaults to `cls._datafieldtypes` but may be provided as:
- a mapping of field name to type
- an iterable of field names, whose types will come from
  `cls._datafieldtypes`
- a string being a space separated list of field names,
  whose types will come from `cls._datafieldtypes`

Each of these will be converted to a mapping and then
promoted with `promote_fieldtypemap`.

*`METABoxBody.promote_field_value(fieldname: str, obj)`*:
Promote a received `obj` to the appropriate `AbstractBinary` instance.

*`METABoxBody.self_check(self)`*:
An `@binclass` class instance's raw fields are in `self._data`.

*`METABoxBody.transcribe(self)`*:
Transcribe this instance.
- <a name="MOOVBoxBody"></a>`class MOOVBoxBody(MOOVBoxBody__original)`: An 'moov' Movie box - ISO14496 section 8.2.1.
  Decode the contained boxes.

*`MOOVBoxBody.__getattr__(self, attr: str)`*:
Return a data field value, the `.value` attribute if it is a single value field.

*`MOOVBoxBody.__setattr__(self, attr, value)`*:
Set a data field from `value`.

*`MOOVBoxBody.parse(bfr: cs.buffer.CornuCopyBuffer)`*:
Parse an instance from `bfr`.
This default implementation calls `cls(**cls.parse_fields(bfr))`.

*`MOOVBoxBody.parse_field(fieldname: str, bfr: cs.buffer.CornuCopyBuffer, fieldtypes: Optional[Mapping[str, type]] = None)`*:
Parse an instance of the field named `fieldname` from `bfr`.
Return the field instance.

*`MOOVBoxBody.parse_fields(bfr: cs.buffer.CornuCopyBuffer, fieldtypes: Union[Mapping[str, type], Iterable[str], str, NoneType] = None) -> Mapping[str, cs.binary.AbstractBinary]`*:
Parse all the fields from `cls._datafieldtypes` from `bfr`
by calling `cls.parse_field(fieldname,bfr)` for each.
Return a mapping of field names to values
suitable for passing to `cls`.

The `fieldtypes` defaults to `cls._datafieldtypes` but may be provided as:
- a mapping of field name to type
- an iterable of field names, whose types will come from
  `cls._datafieldtypes`
- a string being a space separated list of field names,
  whose types will come from `cls._datafieldtypes`

Each of these will be converted to a mapping and then
promoted with `promote_fieldtypemap`.

*`MOOVBoxBody.promote_field_value(fieldname: str, obj)`*:
Promote a received `obj` to the appropriate `AbstractBinary` instance.

*`MOOVBoxBody.self_check(self)`*:
An `@binclass` class instance's raw fields are in `self._data`.

*`MOOVBoxBody.transcribe(self)`*:
Transcribe this instance.
- <a name="MVHDBoxBody"></a>`class MVHDBoxBody(MVHDBoxBody__original)`: An 'mvhd' Movie Header box - ISO14496 section 8.2.2.

*`MVHDBoxBody.__getattr__(self, attr: str)`*:
Return a data field value, the `.value` attribute if it is a single value field.

*`MVHDBoxBody.__setattr__(self, attr, value)`*:
Set a data field from `value`.

*`MVHDBoxBody.parse(bfr: cs.buffer.CornuCopyBuffer)`*:
Parse an instance from `bfr`.
This default implementation calls `cls(**cls.parse_fields(bfr))`.

*`MVHDBoxBody.parse_field(fieldname: str, bfr: cs.buffer.CornuCopyBuffer, fieldtypes: Optional[Mapping[str, type]] = None)`*:
Parse an instance of the field named `fieldname` from `bfr`.
Return the field instance.

*`MVHDBoxBody.parse_fields(bfr: cs.buffer.CornuCopyBuffer, fieldtypes: Union[Mapping[str, type], Iterable[str], str, NoneType] = None) -> Mapping[str, cs.binary.AbstractBinary]`*:
Parse all the fields from `cls._datafieldtypes` from `bfr`
by calling `cls.parse_field(fieldname,bfr)` for each.
Return a mapping of field names to values
suitable for passing to `cls`.

The `fieldtypes` defaults to `cls._datafieldtypes` but may be provided as:
- a mapping of field name to type
- an iterable of field names, whose types will come from
  `cls._datafieldtypes`
- a string being a space separated list of field names,
  whose types will come from `cls._datafieldtypes`

Each of these will be converted to a mapping and then
promoted with `promote_fieldtypemap`.

*`MVHDBoxBody.promote_field_value(fieldname: str, obj)`*:
Promote a received `obj` to the appropriate `AbstractBinary` instance.

*`MVHDBoxBody.self_check(self)`*:
An `@binclass` class instance's raw fields are in `self._data`.

*`MVHDBoxBody.transcribe(self)`*:
Transcribe this instance.
- <a name="parse_tags"></a>`parse_tags(path, tag_prefix=None)`: Parse the tags from `path`.
  Yield `(box,tags)` for each subbox with tags.

  The optional `tag_prefix` parameter
  may be specified to prefix each tag name with a prefix.
  Other keyword arguments are passed to `parse()`
  (typical example: `discard_data=True`).
- <a name="PDINBoxBody"></a>`class PDINBoxBody(FullBoxBody2)`: A 'pdin' Progressive Download Information box - ISO14496 section 8.1.3.

*`PDINBoxBody.PDInfo`*
- <a name="SMHDBoxBody"></a>`class SMHDBoxBody(SMHDBoxBody__original)`: A 'smhd' Sound Media Headerbox - section 12.2.2.

*`SMHDBoxBody.__getattr__(self, attr: str)`*:
Return a data field value, the `.value` attribute if it is a single value field.

*`SMHDBoxBody.__setattr__(self, attr, value)`*:
Set a data field from `value`.

*`SMHDBoxBody.parse(bfr: cs.buffer.CornuCopyBuffer)`*:
Parse an instance from `bfr`.
This default implementation calls `cls(**cls.parse_fields(bfr))`.

*`SMHDBoxBody.parse_field(fieldname: str, bfr: cs.buffer.CornuCopyBuffer, fieldtypes: Optional[Mapping[str, type]] = None)`*:
Parse an instance of the field named `fieldname` from `bfr`.
Return the field instance.

*`SMHDBoxBody.parse_fields(bfr: cs.buffer.CornuCopyBuffer, fieldtypes: Union[Mapping[str, type], Iterable[str], str, NoneType] = None) -> Mapping[str, cs.binary.AbstractBinary]`*:
Parse all the fields from `cls._datafieldtypes` from `bfr`
by calling `cls.parse_field(fieldname,bfr)` for each.
Return a mapping of field names to values
suitable for passing to `cls`.

The `fieldtypes` defaults to `cls._datafieldtypes` but may be provided as:
- a mapping of field name to type
- an iterable of field names, whose types will come from
  `cls._datafieldtypes`
- a string being a space separated list of field names,
  whose types will come from `cls._datafieldtypes`

Each of these will be converted to a mapping and then
promoted with `promote_fieldtypemap`.

*`SMHDBoxBody.promote_field_value(fieldname: str, obj)`*:
Promote a received `obj` to the appropriate `AbstractBinary` instance.

*`SMHDBoxBody.self_check(self)`*:
An `@binclass` class instance's raw fields are in `self._data`.

*`SMHDBoxBody.transcribe(self)`*:
Transcribe this instance.
- <a name="STCOBoxBody"></a>`class STCOBoxBody(FullBoxBody)`: A 'stco' Chunk Offset box - section 8.7.5.

*`STCOBoxBody.chunk_offsets`*:
Parse the `UInt32BE` chunk offsets from stashed buffer.

*`STCOBoxBody.parse_fields(self, bfr: cs.buffer.CornuCopyBuffer)`*:
Gather the `entry_count` and `chunk_offsets` fields.

*`STCOBoxBody.transcribe(self)`*:
Transcribe a `STCOBoxBody`.
- <a name="STDPBoxBody"></a>`class STDPBoxBody(STDPBoxBody__original)`: A `STDPBoxBody` is a DegradationPriorityBox - ISO14496 section 8.5.3.2.

*`STDPBoxBody.__getattr__(self, attr: str)`*:
Return a data field value, the `.value` attribute if it is a single value field.

*`STDPBoxBody.__setattr__(self, attr, value)`*:
Set a data field from `value`.

*`STDPBoxBody.parse(bfr: cs.buffer.CornuCopyBuffer)`*:
Parse an instance from `bfr`.
This default implementation calls `cls(**cls.parse_fields(bfr))`.

*`STDPBoxBody.parse_field(fieldname: str, bfr: cs.buffer.CornuCopyBuffer, fieldtypes: Optional[Mapping[str, type]] = None)`*:
Parse an instance of the field named `fieldname` from `bfr`.
Return the field instance.

*`STDPBoxBody.parse_fields(bfr: cs.buffer.CornuCopyBuffer, fieldtypes: Union[Mapping[str, type], Iterable[str], str, NoneType] = None) -> Mapping[str, cs.binary.AbstractBinary]`*:
Parse all the fields from `cls._datafieldtypes` from `bfr`
by calling `cls.parse_field(fieldname,bfr)` for each.
Return a mapping of field names to values
suitable for passing to `cls`.

The `fieldtypes` defaults to `cls._datafieldtypes` but may be provided as:
- a mapping of field name to type
- an iterable of field names, whose types will come from
  `cls._datafieldtypes`
- a string being a space separated list of field names,
  whose types will come from `cls._datafieldtypes`

Each of these will be converted to a mapping and then
promoted with `promote_fieldtypemap`.

*`STDPBoxBody.promote_field_value(fieldname: str, obj)`*:
Promote a received `obj` to the appropriate `AbstractBinary` instance.

*`STDPBoxBody.self_check(self)`*:
An `@binclass` class instance's raw fields are in `self._data`.

*`STDPBoxBody.transcribe(self)`*:
Transcribe this instance.
- <a name="STSCBoxBody"></a>`class STSCBoxBody(FullBoxBody)`: 'stsc' (Sample Table box - section 8.7.4.1.

*`STSCBoxBody.STSCEntry`*

*`STSCBoxBody.entries`*:
A list of `int`s parsed from the `STSCEntry` list.

*`STSCBoxBody.parse_fields(self, bfr: cs.buffer.CornuCopyBuffer)`*:
Gather the `entry_count` and `entries` fields.

*`STSCBoxBody.transcribe(self)`*:
Transcribe a `STSCBoxBody`.
- <a name="STSDBoxBody"></a>`class STSDBoxBody(STSDBoxBody__original)`: A `STSDBoxBody` is a SampleDescriptionBoxBody - ISO14496 section 8.5.2.2.

*`STSDBoxBody.__getattr__(self, attr: str)`*:
Return a data field value, the `.value` attribute if it is a single value field.

*`STSDBoxBody.__setattr__(self, attr, value)`*:
Set a data field from `value`.

*`STSDBoxBody.parse(bfr: cs.buffer.CornuCopyBuffer)`*:
Parse an instance from `bfr`.
This default implementation calls `cls(**cls.parse_fields(bfr))`.

*`STSDBoxBody.parse_field(fieldname: str, bfr: cs.buffer.CornuCopyBuffer, fieldtypes: Optional[Mapping[str, type]] = None)`*:
Parse an instance of the field named `fieldname` from `bfr`.
Return the field instance.

*`STSDBoxBody.parse_fields(bfr: cs.buffer.CornuCopyBuffer, fieldtypes: Union[Mapping[str, type], Iterable[str], str, NoneType] = None) -> Mapping[str, cs.binary.AbstractBinary]`*:
Parse all the fields from `cls._datafieldtypes` from `bfr`
by calling `cls.parse_field(fieldname,bfr)` for each.
Return a mapping of field names to values
suitable for passing to `cls`.

The `fieldtypes` defaults to `cls._datafieldtypes` but may be provided as:
- a mapping of field name to type
- an iterable of field names, whose types will come from
  `cls._datafieldtypes`
- a string being a space separated list of field names,
  whose types will come from `cls._datafieldtypes`

Each of these will be converted to a mapping and then
promoted with `promote_fieldtypemap`.

*`STSDBoxBody.promote_field_value(fieldname: str, obj)`*:
Promote a received `obj` to the appropriate `AbstractBinary` instance.

*`STSDBoxBody.self_check(self)`*:
An `@binclass` class instance's raw fields are in `self._data`.

*`STSDBoxBody.transcribe(self)`*:
Transcribe this instance.
- <a name="STSZBoxBody"></a>`class STSZBoxBody(FullBoxBody)`: A 'stsz' Sample Size box - section 8.7.3.2.

*`STSZBoxBody.entry_sizes`*:
Parse the `UInt32BE` entry sizes from stashed buffer
into a list of `int`s.

*`STSZBoxBody.parse_fields(self, bfr: cs.buffer.CornuCopyBuffer)`*:
Gather the `sample_size`, `sample_count`, and `entry_sizes` fields.

*`STSZBoxBody.transcribe(self)`*:
Transcribe the `STSZBoxBody`.
- <a name="STZ2BoxBody"></a>`class STZ2BoxBody(FullBoxBody)`: A 'stz2' Compact Sample Size box - section 8.7.3.3.

*`STZ2BoxBody.parse_fields(self, bfr: cs.buffer.CornuCopyBuffer)`*:
Gather the `field_size`, `sample_count` and `entry_sizes` fields.

*`STZ2BoxBody.transcribe(self)`*:
Transcribe the STZ2BoxBody.
- <a name="TimeStamp32"></a>`class TimeStamp32(cs.binary.UInt32BE, TimeStampMixin)`: The 32 bit form of an ISO14496 timestamp.
- <a name="TimeStamp64"></a>`class TimeStamp64(cs.binary.UInt64BE, TimeStampMixin)`: The 64 bit form of an ISO14496 timestamp.
- <a name="TimeStampMixin"></a>`class TimeStampMixin`: Methods to assist with ISO14496 timestamps.

*`TimeStampMixin.datetime`*:
This timestamp as an UTC datetime.

*`TimeStampMixin.unixtime`*:
This timestamp as a UNIX time (seconds since 1 January 1970).
- <a name="TKHDBoxBody"></a>`class TKHDBoxBody(TKHDBoxBody__original)`: A 'tkhd' Track Header box - ISO14496 section 8.2.2.

*`TKHDBoxBody.__getattr__(self, attr: str)`*:
Return a data field value, the `.value` attribute if it is a single value field.

*`TKHDBoxBody.__setattr__(self, attr, value)`*:
Set a data field from `value`.

*`TKHDBoxBody.parse(bfr: cs.buffer.CornuCopyBuffer)`*:
Parse an instance from `bfr`.
This default implementation calls `cls(**cls.parse_fields(bfr))`.

*`TKHDBoxBody.parse_field(fieldname: str, bfr: cs.buffer.CornuCopyBuffer, fieldtypes: Optional[Mapping[str, type]] = None)`*:
Parse an instance of the field named `fieldname` from `bfr`.
Return the field instance.

*`TKHDBoxBody.parse_fields(bfr: cs.buffer.CornuCopyBuffer, fieldtypes: Union[Mapping[str, type], Iterable[str], str, NoneType] = None) -> Mapping[str, cs.binary.AbstractBinary]`*:
Parse all the fields from `cls._datafieldtypes` from `bfr`
by calling `cls.parse_field(fieldname,bfr)` for each.
Return a mapping of field names to values
suitable for passing to `cls`.

The `fieldtypes` defaults to `cls._datafieldtypes` but may be provided as:
- a mapping of field name to type
- an iterable of field names, whose types will come from
  `cls._datafieldtypes`
- a string being a space separated list of field names,
  whose types will come from `cls._datafieldtypes`

Each of these will be converted to a mapping and then
promoted with `promote_fieldtypemap`.

*`TKHDBoxBody.promote_field_value(fieldname: str, obj)`*:
Promote a received `obj` to the appropriate `AbstractBinary` instance.

*`TKHDBoxBody.self_check(self)`*:
An `@binclass` class instance's raw fields are in `self._data`.

*`TKHDBoxBody.transcribe(self)`*:
Transcribe this instance.
- <a name="TrackGroupTypeBoxBody"></a>`class TrackGroupTypeBoxBody(FullBoxBody)`: A TrackGroupTypeBoxBody contains a track group id - ISO14496 section 8.3.3.2.

*`TrackGroupTypeBoxBody.parse_fields(self, bfr: cs.buffer.CornuCopyBuffer)`*:
Gather the `track_group_id` field.
- <a name="TrackReferenceTypeBoxBody"></a>`class TrackReferenceTypeBoxBody(BoxBody)`: A TrackReferenceTypeBoxBody contains references to other tracks - ISO14496 section 8.3.3.2.

*`TrackReferenceTypeBoxBody.parse_fields(self, bfr: cs.buffer.CornuCopyBuffer)`*:
Gather the `track_ids` field.
- <a name="TREFBoxBody"></a>`class TREFBoxBody(ContainerBoxBody)`: Track Reference BoxBody, container for trackReferenceTypeBoxes - ISO14496 section 8.3.3.
- <a name="TTSB_Sample"></a>`class TTSB_Sample(builtins.tuple)`: TTSB_Sample(count, delta)

*`TTSB_Sample.__replace__(self, /, **kwds)`*:
Return a new TTSB_Sample object replacing specified fields with new values

*`TTSB_Sample.count`*:
Alias for field number 0

*`TTSB_Sample.delta`*:
Alias for field number 1
- <a name="URL_BoxBody"></a>`class URL_BoxBody(FullBoxBody)`: An 'url ' Data Entry URL BoxBody - section 8.7.2.1.

*`URL_BoxBody.parse_fields(self, bfr: cs.buffer.CornuCopyBuffer)`*:
Gather the `location` field.
- <a name="URN_BoxBody"></a>`class URN_BoxBody(FullBoxBody)`: An 'urn ' Data Entry URL BoxBody - section 8.7.2.1.

*`URN_BoxBody.parse_fields(self, bfr: cs.buffer.CornuCopyBuffer)`*:
Gather the `name` and `location` fields.

*`URN_BoxBody.transcribe(self)`*:
Transcribe a `URN_BoxBody`.
- <a name="UTF8or16Field"></a>`class UTF8or16Field(cs.binary.SimpleBinary)`: An ISO14496 UTF8 or UTF16 encoded string.

*`UTF8or16Field.parse(bfr: cs.buffer.CornuCopyBuffer)`*:
Gather optional BOM and then UTF8 or UTF16 string.

*`UTF8or16Field.transcribe(self)`*:
Transcribe the field suitably encoded.
- <a name="VMHDBoxBody"></a>`class VMHDBoxBody(VMHDBoxBody__original)`: A 'vmhd' Video Media Headerbox - section 12.1.2.

*`VMHDBoxBody.__getattr__(self, attr: str)`*:
Return a data field value, the `.value` attribute if it is a single value field.

*`VMHDBoxBody.__setattr__(self, attr, value)`*:
Set a data field from `value`.

*`VMHDBoxBody.parse(bfr: cs.buffer.CornuCopyBuffer)`*:
Parse an instance from `bfr`.
This default implementation calls `cls(**cls.parse_fields(bfr))`.

*`VMHDBoxBody.parse_field(fieldname: str, bfr: cs.buffer.CornuCopyBuffer, fieldtypes: Optional[Mapping[str, type]] = None)`*:
Parse an instance of the field named `fieldname` from `bfr`.
Return the field instance.

*`VMHDBoxBody.parse_fields(bfr: cs.buffer.CornuCopyBuffer, fieldtypes: Union[Mapping[str, type], Iterable[str], str, NoneType] = None) -> Mapping[str, cs.binary.AbstractBinary]`*:
Parse all the fields from `cls._datafieldtypes` from `bfr`
by calling `cls.parse_field(fieldname,bfr)` for each.
Return a mapping of field names to values
suitable for passing to `cls`.

The `fieldtypes` defaults to `cls._datafieldtypes` but may be provided as:
- a mapping of field name to type
- an iterable of field names, whose types will come from
  `cls._datafieldtypes`
- a string being a space separated list of field names,
  whose types will come from `cls._datafieldtypes`

Each of these will be converted to a mapping and then
promoted with `promote_fieldtypemap`.

*`VMHDBoxBody.promote_field_value(fieldname: str, obj)`*:
Promote a received `obj` to the appropriate `AbstractBinary` instance.

*`VMHDBoxBody.self_check(self)`*:
An `@binclass` class instance's raw fields are in `self._data`.

*`VMHDBoxBody.transcribe(self)`*:
Transcribe this instance.

# Release Log



*Release 20260531*:
* BoxBody: provide a default boxes=() class attribute; drop HasBoxesMixin, already covered by BoxBody.__getattr__.
* Box.ancestor: raise ValueError if no matching ancestor is found.
* Box.BOX_TYPE: raise AttributeError if we cannot derive the type from the class name.
* Box.walk: yield (level,box,subboxes) 3-tuples to allow the called to track depth.
* MP4Command: rename cmd_parse to cmd_scan.
* BoxBody.__iter__: iterate self.boxes, not (), now that we always have a self.boxes.
* Box,BoxHeader: support for boxes with a UUID as the type.
* drop dump_box() in favour of new Box.dump_table and box.dump methods, add a recursion limit to Box.walk.
* Box: new .descendants() method to scan a Box hierarchy for boxes of specified types.
* MP4Command.cmd_scan: accept just one filename, following arguments are box types of interest.
* BoxBody.parse_field: accept ... in addition to an int to parse raw bytes.
* Drop OverBox.
* @boxbodyclass: decorator wrapping @binclass which reregisters the new class as the body handler for its box type.
* New FulBoxBody2 @binclass based class, hopefully will replace FullBoxBody in the fullness of time.
* Drop parse_fields(), obsoleted by Box.scan().
* Refactor the ILST box schemas as namedtuples.
* New ListOfBoxes(ListOfBinary,item_type=Box) class.
* Reimplement several box classes using @binclass.
* Box.box_type_s: ensure an ASCII box type is entirely printable (no control characters).
* ILSTBoxBody: make a SUBBOX_SCHEMA_BY_LONG_ATTRIBUTE to avoid a linear search in __getattr__.
* Box.parse: new body_type_for=None parameter for providing a custom box_type->BoxBody-class function, intended for the ILST subboxes.
* Drop the top level parse() function.
* Box: new .report_table() and .report() analogues for .dump_table() and .dump() but with human friendly summary information.
* Drop top level report() function, supplanted by Box.report_table() and Box.report().
* Box: new __len__ returning the parsed length from .offset and .end_offset; new __bool__ returning True to avoid implied call of len() for truthiness.
* Assorted other changes.

*Release 20241122*:
Replace many raises of RuntimeError with NotImplementedError, suggestion by @dimaqq on disucss.python.org.

*Release 20240422*:
* Replace dropped UTF16NULField with BinaryUTF16NUL.
* Comment out unused CO64BoxBody.chunk_offsets, uses dropped (and not replaced) deferred_field.
* Drop FallbackBoxBody, we'll just use BoxBody when there's no box specific subclass.
* Replace pick_boxbody_class with BoxBody.for_box_type.
* Rename boxbody_type_from_klass to boxbody_type_from_class.
* Drop obsolete KNOWN_BOXBODY_CLASSES.
* MP4Command.cmd_info: print moov.udta.meta.ilst.cover in SIXEL format on a terminal.
* Rename parse_deref_path to get_deref_path like other lexical functions.
* ILSTBoxBody.__getattr__: fix lookup of long names.

*Release 20231129*:
Small updates and fixes.

*Release 20230212*:
* Drop cs.context.StackableState in favour of cs.threads.State.
* MP4Command.cmd_autotag: use @uses_fstags for the fstags parameter.

*Release 20220606*:
Update obsolete use of Tag.with_prefix.

*Release 20210306*:
* Huge refactor of the Box classes to the new Binary* classes from cs.binary.
* mp4: new "tags" subcommand to print the tags parsed from a file.
* BoxHeader: fix the definition of MAX_BOX_SIZE_32.
* BoxBody: new parse_boxes utility method to part the remainder of a Box as subBoxes.
* MP4.cmd_parse: run the main parse in discard_data=True mode.
* METABoxBody.__getattr__: fix ILST typo.
* MP4Command: update for new cs.cmdutils.BaseCommand API.
* Many small fixes and tweaks.

*Release 20200229*:
* ILST: recognise @cpy as copyright, sfID as itunes_store_country_code.
* ILST: new SFID_ISO_3166_1_ALPHA_3_CODE and STIK_MEDIA_TYPES providing context data for various field values, as yet unused.
* Make various list fields of some boxes deferred because they are expensive to parse (uses new cs.binary deferred_field).
* add_generic_sample_boxbody: drop __iter__, causes dumb iterators to parse the samples.
* ILST: iTunes "Date" metadata seem to contain plain years or ISO8601 datestamps.
* mp4 autotag: add -n (no action) and -p,--prefix (set tag prefix, default 'mp4') options.
* mp4 autotag: use "mp4." as the tag prefix.

*Release 20200130*:
* Parsing of ILST boxes (iTunes metadata).
* Command line: new "info" subcommand reporting metadata, "autotag" applying metadata to fstags.
* Box tree walk, ancestor, iteration.
* Assorted cleanups and internal changes.

*Release 20190220*:
parse_buffer yields instead of returns; some small bugfixes.

*Release 20180810*:
* parse_fd(): use a mmap to access the descriptor if a regular file and not discard_data;
* this lets us use the mmapped file as backing store for the data, a big win for the media sections.

*Release 20180805*:
Initial PyPI release.
