Context:
I was having problems with AAF files generated by Avid
XPressDV when TitleMotion titles were present on the
timeline. The titles would come back in corrupted, the
rest would be correct.
Cause:
I traced this to a problem in the property storage in OM
where property sizes are stored as 16 bit even though
the full data is stored. The following routine updates the
stored object property index table and writes the data.
The incoming size is a size_t (32 bit) value, while the
length parameter of the
OMStoredPropertySetIndex::insert method is of type
OMPropertySize (an UInt16). Since the rest of the
variable array handling code works with 32 bit sizes,
nothing fails, except that on read-back most of the data
is ignored.
here is the write routine that illustrates the problem:
void OMMSSStoredObject::write(
OMPropertyId propertyId,
OMStoredForm storedForm,
void* start,
size_t size)
{
TRACE("OMMSSStoredObject::write");
PRECONDITION("Valid data", start != 0);
PRECONDITION("Valid size", size > 0);
// size is a 32 bit value going into a 16 bit parameter
_index->insert(propertyId, storedForm, _offset, size);
// Write property value.
//
// This writes the full set of data
writeToStream(_properties, start, size);
_offset += size;
}
Unfortunately simply making the size field in the
storedPropertySetIndex 32 bit will make the files
incompatible with older AAF libraries.
I have attached a zip file with a problem AAF file. Note
that the total title information is supposed to be 69718
bytes, but only 4182 bytes are returned.
Zip file with one Problem.aaf that illustrates the problem