The Stream Header 'strl' Chunks

The main header is followed by one or more 'strl' chunks. A 'strl' chunk is required for each data stream. These chunks contain information about the streams in the file. Each 'strl' chunk must contain a stream header and stream format chunk. Stream header chunks are identified by the 'strh' four-character code and stream format chunks are identified by the 'strf' four-character code. In addition to the stream header and stream format chunks, the "strl" chunk might also contain a stream data chunk. Stream data chunks are identified with the four-character code "strd".

The stream header has the following data structure defined for it:

typedef struct {
    FOURCC fccType;
    FOURCC fccHandler;
    ULONG  ulFlags;
    ULONG  ulReserved1;
    ULONG  ulInitialFrames;
    ULONG  ulScale;
    ULONG  ulRate;
    ULONG  ulStart;
    ULONG  ulLength;
    ULONG  ulSuggestedBufferSize;
    ULONG  ulQuality;
    ULONG  ulSampleSize;
    ULONG  ulReserved[2];
} AVIStreamHeader;

The stream header specifies the type of data the stream contains, such as audio or video, by means of a four-character code. The fccType field is set to 'vids' if the stream it specifies contains video data. It is set to 'auds' if it contains audio data.

The fccHandler field contains a four-character code describing the installable decompressor used with the data.

The ulFlags field contains any flags for the data stream. The AVISF_DISABLED flag indicates that the stream data should be rendered only when explicitly enabled by the user.

The ulInitialFrames is used for interleaved files. If you are creating interleaved files with audio skewing, specify the number of audio frames in the file prior to the initial video frame of the AVI sequence in this field.

The remaining fields describe the playback characteristics of the stream. These factors include the playback rate (ulScale and ulRate), the starting time of the sequence (ulStart), the length of the sequence (ulLength), the size of the playback buffer (ulSuggestedBuffer), an indicator of the data quality (ulQuality), and sample size (ulSampleSize). See the reference section for more information on these fields.

Some of the fields in the stream header structure are also present in the main header structure. The data in the main header structure applies to the whole file while the data in the stream header structure applies only to a stream.

A stream format 'strf' chunk must follow a stream header 'strh' chunk. The stream format chunk describes the format of the data in the stream. For video streams, the information in this chunk is a Windows BITMAPINFO structure (including palette information if appropriate). For audio streams, the information in this chunk is a Windows WAVEFORMATX or PCMWAVEFORMAT structure.

The 'strl' chunk might also contain a stream data 'strd' chunk. If used, this chunk follows the stream format chunk. The format and content of this chunk is defined by installable decompressors. Typically, decompressors use this information for configuration. Applications that read and write RIFF files do not need to decode this information. They transfer this data to and from a decompressor as a memory block.

An AVI player associates the stream headers in the LIST 'hdrl' chunk with the stream data in the LIST 'movi' chunk by using the order of the 'strl' chunks. The first 'strl' chunk applies to stream 0, the second applies to stream 1, and so forth. For example, if the first 'strl' chunk describes the video data, the video data is contained in stream 0. Similarly, if the second 'strl' chunk describes audio data, then the audio data is contained in stream 1.


[Back: The Main AVI Header LIST]
[Next: The LIST 'movi' Chunk]