Microsoft Video For Windows API

From MultimediaWiki
Jump to navigation Jump to search

Microsoft's Video for Windows (VfW) API uses a refreshingly simple API. A Windows dynamic link library (DLL) that conforms to the VfW API is expected to export a single function with the following declaration:

LRESULT WINAPI DriverProc(
  DWORD dwDriverId,
  HDRVR hDriver,
  UINT uMsg,
  LPARAM lParam1,
  LPARAM lParam2);

All parameters are 32 bits wide. The parameters are defined as follows:

  • dwDriverId: A pointer to any private data that the codec needs to maintain between driver calls.
  • hDriver: Unknown; may not be especially important.
  • uMsg: This message parameter defines what operation DriverProc should perform on this particular call.
  • lParam1: Operation-specific data field that varies depending on uMsg.
  • lParam2: Operation-specific data field that varies depending on uMsg.

The DriverProc() function returns a 32-bit number indicating status as defined by the VfW API.

Other data structures:

typedef struct {
   DWORD dwSize;
   DWORD fccType;
   DWORD fccHandler;
   DWORD dwVersion;
   DWORD dwFlags;
   LRESULT dwError;
   LPVOID pV1Reserved;
   LPVOID pV2Reserved;
   DWORD dnDevNode;
} ICOPEN;
typedef struct {
   DWORD dwFlags;
   LPBITMAPINFOHEADER lpbiInput;
   LPVOID lpInput;
   LPBITMAPINFOHEADER lpbiOutput;
   LPVOID lpOutput;
   DWORD ckid;
} ICDECOMPRESS;


driver primitives

0x0001 DRV_LOAD
0x0003 DRV_OPEN
0x0004 DRV_CLOSE
0x0006 DRV_FREE

driver return codes

0x0000 DRVCNF_CANCEL
0x0001 DRVCNF_OK
0x0002 DRVCNF_RESTART

driver messages

0x400A ICM_DECOMPRESS_GET_FORMAT
0x400B ICM_DECOMPRESS_QUERY
0x400C ICM_DECOMPRESS_BEGIN
0x400D ICM_DECOMPRESS
0x400E ICM_DECOMPRESS_END
0x401D ICM_DECOMPRESS_SET_PALETTE
0x401E ICM_DECOMPRESS_GET_PALETTE

references:

  • Microsoft vfw.h API file
  • XviD source code