While adding functionality for exporting and importing DMS-1 metadata to our application I came across a rather peculiar behaviour which I'm unsure if it's due to my dictionary not having been written entirely correct or if it's a problem with MXFLib. I'd wager the former.
I have written my own bare-minimum DMS-1 dictionary that manages to capture all previously dark metadata in one of our example files. I have MXFLib parse the library and the input file and then traverse the resulting MDObject tree for the tracks we are interested in, and output that as an XML document. That document can be modified and imported later.
The problem is that some strong references won't work if the document is imported after the program has been restarted. More specifically, strongrefs in UUID subVectors cause a problem. This seems to be due to MXFLib expecting a UL for the UUIDs themselves, even though SMPTE 380M has no such ULs defined (as far as I can see).
For example, here's a part of the output from two separate metadata extraction runs. Note that referenceUl differ quite a bit. It is extracted by simply calling MDObject::GetUL() on the reference itself and putting the result in the XML.
Code:
...
<child name="DMS1TitlesSets" ul="060E2B34010101050601010405400400">
<strongReference instanceUid="6292E6BCCC0E73109CF700E0008E0B14" name="DMS1Titles" referenceUl="8B7C75DD44EDA0C039402BC0BE8348E0" ul="060E2B34025301010D01040101100100">
<leaf name="DMS1MainTitle" ul="060E2B34010101030105020100000000">
<stringValue>The Material eXchange Format - Pro-MPEG Forum MXF Promotional Video.</stringValue>
</leaf>
</strongReference>
</child>
...
Code:
...
<child name="DMS1TitlesSets" ul="060E2B34010101050601010405400400">
<strongReference instanceUid="6292E6BCCC0E73109CF700E0008E0B14" name="DMS1Titles" referenceUl="B6F49486183883EBDBDF8165559347CF" ul="060E2B34025301010D01040101100100">
<leaf name="DMS1MainTitle" ul="060E2B34010101030105020100000000">
<stringValue>The Material eXchange Format - Pro-MPEG Forum MXF Promotional Video.</stringValue>
</leaf>
</strongReference>
</child>
...
The following code snippet hopefully sums up the way these strongReference elements are handled in the code:
Code:
ULPtr ul = hexBinaryToULPtr(strongReference->ul);
ULPtr referenceUl = hexBinaryToULPtr(strongReference->referenceUl);
MDObjectPtr targetChild = new MDObject(ul);
target->AddChild(referenceUl)->MakeRef(targetChild);
appendDMS1Children(strongReference, targetChild); //recurse
Now, when I try to import the first of the above examples into a new MXF file the following errors occur:
Code:
Attempting to reference DMS1Titles from Unknown {39402bc0-be83-48e0-8b7c-75dd44eda0c0} (which is not a reference source)
Attempting to reference DMS1Annotation from Unknown {6815efb3-9c9e-4176-abf2-9c23d801e6e8} (which is not a reference source)
Attempting to reference DMS1Participant from Unknown {5c21e84f-a7de-49ad-a6bb-103e0e9504f5} (which is not a reference source)
...
That Unknown UL referencing DMS1Titles clearly matches the referenceUl in the first example.
Finally, In order to fix this issue I went ahead and made up some globalKeys for the UUIDs themselves. In this case 060e2b34.0101.0105.06010104.05400401 (DMS1Titles UL + 1). This resulted in the following metadata instead, which is stable across separate runs. It is also perfectly fine for exporting and importing:
Code:
...
<child name="DMS1TitlesSets" ul="060E2B34010101050601010405400400">
<strongReference instanceUid="6292E6BCCC0E73109CF700E0008E0B14" name="DMS1Titles" referenceUl="060E2B34010101050601010405400401" ul="060E2B34025301010D01040101100100">
<leaf name="DMS1MainTitle" ul="060E2B34010101030105020100000000">
<stringValue>The Material eXchange Format - Pro-MPEG Forum MXF Promotional Video.</stringValue>
</leaf>
</strongReference>
</child>
...
That should be sufficient background information. What I'm wondering is then:
Is my way of inserting strong references correct? I've seen more than one variant in the example code, which differ whether AddChild() is given a UL or not, like so:
Code:
target->AddChild(referenceUl)->MakeRef(targetChild);
versus
Code:
target->AddChild()->MakeRef(targetChild);
Using the latter method unfortunately results in strange behaviour:
Code:
Attempting to reference DMS1ContactsList from DMS1TitlesSets (which is not a reference source)
Malformed batch found in DMS1TitlesSets at 0x00000000 in memory buffer - item size = 2748926090, count = 2920332984, but bytes = 8
...
Finally, does my proto-DMS-1 dictionary look OK? If not, do you have any suggestions, or is there an XML for that floating around somewhere that we could use? I'll dump the entire dictionary in the next post.