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
Sample table atom ('stbl')Seeking with a QuickTime fileSample description atom ('stsd')Time-to-sample atom ('stts')Creating video tracks at 30 frames per secondCreating video tracks at 29.97 frames per secondCreating sound tracks at 44.1 kHzComposition offset atom ('ctts')Composition shift least greatest atom ('cslg')Sync sample atom ('stss')Partial sync sample atom ('stps')Sample-to-chunk atom ('stsc')Referencing two data files with a single trackSample size atom ('stsz')Chunk offset atom ('stco')