Microsoft Audio Compression Manager API

From MultimediaWiki
Jump to: navigation, search

Microsoft's Audio Compression Manager (ACM) API is the audio analog of their Video for Windows (VfW) API.

An ACM-compliant codec DLL exports a single function named DriverProc that takes a message and a few other parameters. The messages specify an action that the decoder is to perform.

The DriverProc usually consists of a switch statement. The main target in reverse engineering the decoding algorithm is the ACMDM_STREAM_CONVERT message, 0x604F.

The first parameter is the following structure:

 typedef struct _ACMDRVSTREAMINSTANCE
 {
     DWORD           cbStruct;    // 0x00
     PWAVEFORMATEX   pwfxSrc;     // 0x04
     PWAVEFORMATEX   pwfxDst;     // 0x08
     PWAVEFILTER     pwfltr;      // 0x0C
     DWORD           dwCallback;  // 0x10
     DWORD           dwInstance;  // 0x14
     DWORD           fdwOpen;     // 0x18
     DWORD           fdwDriver;   // 0x1C
     DWORD           dwDriver;    // 0x20
     HACMSTREAM      has;         // 0x24
 } ACMDRVSTREAMINSTANCE, *PACMDRVSTREAMINSTANCE;

The second parameter is the following structure:

 typedef struct _ACMDRVSTREAMHEADER 
 {
     DWORD  cbStruct;         // 0x00
     DWORD  fdwStatus;        // 0x04
     DWORD  dwUser;           // 0x08
     LPBYTE pbSrc;            // 0x0C
     DWORD  cbSrcLength;      // 0x10
     DWORD  cbSrcLengthUsed;  // 0x14
     DWORD  dwSrcUser;        // 0x18
     LPBYTE pbDst;            // 0x1C
     DWORD  cbDstLength;      // 0x20
     DWORD  cbDstLengthUsed;  // 0x24
     DWORD  dwDstUser;        // 0x28
     DWORD fdwConvert;        // 0x2C
     PACMDRVSTREAMHEADER *padshNext;  // 0x30
     DWORD fdwDriver;         // 0x34
     DWORD dwDriver;          // 0x38

     /* Internal fields for ACM */
     DWORD  fdwPrepared;      // 0x3C
     DWORD  dwPrepared;       // 0x40
     LPBYTE pbPreparedSrc;    // 0x44
     DWORD  cbPreparedSrcLength;  // 0x48
     LPBYTE pbPreparedDst;    // 0x4C
     DWORD  cbPreparedDstLength;  // 0x50
 } ACMDRVSTREAMHEADER;