markreidvfx/pyaaf

MobId gets changed when saving to xml ?

Closed this issue · 1 comments

I did this test and it looks like when saving an aaf in xml format the mobId values get some of its tokens shuffled ? Is this normal?
Here is the repro:

import aaf

f = aaf.open('/tmp/test1.aaf', 'w')
mobIdValue = 'urn:smpte:umid:060a2b34.01010101.01010f00.13000000.5424f02e.c86a14e0.060e2b34.7f7f2a80'
master_mob = f.create.MasterMob('test_mob')
master_mob.mobID = mobIdValue
f.storage.add_mob(master_mob)
f.save('/tmp/test1.aaf') # save aaf
f.save('/tmp/test1.xml') # save xml
f.close()
f = aaf.open('/tmp/test1.aaf')
assert str(f.storage.mobs()[0].mobID) == mobIdValue # values match
f.close()

f = aaf.open('/tmp/test1.xml')
assert str(f.storage.mobs()[0].mobID) == mobIdValue, '%s differs from %s' % (str(f.storage.mobs()[0].mobID), mobIdValue)
f.close()

if bytes 16-21 are 060e2b347f7f2 a byte swap occurs on the material id

5424f02e.c86a14e0.060e2b34.7f7f2a80
gets swapped to
060e2b34.7f7f2a80.5424f02e.c86a14e0

see
https://github.com/markreidvfx/pyaaf/blob/dev/aaf/util/MobID.pyx#L164
I matched what the sdk does in the latest dev branch, and the MobID class should do the correct thing regardless of the order. Why the SDK swaps it this way, I don't know.