13.07.2015 Views

Quicktime File Format (2012-08-14).pdf

Quicktime File Format (2012-08-14).pdf

Quicktime File Format (2012-08-14).pdf

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

Media Data Atom TypesSound MediaThe new fields correspond to the CompressionInfo structure used by the Macintosh Sound Manager (whichuses 16-bit values) to describe the compression ratio of fixed ratio audio compression algorithms. If these fieldsare not used, they are set to 0. <strong>File</strong> readers only need to check to see if samplesPerPacket is 0.Redefined Sample TablesIf the compression ID in the sample description is set to –2, the sound track uses redefined sample tablesoptimized for compressed audio.Unlike video media, the data structures for QuickTime sound media were originally designed for uncompressedsamples. The extended version 1 sound description structure provides a great deal of support for compressedaudio, but it does not deal directly with the sample table atoms that point to the media data.The ordinary sample tables do not point to compressed frames, which are the fundamental units of compressedaudio data. Instead, they appear to point to individual uncompressed audio samples, each one byte in size,within the compressed frames. When used with the QuickTime API, QuickTime compensates for this fiction ina largely transparent manner, but attempting to parse the sound samples using the original sample tablesalone can be quite complicated.With the introduction of support for the playback of variable bit-rate (VBR) audio in QuickTime 4.1, the contentsof a number of these fields were redefined, so that a frame of compressed audio is treated as a single mediasample. The sample-to-chunk and chunk offset atoms point to compressed frames, and the sample size tabledocuments the size of the frames. The size is constant for CBR audio, but can vary for VBR.The time-to-sample table documents the duration of the frames. If the time scale is set to the sampling rate,which is typical, the duration equals the number of uncompressed samples in each frame, which is usuallyconstant even for VBR (it is common to use a fixed frame duration). If a different media timescale is used, it isnecessary to convert from timescale units to sampling rate units to calculate the number of samples.This change in the meaning of the sample tables allows you to use the tables accurately to find compressedframes.To indicate that this new meaning is used, a version 1 sound description is used and the compression ID fieldis set to –2. The samplesPerPacket field and the bytesPerSample field are not necessarily meaningful forvariable bit rate audio, but these fields should be set correctly in cases where the values are constant; the othertwo new fields ( bytesPerPacket and bytesPerFrame) are reserved and should be set to 0.If the compression ID field is set to zero, the sample tables describe uncompressed audio samples and cannotbe used directly to find and manipulate compressed audio frames. QuickTime has built-in support that allowsprogrammers to act as if these sample tables pointed to uncompressed 1-byte audio samples.<strong>2012</strong>-<strong>08</strong>-<strong>14</strong> | © 2004, <strong>2012</strong> Apple Inc. All Rights Reserved.180

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!