Jump to content

mmioFOURCC

From EDM2

The mmioFOURCC macro converts four individual characters into a single FOURCC (four-character code). FOURCCs are used extensively in RIFF files to identify chunks, form types, and list types.

Syntax

#define INCL_MMIOOS2
#include <os2.h>

FOURCC mmioFOURCC(CHAR ch0, CHAR ch1, CHAR ch2, CHAR ch3);

Parameters

ch0 (CHAR) - input
The first character of the code. This character is stored at the lowest memory address of the resulting FOURCC.
ch1 (CHAR) - input
The second character of the code.
ch2 (CHAR) - input
The third character of the code.
ch3 (CHAR) - input
The fourth character of the code. This character is stored at the highest memory address of the resulting FOURCC.

Return Values

rc (FOURCC)
Returns the 32-bit four-character code constructed from the input characters. The mapping follows a little-endian layout where:
  • Byte 0 = `ch0`
  • Byte 1 = `ch1`
  • Byte 2 = `ch2`
  • Byte 3 = `ch3`

Remarks

This macro is a compile-time convenience and does not perform validation on the characters used. It assumes the caller is providing exactly four characters.

If you need to convert a null-terminated string to a FOURCC at runtime, or if you need the string to be automatically padded with spaces to reach four characters, use the mmioStringToFOURCC function instead.

Example Code

The following example shows how to define a constant for a 'WAVE' form type using the macro:

#define INCL_MMIOOS2
#include <os2.h>

/* Define the FOURCC for WAVE files */
#define FOURCC_WAVE mmioFOURCC('W', 'A', 'V', 'E')

/* usage */
FOURCC fccType;
fccType = FOURCC_WAVE;

Related Functions