Jump to content

mmioIniFileCODEC

From EDM2

The mmioIniFileCODEC function is used to manage CODEC entries within the MMIO initialization file (`MMPMMMIO.INI`). It provides the ability to install, remove, find, or replace information about Compressor/Decompressor (CODEC) procedures used by the MMIO Manager.

Syntax

#define INCL_MMIOOS2
#define INCL_MMIO_CODEC
#include <os2.h>

ULONG mmioIniFileCODEC(PCODECINIFILEINFO pCODECIniFileInfo, ULONG ulFlags);

Parameters

pCODECIniFileInfo (PCODECINIFILEINFO) - in/out
A pointer to a CODECINIFILEINFO structure. This structure contains details such as the FOURCC code, compression type, DLL name, and procedure name. For search operations, this structure is populated with the results.
ulFlags (ULONG) - input
Specifies the operation and search criteria.

Operation Flags

  • MMIO_INSTALLPROC: Adds a CODEC to the INI file. If a match is found based on the search flags, the existing entry is replaced.
  • MMIO_REMOVEPROC: Deletes the matching CODEC entry.
  • MMIO_FINDPROC: Searches for an entry and populates the remaining fields in the CODECINIFILEINFO structure.
  • MMIO_MATCHFIRST: Finds the first entry that matches the criteria (or the absolute first if no criteria are set).
  • MMIO_MATCHNEXT: Finds the next entry following the one provided.

Match Criteria Flags

These flags determine which fields in the structure are used to identify a "match" during install, remove, or find operations:

  • MMIO_MATCHFOURCC: Matches the `fcc` field (default).
  • MMIO_MATCHCOMPRESSTYPE: Matches the `ulCompressType` field.
  • MMIO_MATCHCOMPRESSSUBTYPE: Matches the `ulCompressSubType` field.
  • MMIO_MATCHHWID: Matches the `szHWID` field.
  • MMIO_MATCHCAPSFLAGS: Matches the `ulCapsFlags` field (subset match).
  • MMIO_MATCHDLL: Matches the `szDLLName` field.
  • MMIO_MATCHPROCEDURENAME: Matches the case-sensitive `szProcName` field.
  • MMIO_FULLPATH: Forces the use of the full drive/path in `szDLLName`.

Return Values

rc (ULONG)
Returns MMIO_SUCCESS (0) on success, or an error code:
  • MMIOERR_MATCH_NOT_FOUND: No entry matched the criteria.
  • MMIOERR_INVALID_DLLNAME: The DLL name is invalid.
  • MMIOERR_INVALID_PROCEDURENAME: The entry point name is invalid.
  • MMIOERR_INI_OPEN: Could not open `MMPMMMIO.INI`.
  • MMIOERR_NO_CORE: Memory allocation failed.

Remarks

The `MMPMMMIO.INI` file location is determined by the MMBASE environment variable.

When a CODEC is removed, the MMIO Manager rewrites the entire INI file. This is a characteristic of OS/2 INI management to ensure that deleted entries do not leave "dead space" that causes the file size to grow unnecessarily over time.

Example Code

This example demonstrates how to register a custom CODEC in the system configuration.

   CODECINIFILEINFO codecInfo;
   ULONG rc;

   memset(&codecInfo, '\0', sizeof(CODECINIFILEINFO));
   codecInfo.ulStructLen = sizeof(CODECINIFILEINFO);
   
   /* Define the CODEC identities */
   codecInfo.fcc = mmioFOURCC('M', 'Y', 'V', 'D');
   codecInfo.ulCompressType = 0x1001; 
   codecInfo.ulCompressSubType = 0;
   codecInfo.ulMediaType = MMIO_MEDIATYPE_VIDEO;
   codecInfo.ulCapsFlags = CODEC_DECOMPRESS | CODEC_WINDOW_WRITABLE;
   
   /* Define the location */
   strncpy(codecInfo.szDLLName, "MYCODEC.DLL", 13);
   strncpy(codecInfo.szProcName, "MyCodecEntryProc", 32);

   /* Install the proc, matching on FOURCC and Compression Type */
   rc = mmioIniFileCODEC(&codecInfo, 
                         MMIO_INSTALLPROC | 
                         MMIO_MATCHFOURCC | 
                         MMIO_MATCHCOMPRESSTYPE);

   if (rc != MMIO_SUCCESS) {
      /* Handle installation error */
   }