MMPM2.LIB
MMPM2.LIB is the import library for MMPM/2 (MultiMedia Presentation Manager/2), the OS/2 multimedia subsystem. It provides the linker stubs required to call the MCI (Media Control Interface), MMIO (Multimedia I/O), multimedia PM controls, and media device manager APIs from 32-bit OS/2 applications.
The library contains no executable code. It is an OMF import library: each record maps an exported function name to an ordinal in the supplying DLL. MMPM2.LIB is a supplement to OS2386.LIB — a multimedia application links both.
File size in the OS/2 Warp 4.52 Toolkit 4.5: 32,768 bytes (2001-07-26).
API Coverage
MMPM2.LIB covers approximately 223 exported symbols across four subsystems:
| API prefix | Approximate count | Source DLL | Subsystem |
|---|---|---|---|
mmio* |
~167 (public + helpers) | MMIO.DLL | Multimedia file I/O, codec management, CTOC |
mci* |
~25 | MDM.DLL | Media Control Interface (device control, streaming) |
Win* |
~28 | MMPMPCS.DLL / MMREG.DLL | Custom PM controls (sliders, secondary window) |
mdm* |
~3 | MDM.DLL | Media Device Manager (driver notification) |
MCI — Media Control Interface
The MCI layer is the primary high-level API for controlling multimedia devices (waveform audio, MIDI, CD audio, digital video, etc.). Applications send string or command-message requests to a device driver loaded by the MDM (Media Device Manager).
Core functions
mciSendCommand(usDeviceID, usMessage, ulParam1, ulParam2)- The primary command interface. Sends a binary MCI message (e.g.
MCI_OPEN,MCI_PLAY,MCI_STOP,MCI_CLOSE) to a device. Parameters are passed as flag words and pointer structures defined inos2me.h.
mciSendString(pszCommandString, pszReturnString, usReturnLength, hwndCallback, usUserParm)- String-based alternative to
mciSendCommand. Parses a text command such as"play cdaudio from 0 to 5000 notify". Useful for scripting and REXX integration.
mciGetErrorString(ulError, pszBuffer, usLength)- Translates an MCI error code to a human-readable string. Every MCI call that returns non-zero should be passed through this function before displaying an error message.
mciGetDeviceID(pszDeviceName)- Returns the device ID for an open MCI device by name.
System values
mciQuerySysValue(usItem, pulValue)- Queries a global MMPM/2 system value (e.g. master volume, synchronization settings).
mciSetSysValue(usItem, ulValue)- Sets a global MMPM/2 system value.
Device groups
mciMakeGroup(pusGroupID, usDeviceCount, pausDeviceList, ulFlags)- Creates a logical group of MCI device IDs so that a single
mciSendCommandcall controls all of them simultaneously (synchronized playback).
mciDeleteGroup(usGroupID)- Removes a previously created device group.
Connection management
mciConnection(usFromID, usToID, ulFlags, pConnParm)- Establishes or removes a data connection between two MCI devices (e.g. routing audio from a waveform device to an amplifier-mixer).
mciDefaultConnection(usDeviceID, ulFlags, pConnParm)- Configures the default connection topology for a device.
mciQueryConnections(usDeviceID, ulFlags, pConnParm)/mciQueryDefaultConnections- Queries current connection state.
High-level helpers
These functions wrap common open/play/close sequences for simple playback scenarios:
mciPlayFile(hwnd, pszFileName, ulStyle, pszTitle)- Opens and plays a multimedia file (wave, MIDI, AVI, etc.) in a single call.
mciPlayResource(hwnd, hmod, usResourceID, ulStyle)- Plays an audio or multimedia resource embedded in an EXE or DLL.
mciRecordAudioFile(hwnd, pszFileName, ulStyle, pszTitle)- Records waveform audio to a file.
mciCreatePlayFilePalette(hwnd, pszFileName, ulStyle, pszTitle)- Creates a play palette (compact floating control) for a multimedia file.
REXX interface
MMPM/2 includes a REXX command interface for scripting multimedia operations:
mciRxInit()/mciRxExit()- Initialize and uninitialize the REXX MCI interface.
mciRxSendString(pszCommand, pszReturn, usReturnLen, hwndCallback)- Send an MCI string command from REXX context.
mciRxGetDeviceID(pszName)/mciRxGetErrorString(ulError)- REXX variants of the corresponding MCI functions.
MMIO — Multimedia I/O
The MMIO subsystem handles reading and writing multimedia file formats. It provides a RIFF-aware stream abstraction with installable I/O procedures (IOProcs) and codecs, allowing applications to read any supported format through a uniform API.
Basic file operations
mmioOpen(pszFileName, pmmioinfo, ulOpenFlags)- Opens a multimedia file for reading, writing, or creation. The
MMIOINFOstructure controls I/O procedure selection, memory-file mode, and buffering.
mmioClose(hmmio, usFlags)- Closes an open MMIO handle.
mmioRead(hmmio, pchBuffer, lBytes)- Reads bytes from the current file position.
mmioWrite(hmmio, pchBuffer, lBytes)- Writes bytes at the current file position.
mmioSeek(hmmio, lOffset, lOrigin)- Repositions the file pointer. Origin values mirror
fseek(SEEK_SET, SEEK_CUR, SEEK_END).
mmioFlush(hmmio, usFlags)- Flushes the I/O buffer to the underlying storage.
mmioAdvance(hmmio, pmmioinfo, usFlags)- Advances the MMIO buffer for double-buffered I/O (used during streaming playback/recording).
Multimedia files such as RIFF WAVE and AVI are structured as nested chunks. MMIO provides functions to traverse this tree:
mmioDescend(hmmio, pmmcki, pmmckiParent, usFlags)- Descends into a RIFF chunk. Can search for a specific chunk type (
MMIO_FINDCHUNK) or list (MMIO_FINDLIST).
mmioAscend(hmmio, pmmcki, usFlags)- Ascends out of a chunk, optionally writing the chunk size into the file header.
mmioCreateChunk(hmmio, pmmcki, usFlags)- Creates a new RIFF chunk at the current position. Used when writing multimedia files.
Buffer management
mmioGetInfo(hmmio, pmmioinfo, usFlags)- Retrieves the current MMIO state (buffer pointer, buffer size, flags).
mmioSetInfo(hmmio, pmmioinfo, usFlags)- Updates the MMIO state after the application has directly read from or written to the buffer.
mmioSetBuffer(hmmio, pchBuffer, lBuffer, usFlags)- Replaces the MMIO I/O buffer with a caller-supplied buffer, or changes the buffer size.
mmioGetData(hmmio, pmmioinfo, usFlags)- Returns direct access pointers to the internal MMIO buffer.
Header access
mmioGetHeader(hmmio, pHeader, lHeaderLength, plBytesRead, ulReserved, ulFlags)- Retrieves the format-specific header structure from an open MMIO file (e.g. MMAUDIOHEADER for PCM files).
mmioSetHeader(hmmio, pHeader, lHeaderLength, plBytesWritten, ulReserved, ulFlags)- Writes or updates the format-specific header.
mmioQueryHeaderLength(hmmio, plHeaderLength, ulReserved, ulFlags)- Returns the size of the current file's header structure.
Format identification
mmioIdentifyFile(pszFileName, pmmioinfo, pFourCC, phmmio, ulFlags)- Detects the file format of a multimedia file and returns its FOURCC code and the IOProc that handles it.
mmioIdentifyFileFormat(hmmio, pFourCC, ulFlags)- Identifies the format of an already-open MMIO handle.
mmioIdentifyStorageSystem(pszFileName, pmmioinfo, pFourCC)- Identifies the storage system (file, memory, URL, etc.) associated with a path.
mmioGetFormats(ulSearchFlags, pFourCC, pFormatList, pulListSize, ulFlags)- Enumerates all installed file format IOProcs.
mmioGetFormatName(ulSearchFlags, pFourCC, pszName, pulBufSize, ulFlags)- Returns the display name for a given format FOURCC.
mmioQueryFormatCount(pFourCC, pulCount, ulReserved, ulFlags)- Returns the number of installed format IOProcs matching the criteria.
mmioStringToFOURCC(pszFOURCC, usFlags)- Converts a four-character string to its FOURCC integer value.
I/O procedure management
Applications can install custom IOProcs to support additional file formats:
mmioInstallIOProc(fccIOProc, pIOProc, ulFlags)- Registers or removes a custom I/O procedure. The IOProc is a callback that handles open/close/read/write/seek/send-message operations for a new format.
mmioQueryIOProcModuleHandle(fccIOProc, phmod)- Returns the module handle of the DLL providing a given IOProc.
mmioDetermineFFIOProc(pszFileName, pmmioinfo, pFourCC, ulFlags)- Determines the IOProc for a flat-file storage format.
mmioDetermineSSIOProc(pszFileName, pmmioinfo, pFourCC, ulFlags)- Determines the IOProc for a storage-system (non-flat-file) format.
mmioDetermineLastIOProc(pszFileName, pmmioinfo, pFourCC, ulFlags)- Returns the last-resort IOProc for unrecognized files.
CODEC management
mmioLoadCODECProc(pCodecInfo, ppfnCodecProc, ulFlags)- Loads a CODEC (compressor/decompressor) procedure for a given format.
mmioQueryCODECName(pCodecInfo, pszName, pulBufSize)- Returns the display name of a CODEC.
mmioQueryCODECNameLength(pCodecInfo, pulLength)- Returns the string length of a CODEC name.
mmioIniFileCODEC(pCodecInfo, ulFlags)- Reads or updates CODEC entries in the MMPM/2 INI file.
mmioIniFileHandler(pmmformatinfo, ulFlags)- Reads or updates IOProc entries in the MMPM/2 INI file.
MMIO messaging
mmioSendMessage(hmmio, usMessage, ulParam1, ulParam2)- Sends a control message directly to the IOProc managing a file.
CTOC (Compound Table of Contents)
CTOC is an OS/2-specific extension for compound multimedia files (multiple data streams in one file):
mmioCFOpen(pszFileName, phmmcf, pmmcfinfo, ulFlags)- Opens a compound file.
mmioCFClose(hmmcf, ulFlags)- Closes a compound file.
mmioCFGetInfo(hmmcf, pmmcfinfo, lInfoLength)- Returns information about an open compound file.
mmioCFSetInfo(hmmcf, pmmcfinfo, lInfoLength)- Updates compound file settings.
mmioCFAddElement(hmmcf, pszElementName, ulFlags)- Adds a new element (stream) to a compound file.
mmioCFAddEntry(hmmcf, pmmctocentry, ulFlags)- Adds a CTOC directory entry.
mmioCFChangeEntry(hmmcf, pmmctocentry, ulFlags)- Modifies an existing CTOC entry.
mmioCFDeleteEntry(hmmcf, pmmctocentry, ulFlags)- Removes a CTOC entry.
mmioCFFFindEntry(hmmcf, pmmctocentry, ulFlags)- Searches for a CTOC entry by name or type.
mmioCFCopy(pszSource, pszDest, ulFlags)- Copies a compound file.
mmioCFCompact(pszFileName, ulFlags)- Compacts a compound file by removing deleted space.
Internal helpers (mmiohlp*)
MMPM2.LIB exports approximately 80 mmiohlp* symbols. These are internal helpers used by IOProc DLLs and CODEC DLLs rather than by end-user applications. Examples include mmiohlpLoadIOProc, mmiohlpBuildCtoc, mmiohlpExpandMemFile, mmiohlpGetFullPathName, and semaphore utilities such as mmiohlpAcquireMmioSem / mmiohlpDiscardMmioSem. They are documented in the MMPM/2 IOProc/CODEC development guide rather than the application programming reference.
mmioGetLastError(hmmio)- Returns the last error code set by the IOProc for a given handle.
mmioMigrateIniFile(ulFlags)- Migrates MMPM/2 INI entries from an earlier installation.
Custom PM Controls
MMPM/2 provides three custom Presentation Manager window classes for building multimedia application UIs. They must be registered before use. These controls are defined in mmioos2.h.
Circular Slider
A rotary control (knob) suitable for volume or balance settings.
WinRegisterCircularSlider()- Registers the
CircularSliderwindow class. Must be called once per process before creating circular slider windows withWinCreateWindow.
Graphic Button
A push-button that displays a bitmap in each state (normal, pressed, disabled).
WinRegisterGraphicButton()- Registers the
GraphicButtonwindow class.
Selection Slider
A linear slider with discrete tick positions, suitable for transport controls (fast-forward, rewind steps).
WinRegisterSelectionSlider()- Registers the
SelectionSliderwindow class.
Secondary Window
A standardized secondary dialog framework used by MMPM/2's own player windows. Applications can host secondary windows to embed player-style dialogs inside their own UI.
WinCreateSecondaryWindow,WinLoadSecondaryWindow,WinDestroySecondaryWindow- Create, load from resources, and destroy a secondary window.
WinDismissSecondaryWindow(hwnd, ulResult)- Dismisses a modal secondary window.
WinDefSecondaryWindowProc,WinProcessSecondaryWindow- Default window procedure and message pump for secondary windows.
WinQuerySecondaryDialog,WinQuerySecondaryFrame,WinQuerySecondaryHWND- Query the dialog, frame, and client HWNDs of a secondary window.
WinSecondaryWindow,WinSecondaryMessageBox- Simplified modal secondary window and message box variants.
WinDefaultSize,WinInsertDefaultSize,WinQueryDefaultSize- Manage the default size record attached to a secondary window.
WinReportMessage(hwnd, pszTitle, pszText, ulStyle)- Displays a standardized MMPM/2 error or information message box.
WinSWAssocResModule(hwnd, hmod)- Associates a resource module with a secondary window for NLS resource lookup.
MDM — Media Device Manager
mdmDriverNotify(usDeviceID, hwnd, usMessage, usParam1, ulParam2)- Called by media device drivers to post asynchronous notification messages to MMPM/2. Not used by applications; used when writing an MCI device driver DLL.
mdmAPMEntry(usFunction, ulParam1, ulParam2)- APM (Advanced Power Management) entry point for media drivers that need to handle suspend/resume events.
Usage
MMPM2.LIB is a supplement to OS2386.LIB. Always link both:
IBM VisualAge C++ / ILINK
icc -O2 -Gm -c myapp.c ilink /PM:PM myapp.obj os2386.lib mmpm2.lib
OpenWatcom (wlink)
wcl386 -bt=os2 -mf -c myapp.c wlink system os2_pm file myapp.obj library os2386.lib library mmpm2.lib
EMX/GCC
gcc -Zomf -c myapp.c gcc -Zomf -o myapp.exe myapp.o os2386.lib mmpm2.lib
Include files
The primary headers for MMPM/2 application development (from the OS/2 Toolkit h\ directory):
| Header | Contents |
|---|---|
os2me.h |
Master MMPM/2 header. Includes all of the below. Include this one for most applications. |
mmioos2.h |
MMIO types, structures (MMIOINFO, MMCKINFO), and function prototypes. Also declares the custom PM control class names.
|
mcios2.h |
MCI message codes (MCI_OPEN, MCI_PLAY, etc.), device types, flag constants, and mciSendCommand/mciSendString prototypes.
|
mmreg.h |
FOURCC registration and codec registration structures. |
Version History
| Version | MMPM/2 release | Date | Notes |
|---|---|---|---|
| 1.0 | MMPM/2 1.0 (OS/2 2.0) | 1992 | Initial release. Core MCI (mciSendCommand, mciSendString) and basic MMIO.
|
| 1.1 | MMPM/2 1.1 (OS/2 2.1) | 1993 | Added CTOC compound file support (mmioCF*), additional device types.
|
| 2.0 | MMPM/2 2.0 (OS/2 Warp 3) | 1994 | Added digital video (DIVE), synchronization groups (mciMakeGroup), custom PM controls (circular slider, graphic button, selection slider).
|
| 2.1 | MMPM/2 2.1 (OS/2 Warp 4) | 1996 | Added connection management (mciConnection), REXX MCI interface (mciRx*), secondary window framework (WinSecondaryWindow).
|
| 2.11 | MMPM/2 2.11 (OS/2 Warp 4.52) | 2001 | APM support (mdmAPMEntry), CODEC migration utilities, final IBM release. File size: 32,768 bytes.
|