Overview
Chunk files are files that contain continuous media data with information about
the data that would be constructed by file objects preparsed.
The motivation to use chunk file formats instead of the original file format is
to speed file object creation since it would no longer have to construct the
ancilliary information stored with the data in chunk files.
Chunk files are
created and accessed through routines in cmChunk.c in the CM library (libcm.a).
A chunk file consists of one or more chunks of data.
Each chunk contains a it's type and length. The basic model of how to use
the chunk file routines to access this data is:
- Open the chunk file using Chunk_OpenFile.
This command will return a pointer to a chunk file data structure.
- Find the chunk type you are looking for with Chunk_FindType
This command fines the first chunk fo the specified type and fills in a chunk
header structure that contains the size of this chunk. The file descriptor
contained in the chunk file data structure is set to the beginning of this
chunk's data.
- Read data from the file using the file descriptor in the chunk file data structure.
There are other commands in the chunk module that allow you to "rewind",
write chunks, etc. The various chunk type macros are contained in
cmCookies.h and the format of specific chunk file formats for different types of
data is described individually in separate pages (see links below).
Currently, the following data formats have chunk file formats associated with them:
Motion JPEG
MPEG
SPARC audio (i.e., .au files)
Utilities exist from converting from different data formats to the corresponding
chunk file formats. These utiltities are briefly described in each of the format
description pages found in the links above.