?? vfw.h
字號(hào):
* ICDecompressEx()
*
* decompress a single frame
*
*/
static __inline LRESULT VFWAPI
ICDecompressEx(
HIC hic,
DWORD dwFlags,
LPBITMAPINFOHEADER lpbiSrc,
LPVOID lpSrc,
int xSrc,
int ySrc,
int dxSrc,
int dySrc,
LPBITMAPINFOHEADER lpbiDst,
LPVOID lpDst,
int xDst,
int yDst,
int dxDst,
int dyDst)
{
ICDECOMPRESSEX ic;
ic.dwFlags = dwFlags;
ic.lpbiSrc = lpbiSrc;
ic.lpSrc = lpSrc;
ic.xSrc = xSrc;
ic.ySrc = ySrc;
ic.dxSrc = dxSrc;
ic.dySrc = dySrc;
ic.lpbiDst = lpbiDst;
ic.lpDst = lpDst;
ic.xDst = xDst;
ic.yDst = yDst;
ic.dxDst = dxDst;
ic.dyDst = dyDst;
// note that ICM swaps round the length and pointer
// length in lparam2, pointer in lparam1
return ICSendMessage(hic, ICM_DECOMPRESSEX, (DWORD)&ic, sizeof(ic));
}
/*
* ICDecompressExBegin()
*
* start compression from a source format (lpbiInput) to a dest
* format (lpbiOutput) is supported.
*
*/
static __inline LRESULT VFWAPI
ICDecompressExBegin(
HIC hic,
DWORD dwFlags,
LPBITMAPINFOHEADER lpbiSrc,
LPVOID lpSrc,
int xSrc,
int ySrc,
int dxSrc,
int dySrc,
LPBITMAPINFOHEADER lpbiDst,
LPVOID lpDst,
int xDst,
int yDst,
int dxDst,
int dyDst)
{
ICDECOMPRESSEX ic;
ic.dwFlags = dwFlags;
ic.lpbiSrc = lpbiSrc;
ic.lpSrc = lpSrc;
ic.xSrc = xSrc;
ic.ySrc = ySrc;
ic.dxSrc = dxSrc;
ic.dySrc = dySrc;
ic.lpbiDst = lpbiDst;
ic.lpDst = lpDst;
ic.xDst = xDst;
ic.yDst = yDst;
ic.dxDst = dxDst;
ic.dyDst = dyDst;
// note that ICM swaps round the length and pointer
// length in lparam2, pointer in lparam1
return ICSendMessage(hic, ICM_DECOMPRESSEX_BEGIN, (DWORD)&ic, sizeof(ic));
}
/*
* ICDecompressExQuery()
*
*/
static __inline LRESULT VFWAPI
ICDecompressExQuery(
HIC hic,
DWORD dwFlags,
LPBITMAPINFOHEADER lpbiSrc,
LPVOID lpSrc,
int xSrc,
int ySrc,
int dxSrc,
int dySrc,
LPBITMAPINFOHEADER lpbiDst,
LPVOID lpDst,
int xDst,
int yDst,
int dxDst,
int dyDst)
{
ICDECOMPRESSEX ic;
ic.dwFlags = dwFlags;
ic.lpbiSrc = lpbiSrc;
ic.lpSrc = lpSrc;
ic.xSrc = xSrc;
ic.ySrc = ySrc;
ic.dxSrc = dxSrc;
ic.dySrc = dySrc;
ic.lpbiDst = lpbiDst;
ic.lpDst = lpDst;
ic.xDst = xDst;
ic.yDst = yDst;
ic.dxDst = dxDst;
ic.dyDst = dyDst;
// note that ICM swaps round the length and pointer
// length in lparam2, pointer in lparam1
return ICSendMessage(hic, ICM_DECOMPRESSEX_QUERY, (DWORD)&ic, sizeof(ic));
}
#define ICDecompressExEnd(hic) \
ICSendMessage(hic, ICM_DECOMPRESSEX_END, 0, 0)
/************************************************************************
drawing functions
************************************************************************/
/*
* ICDrawBegin()
*
* start decompressing data with format (lpbiInput) directly to the screen
*
* return zero if the decompressor supports drawing.
*
*/
#define ICDRAW_QUERY 0x00000001L // test for support
#define ICDRAW_FULLSCREEN 0x00000002L // draw to full screen
#define ICDRAW_HDC 0x00000004L // draw to a HDC/HWND
DWORD VFWAPIV ICDrawBegin(
HIC hic,
DWORD dwFlags, // flags
HPALETTE hpal, // palette to draw with
HWND hwnd, // window to draw to
HDC hdc, // HDC to draw to
int xDst, // destination rectangle
int yDst,
int dxDst,
int dyDst,
LPBITMAPINFOHEADER lpbi, // format of frame to draw
int xSrc, // source rectangle
int ySrc,
int dxSrc,
int dySrc,
DWORD dwRate, // frames/second = (dwRate/dwScale)
DWORD dwScale);
/*
* ICDraw()
*
* decompress data directly to the screen
*
*/
#define ICDRAW_HURRYUP 0x80000000L // don't draw just buffer (hurry up!)
#define ICDRAW_UPDATE 0x40000000L // don't draw just update screen
DWORD VFWAPIV ICDraw(
HIC hic,
DWORD dwFlags, // flags
LPVOID lpFormat, // format of frame to decompress
LPVOID lpData, // frame data to decompress
DWORD cbData, // size of data
LONG lTime); // time to draw this frame
// ICMessage is not supported on Win32, so provide a static inline function
// to do the same job
static __inline LRESULT VFWAPI
ICDrawSuggestFormat(
HIC hic,
LPBITMAPINFOHEADER lpbiIn,
LPBITMAPINFOHEADER lpbiOut,
int dxSrc,
int dySrc,
int dxDst,
int dyDst,
HIC hicDecomp)
{
ICDRAWSUGGEST ic;
ic.lpbiIn = lpbiIn;
ic.lpbiSuggest = lpbiOut;
ic.dxSrc = dxSrc;
ic.dySrc = dySrc;
ic.dxDst = dxDst;
ic.dyDst = dyDst;
ic.hicDecompressor = hicDecomp;
// note that ICM swaps round the length and pointer
// length in lparam2, pointer in lparam1
return ICSendMessage(hic, ICM_DRAW_SUGGESTFORMAT, (DWORD)&ic, sizeof(ic));
}
/*
* ICDrawQuery()
*
* determines if the compressor is willing to render the specified format.
*
*/
#define ICDrawQuery(hic, lpbiInput) \
ICSendMessage(hic, ICM_DRAW_QUERY, (DWORD)(LPVOID)(lpbiInput), 0L)
#define ICDrawChangePalette(hic, lpbiInput) \
ICSendMessage(hic, ICM_DRAW_CHANGEPALETTE, (DWORD)(LPVOID)(lpbiInput), 0L)
#define ICGetBuffersWanted(hic, lpdwBuffers) \
ICSendMessage(hic, ICM_GETBUFFERSWANTED, (DWORD)(LPVOID)(lpdwBuffers), 0)
#define ICDrawEnd(hic) \
ICSendMessage(hic, ICM_DRAW_END, 0, 0)
#define ICDrawStart(hic) \
ICSendMessage(hic, ICM_DRAW_START, 0, 0)
#define ICDrawStartPlay(hic, lFrom, lTo) \
ICSendMessage(hic, ICM_DRAW_START_PLAY, (DWORD)(lFrom), (DWORD)(lTo))
#define ICDrawStop(hic) \
ICSendMessage(hic, ICM_DRAW_STOP, 0, 0)
#define ICDrawStopPlay(hic) \
ICSendMessage(hic, ICM_DRAW_STOP_PLAY, 0, 0)
#define ICDrawGetTime(hic, lplTime) \
ICSendMessage(hic, ICM_DRAW_GETTIME, (DWORD)(LPVOID)(lplTime), 0)
#define ICDrawSetTime(hic, lTime) \
ICSendMessage(hic, ICM_DRAW_SETTIME, (DWORD)lTime, 0)
#define ICDrawRealize(hic, hdc, fBackground) \
ICSendMessage(hic, ICM_DRAW_REALIZE, (DWORD)(UINT)(HDC)(hdc), (DWORD)(BOOL)(fBackground))
#define ICDrawFlush(hic) \
ICSendMessage(hic, ICM_DRAW_FLUSH, 0, 0)
#define ICDrawRenderBuffer(hic) \
ICSendMessage(hic, ICM_DRAW_RENDERBUFFER, 0, 0)
/************************************************************************
Status callback functions
************************************************************************/
/*
* ICSetStatusProc()
*
* Set the status callback function
*
*/
// ICMessage is not supported on NT
static __inline LRESULT VFWAPI
ICSetStatusProc(
HIC hic,
DWORD dwFlags,
LRESULT lParam,
LONG (CALLBACK *fpfnStatus)(LPARAM, UINT, LONG) )
{
ICSETSTATUSPROC ic;
ic.dwFlags = dwFlags;
ic.lParam = lParam;
ic.Status = fpfnStatus;
// note that ICM swaps round the length and pointer
// length in lparam2, pointer in lparam1
return ICSendMessage(hic, ICM_SET_STATUS_PROC, (DWORD)&ic, sizeof(ic));
}
/************************************************************************
helper routines for DrawDib and MCIAVI...
************************************************************************/
#define ICDecompressOpen(fccType, fccHandler, lpbiIn, lpbiOut) \
ICLocate(fccType, fccHandler, lpbiIn, lpbiOut, ICMODE_DECOMPRESS)
#define ICDrawOpen(fccType, fccHandler, lpbiIn) \
ICLocate(fccType, fccHandler, lpbiIn, NULL, ICMODE_DRAW)
HIC VFWAPI ICLocate(DWORD fccType, DWORD fccHandler, LPBITMAPINFOHEADER lpbiIn, LPBITMAPINFOHEADER lpbiOut, WORD wFlags);
HIC VFWAPI ICGetDisplayFormat(HIC hic, LPBITMAPINFOHEADER lpbiIn, LPBITMAPINFOHEADER lpbiOut, int BitDepth, int dx, int dy);
/************************************************************************
Higher level functions
************************************************************************/
HANDLE VFWAPI ICImageCompress(
HIC hic, // compressor to use
UINT uiFlags, // flags (none yet)
LPBITMAPINFO lpbiIn, // format to compress from
LPVOID lpBits, // data to compress
LPBITMAPINFO lpbiOut, // compress to this (NULL ==> default)
LONG lQuality, // quality to use
LONG FAR * plSize); // compress to this size (0=whatever)
HANDLE VFWAPI ICImageDecompress(
HIC hic, // compressor to use
UINT uiFlags, // flags (none yet)
LPBITMAPINFO lpbiIn, // format to decompress from
LPVOID lpBits, // data to decompress
LPBITMAPINFO lpbiOut); // decompress to this (NULL ==> default)
//
// Structure used by ICSeqCompressFrame and ICCompressorChoose routines
// Make sure this matches the autodoc in icm.c!
//
typedef struct {
LONG cbSize; // set to sizeof(COMPVARS) before
// calling ICCompressorChoose
DWORD dwFlags; // see below...
HIC hic; // HIC of chosen compressor
DWORD fccType; // basically ICTYPE_VIDEO
DWORD fccHandler; // handler of chosen compressor or
// "" or "DIB "
LPBITMAPINFO lpbiIn; // input format
LPBITMAPINFO lpbiOut; // output format - will compress to this
LPVOID lpBitsOut;
LPVOID lpBitsPrev;
LONG lFrame;
LONG lKey; // key frames how often?
LONG lDataRate; // desired data rate KB/Sec
LONG lQ; // desired quality
LONG lKeyCount;
LPVOID lpState; // state of compressor
LONG cbState; // size of the state
} COMPVARS, FAR *PCOMPVARS;
// FLAGS for dwFlags element of COMPVARS structure:
// set this flag if you initialize COMPVARS before calling ICCompressorChoose
#define ICMF_COMPVARS_VALID 0x00000001 // COMPVARS contains valid data
//
// allows user to choose compressor, quality etc...
//
BOOL VFWAPI ICCompressorChoose(
HWND hwnd, // parent window for dialog
UINT uiFlags, // flags
LPVOID pvIn, // input format (optional)
LPVOID lpData, // input data (optional)
PCOMPVARS pc, // data about the compressor/dlg
LPSTR lpszTitle); // dialog title (optional)
// defines for uiFlags
#define ICMF_CHOOSE_KEYFRAME 0x0001 // show KeyFrame Every box
#define ICMF_CHOOSE_DATARATE 0x0002 // show DataRate box
#define ICMF_CHOOSE_PREVIEW 0x0004 // allow expanded preview dialog
#define ICMF_CHOOSE_ALLCOMPRESSORS 0x0008 // don't only show those that
// can handle the input format
// or input data
?? 快捷鍵說明
復(fù)制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號(hào)
Ctrl + =
減小字號(hào)
Ctrl + -