< Previous PageNext Page > Hide TOC

Random Access

This appendix describes how to seek with a QuickTime file using child atoms.

Seeking With a QuickTime File

Seeking with a QuickTime file is accomplished primarily by using the child atoms contained in the sample table atom. If an edit list is present, it must also be consulted. If you want to seek a given track to a time T, where T is in the time scale of the movie header atom, you could perform the following operations:

  1. If the track contains an edit list, determine which edit contains the time T by iterating over the edits. The start time of the edit in the movie time scale must then be subtracted from the time T to generate T', the duration into the edit in the movie time scale. T' is next converted to the time scale of the track’s media to generate T''. Finally, the time in the media scale to use is calculated by adding the media start time of the edit to T''.

  2. The time-to-sample atom for a track indicates what times are associated with which sample for that track. Use this atom to find the first sample prior to the given time.

  3. The sample that was located in step 1 may not be a random access point. Locating the nearest random access point requires consulting two atoms. The sync sample table indicates which samples are in fact random access points. Using this table, you can locate which is the first sync sample prior to the specified time. The absence of the sync sample table indicates that all samples are synchronization points, and makes this problem easy. The shadow sync atom gives the opportunity for a content author to provide samples that are not delivered in the normal course of delivery, but which can be inserted to provide additional random access points. This improves random access without impacting bitrate during normal delivery. This atom maps samples that are not random access points to alternate samples which are. You should also consult this table if present to find the first shadow sync sample prior to the sample in question. Having consulted the sync sample table and the shadow sync table, you probably wish to seek to whichever resultant sample is closest to, but prior to, the sample found in step 1.

  4. At this point you know the sample that will be used for random access. Use the sample-to-chunk table to determine in which chunk this sample is located.

  5. Knowing which chunk contained the sample in question, use the chunk offset atom to figure out where that chunk begins.

  6. Starting from this offset, you can use the information contained in the sample-to-chunk atom and the sample size atom to figure out where within this chunk the sample in question is located. This is the desired information.



< Previous PageNext Page > Hide TOC


© 2004, 2007 Apple Inc. All Rights Reserved. (Last updated: 2007-09-04)


Did this document help you?
Yes: Tell us what works for you.
It’s good, but: Report typos, inaccuracies, and so forth.
It wasn’t helpful: Tell us what would have helped.