The basic building block of a RIFF file is called a chunk. Each chunk consists of the following fields:
A four-character code specifying the chunk ID
A DWORD specifying the size of the data field in the chunk
A data field
The only chunks allowed to contain other chunks (subchunks) are those with a chunk ID of “RIFF” or “LIST”. The first chunk in a RIFF file must be a “RIFF” chunk. All other chunks in the file are subchunks of the “RIFF” chunk.
“RIFF” chunks include an additional field in the first four bytes of the data
field. This additional field provides the form type of the field. The form type is
a four-character code identifying the format of the data stored in the file. For example, Microsoft waveform audio files (WAVE files) have a form type of “WAVE”. The following illustration shows a “RIFF” chunk containing two subchunks:
“LIST” chunks also include an additional field in the first four bytes of the data field. This additional field contains the list type of the field. The list type is a four-character code identifying the contents of the list. For example, a “LIST” chunk with a list type of “INFO” can contain “ICOP” and “ICRD” chunks providing copyright and creation date information. The following illustration shows a “RIFF” chunk containing a “LIST” chunk and one other subchunk (the “LIST” chunk contains two subchunks):