Identifying an I/O Procedure

Each file format is represented by a unique identifier called a four-character code (FOURCC). A FOURCC is a 32-bit quantity representing a sequence of one to four ASCII alphanumeric characters (padded on the right with blank characters).

Each IOProc supports a specific file format. The file format and IOProc are represented by a specific FOURCC code. This permits the FOURCC to be used as an ID value, rather than the string-name of the file format or a file name extension. Their use is supported by a set of functions to pack or unpack FOURCC values from or to their component characters. Examples of FOURCC values are: WAVE for RIFF waveform audio files, RMID for RIFF MIDI files, and AVCA for AVC audio files.

Formats that support multiple media types require a different FOURCC for each variation. This appears as a different IOProc for each media type. For example, an Audio Visual Connection (AVC) program might have an IOProc to process image, an IOProc to process audio, and an IOProc to process MIDI. You can, however, include more than one IOProc in a dynamic-link library (DLL) file by providing different entry points in the DLL file.

The data type for a four-character code is FOURCC. The mmioFOURCC function converts four characters to a four-character code as shown:

            FOURCC   fccIOProc;

            fccIOProc = mmioFOURCC( 'A', 'V', 'C', 'A' ) ;

The mmioFOURCC function is called by the application and passed in subsequent MMIO calls to route the file to the correct IOProc.

Note: Another way to create a four-character code is to use the mmioStringToFOURCC function, which converts a null-terminated string to a four-character code. The second parameter in mmioStringToFOURCC specifies options for converting the string to a four-character code. If you specify the MMIO_TOUPPER flag, mmioStringToFOURCC converts all alphabetic characters in the string to uppercase.