A RIFF chunk consists of a four-byte chunk ID ckid (type FOURCC), followed by a four-byte chunk size, ckSize (type ULONG), followed by the data portion of the chunk, followed by a 0 pad byte if ckSize is odd. If ckid is FOURCC_RIFF or FOURCC_LIST, then the first four bytes of the data portion of the chunk are a form type or list type, respectively. ckSize is the size of the chunk data, not including ckid or ckSize or the pad byte (if any), but including the form type or list type (if present).

When mmioDescend is called, it assumes that the current file position is the beginning of a chunk header. If pckinfoParent is given, mmioDescend assumes that the current file position is within pckinfoParent (a RIFF to LIST chunk). If mmioDescend succeeds, the current file position will be either just after the form type or list type (12 bytes from the beginning of the chunk ID) if the chunk ID is FOURCC_RIFF or FOURCC_LIST, or the start of the data portion of the chunk (8 bytes from the beginning of the chunk ID).

For efficiency of RIFF I/O, it is recommended that the hmmio parameter be set up for buffered I/O. Note that the constants, FOURCC_RIFF and FOURCC_LIST, are defined to be the four-character codes, RIFF and LIST, respectively.


[Back] [Next]