mdb.core

Layer 1 base – objects with names.

Layer 0 (mdb.bento) hands back entries keyed by number. This layer gives each object a Python class chosen by its OMFI:ObjID 4CC, decodes values on demand, and resolves object references into live objects.

Two rules shape the design, both learned from the format itself:

Unknown classes must still parse. An unrecognised 4CC becomes a MDBObject with every property readable by its OMF name. Media Composer adds classes; a reader that raises on them is a reader that breaks on next year’s files.

Properties can repeat. MOBJ:MobID is written twice with identical content, a WINL can carry two different FL:PathNameUTF8 values, and DIDD:VideoLineMap genuinely is a multi-value property. Attribute access gives you the last value (what Media Composer appears to use); values() gives you all of them.

class PropertyDef(name, omf_name, deref=False, enum=None, doc='', multi=False)[source]

Bases: object

Binds a Python attribute name to an OMF property name.

deref turns omfi:ObjRef / omfi:ObjRefArray values into objects. enum names a table in mdb.enums so obj.track_kind_name works alongside the raw obj.track_kind.

name
omf_name
deref
enum
doc
multi
class MDBObject(root, object_id, entries)[source]

Bases: object

One object: a set of TOC entries sharing an object ID.

Access properties three ways, in increasing order of rawness:

mob.name                        # typed attribute, per propertydefs
mob["OMFI:CPNT:Name"]           # by OMF property name
mob.values("OMFI:MOBJ:MobID")   # every value, duplicates included
class_id: Optional[str] = None

OMF 4CC; None on abstract bases

propertydefs: Sequence[PropertyDef] = ()
structural_properties: Sequence[str] = ()

OMF property names this class reads structurally rather than through a PropertyDef – the parallel per-point, per-band and per-keyframe columns, and the numerator/denominator pairs that make up a rectangle. They have no single sensible attribute name (there are n of each), so a method assembles them instead; listing them here keeps them visible to known_properties() and to the coverage tests, so a property cannot be quietly forgotten.

object_id
property root: MDBFile
property entries: List[TOCEntry]

The raw TOC entries backing this object, in file order.

property class_name: str

The 4CC actually found in the file, which may not match class_id.

values(omf_name)[source]

Every value written for omf_name, in file order.

Duplicates are normal in this format; this is how you see them.

Return type:

List[Any]

get(omf_name, default=None, deref=False)[source]

The last value written for omf_name, or default.

Return type:

Any

property_names()[source]

OMF names of every property present, in file order, deduplicated.

Return type:

List[str]

items()[source]

(omf_name, last value) for every property present.

Return type:

Iterator[Tuple[str, Any]]

to_dict(deref=False)[source]
Return type:

Dict[str, Any]

classmethod known_properties()[source]

Every OMF property name this class understands, typed or structural.

Return type:

List[str]

type_of(omf_name)[source]

The OMF type name the file declares for omf_name.

Return type:

Optional[str]

referenced_ids()[source]

Object IDs this object points at, via ObjRef and ObjRefArray.

Return type:

List[int]

references()[source]
Return type:

List[MDBObject]

register_class(cls)[source]

Class decorator: bind a Python class to its OMF 4CC.

Return type:

type

class_for(class_id)[source]
Return type:

type

class UnresolvedRef(object_id)[source]

Bases: object

An object reference that does not resolve – kept rather than dropped.

object_id