mmioLoadCODECProc
Appearance
The mmioLoadCODECProc function loads a Compressor/Decompressor (CODEC) procedure installed in the `MMPMMMIO.INI` file and returns its entry point address. This function is typically used by an I/O procedure (IOProc) to access specific CODEC services for data translation.
Syntax
#define INCL_MMIOOS2 #define INCL_MMIO_CODEC #include <os2.h> PCODECPROC mmioLoadCODECProc(PCODECINIFILEINFO pCODECIniFileInfo, PHMODULE phMod, ULONG ulFlags);
Parameters
- pCODECIniFileInfo (PCODECINIFILEINFO) - input
- A pointer to a structure containing the search criteria or specific DLL/Procedure names used to locate the CODEC.
- phMod (PHMODULE) - output
- A pointer to a variable that receives the module handle (`HMODULE`) of the loaded CODEC DLL.
- ulFlags (ULONG) - input
- Specifies how the function should search for the CODEC. If no flags are provided, the default is to match on the `fcc` (FOURCC) field.
Search Flags
- MMIO_MATCHFOURCC: Matches the `fcc` field.
- MMIO_MATCHCOMPRESSTYPE: Matches the `ulCompressType` field.
- MMIO_MATCHCOMPRESSSUBTYPE: Matches the `ulCompressSubType` field.
- MMIO_MATCHHWID: Matches the `szHWID` field.
- MMIO_MATCHCAPSFLAGS: Matches based on capabilities (the entry must contain the requested flags; not an exact match).
- MMIO_MATCHDLL: Matches the `szDLLName` field.
- MMIO_MATCHPROCEDURENAME: Matches the case-sensitive `szProcName` field.
- MMIO_SKIPMATCH: Ignores the INI search and directly loads the DLL and procedure specified in `szDLLName` and `szProcName`.
Return Value
- rc (PCODECPROC)
- Returns the **address of the CODEC procedure** on success. Returns `NULL` if the function fails to find or load the specified CODEC.
Remarks
Once loaded, the CODEC procedure is called using a standard entry point. The IOProc typically communicates with the CODEC using specific messages.
CODEC Procedure Signature
The entry point of a CODEC DLL follows this format:
LONG APIENTRY CODECProc(PHCODEC phCODEC, USHORT usMsg, LONG lParam1, LONG lParam2);
- phCODEC
- Pointer to a CODEC instance handle.
- usMsg
- The message to process (e.g., `MMIOM_CODEC_OPEN`, `MMIOM_CODEC_COMPRESS`).
- lParam1 / lParam2
- Message-specific data.
Example Code
The following example illustrates how to load a CODEC by matching several specific criteria.
CODECINIFILEINFO codecIniFileInfo;
HMODULE hMod;
PCODECPROC pCODECProc;
ULONG ulFlags;
memset(&codecIniFileInfo, '\0', sizeof(CODECINIFILEINFO));
codecIniFileInfo.ulStructLen = sizeof(CODECINIFILEINFO);
codecIniFileInfo.fcc = mmioFOURCC('M','Y','V','D');
codecIniFileInfo.ulCompressType = COMPRESSTYPE_MYPROC;
codecIniFileInfo.ulCapsFlags = CODEC_CAN_DECOMPRESS;
/* Set search criteria */
ulFlags = MMIO_MATCHFOURCC |
MMIO_MATCHCOMPRESSTYPE |
MMIO_MATCHCAPSFLAGS;
pCODECProc = mmioLoadCODECProc(&codecIniFileInfo, &hMod, ulFlags);
if (pCODECProc) {
/* CODEC loaded successfully; pCODECProc is the entry point */
} else {
/* Error handling */
}