Contents

Using composition offset and composition shift least greatest atoms

Calculate the offset shift when you store an out of order video stream’s sample table.

Overview

Calculate the offset shift with code similar to the following example:

leastDisplayOffset = min { display offsets of all samples }
greatestDisplayOffset = max { display offsets of all samples }
if( leastDisplayOffset < 0 )
  compositionOffsetToDisplayOffsetShift = leastDisplayOffset;
else
  compositionOffsetToDisplayOffsetShift = 0;

These values are stored in a composition shift least greatest atom within the sample table atom.

Then write a composition offset table atom that stores the display offsets, adjusting each offset by subtracting compositionOffsetToDisplayOffsetShift:

compositionOffset[n] = displayOffset[n] - compositionOffsetToDisplayOffsetShift;

See Also

Describing samples