📄 vfw.pas
字号:
function ICImageCompress(
hic : HIC; // compressor to use
uiFlags : UINT; // flags (none yet)
lpbiIn : PBITMAPINFO; // format to compress from
lpBits : Pointer; // data to compress
lpbiOut : PBITMAPINFO; // compress to this (NULL ==> default)
lQuality : DWORD; // quality to use
plSize : PDWORD // compress to this size (0=whatever)
): THANDLE; stdcall;
function ICImageDecompress(
hic : HIC; // compressor to use
uiFlags : UINT; // flags (none yet)
lpbiIn : PBITMAPINFO; // format to decompress from
lpBits : Pointer; // data to decompress
lpbiOut : PBITMAPINFO // decompress to this (NULL ==> default)
): THANDLE; stdcall;
{-- TCompVars ----------------------------------------------------------------}
//
// Structure used by ICSeqCompressFrame and ICCompressorChoose routines
// Make sure this matches the autodoc in icm.c!
//
type
PCOMPVARS = ^TCOMPVARS;
TCOMPVARS = record
cbSize : DWORD; // set to sizeof(COMPVARS) before
// calling ICCompressorChoose
dwFlags : DWORD; // see below...
hic : HIC; // HIC of chosen compressor
fccType : DWORD; // basically ICTYPE_VIDEO
fccHandler : DWORD; // handler of chosen compressor or
// "" or "DIB "
lpbiIn : PBITMAPINFO; // input format
lpbiOut : PBITMAPINFO; // output format - will compress to this
lpBitsOut : Pointer;
lpBitsPrev : Pointer;
lFrame : DWORD;
lKey : DWORD; // key frames how often?
lDataRate : DWORD; // desired data rate KB/Sec
lQ : DWORD; // desired quality
lKeyCount : DWORD;
lpState : Pointer; // state of compressor
cbState : DWORD; // size of the state
end;
// FLAGS for dwFlags element of COMPVARS structure:
// set this flag if you initialize COMPVARS before calling ICCompressorChoose
const
ICMF_COMPVARS_VALID = $00000001; // COMPVARS contains valid data
{-- ICCompressorChoose() - allows user to choose compressor, quality etc... --}
function ICCompressorChoose(
hwnd : HWND; // parent window for dialog
uiFlags : UINT; // flags
pvIn : Pointer; // input format (optional)
lpData : Pointer; // input data (optional)
pc : PCOMPVARS; // data about the compressor/dlg
lpszTitle : LPSTR // dialog title (optional)
): BOOL; stdcall;
// defines for uiFlags
const
ICMF_CHOOSE_KEYFRAME = $0001; // show KeyFrame Every box
ICMF_CHOOSE_DATARATE = $0002; // show DataRate box
ICMF_CHOOSE_PREVIEW = $0004; // allow expanded preview dialog
ICMF_CHOOSE_ALLCOMPRESSORS = $0008; // don't only show those that
// can handle the input format
// or input data
function ICSeqCompressFrameStart(pc: PCOMPVARS; lpbiIn: PBITMAPINFO): BOOL; stdcall;
procedure ICSeqCompressFrameEnd(pc: PCOMPVARS); stdcall;
function ICSeqCompressFrame(
pc : PCOMPVARS; // set by ICCompressorChoose
uiFlags : UINT; // flags
lpBits : Pointer; // input DIB bits
pfKey : PBOOL; // did it end up being a key frame?
plSize : PDWORD // size to compress to/of returned image
): Pointer; stdcall;
procedure ICCompressorFree(pc: PCOMPVARS); stdcall;
implementation
// Dlls
const
AVICAP32 = 'AVICAP32.dll';
VFWDLL = 'MSVFW32.DLL';
(* Externals from AVICAP.DLL *)
function capGetDriverDescription; external AVICAP32 name 'capGetDriverDescriptionA';
function capCreateCaptureWindow; external AVICAP32 name 'capCreateCaptureWindowA';
(* Message crackers for above *)
function capSetCallbackOnError(hwnd : THandle; fpProc:TCAPERRORCALLBACK) : LongInt;
begin
Result := SendMessage(hwnd, WM_CAP_SET_CALLBACK_ERROR, 0,LPARAM(@fpProc));
end;
function capSetCallbackOnStatus(hwnd : THandle; fpProc:TCAPSTATUSCALLBACK):LongInt;
begin
Result := SendMessage(hwnd, WM_CAP_SET_CALLBACK_STATUS, 0, LPARAM(@fpProc));
end;
function capSetCallbackOnYield (hwnd : THandle; fpProc:TCAPYIELDCALLBACK):LongInt;
begin
Result := SendMessage(hwnd, WM_CAP_SET_CALLBACK_YIELD, 0, LPARAM(@fpProc));
end;
function capSetCallbackOnFrame (hwnd : THandle; fpProc:TCAPVIDEOSTREAMCALLBACK):LongInt;
begin
Result := SendMessage(hwnd, WM_CAP_SET_CALLBACK_FRAME, 0,LPARAM( @fpProc));
end;
function capSetCallbackOnVideoStream(hwnd:THandle; fpProc:TCAPVIDEOSTREAMCALLBACK):LongInt;
begin
Result := SendMessage(hwnd, WM_CAP_SET_CALLBACK_VIDEOSTREAM, 0, LPARAM(@fpProc));
end;
function capSetCallbackOnWaveStream (hwnd:THandle; fpProc:TCAPWAVESTREAMCALLBACK):LongInt;
begin
Result := SendMessage(hwnd, WM_CAP_SET_CALLBACK_WAVESTREAM, 0, LPARAM(@fpProc));
end;
function capSetCallbackOnCapControl (hwnd:THandle; fpProc:TCAPCONTROLCALLBACK):longint;
begin
Result := SendMessage(hwnd, WM_CAP_SET_CALLBACK_CAPCONTROL, 0, LPARAM(@fpProc));
end;
function capSetUserData(hwnd:THandle; lUser:LongInt):LongInt;
begin
Result := SendMessage(hwnd, WM_CAP_SET_USER_DATA, 0, lUser);
end;
function capGetUserData(hwnd:THandle):LongInt;
begin
Result := SendMessage(hwnd, WM_CAP_GET_USER_DATA, 0, 0);
end;
function capDriverConnect(hwnd:THandle; I: Word) : boolean;
begin
Result :=boolean( SendMessage(hwnd, WM_CAP_DRIVER_CONNECT, WPARAM(I), 0));
end;
function capDriverDisconnect(hwnd:THandle):Boolean;
begin
Result := boolean(SendMessage(hwnd, WM_CAP_DRIVER_DISCONNECT, 0, 0));
end;
function capDriverGetName(hwnd:THandle; szName:PChar; wSize:Word):boolean;
begin
Result :=boolean( SendMessage(hwnd, WM_CAP_DRIVER_GET_NAME, WPARAM(wSize), LPARAM( szName)));
end;
function capDriverGetVersion(hwnd:THandle; szVer:PChar; wSize:Word):boolean;
begin
Result :=boolean( SendMessage(hwnd, WM_CAP_DRIVER_GET_VERSION, WPARAM(wSize),LPARAM( szVer)));
end;
function capDriverGetCaps(hwnd:THandle; s:pCapDriverCaps; wSize:Word):boolean;
begin
Result := boolean(SendMessage(hwnd, WM_CAP_DRIVER_GET_CAPS, WPARAM(wSize),LPARAM(s)));
end;
function capFileSetCaptureFile(hwnd:THandle; szName:PChar):boolean;
begin
Result := Boolean(SendMessage(hwnd, WM_CAP_FILE_SET_CAPTURE_FILE, 0, LPARAM(szName)));
end;
function capFileGetCaptureFile(hwnd:THandle; szName:PChar; wSize:Word):Boolean;
begin
Result := Boolean(SendMessage(hwnd, WM_CAP_FILE_GET_CAPTURE_FILE, wSize, LPARAM(szName)));
end;
function capFileAlloc(hwnd:THandle; dwSize:DWord):boolean;
begin
Result := Boolean(SendMessage(hwnd, WM_CAP_FILE_ALLOCATE, 0, LPARAM(dwSize)));
end;
function capFileSaveAs(hwnd:THandle; szName:Pchar):Boolean;
begin
Result := Boolean(SendMessage(hwnd, WM_CAP_FILE_SAVEAS, 0,LPARAM(szName)));
end;
function capFileSetInfoChunk(hwnd:THandle; lpInfoChunk:pCapInfoChunk):boolean;
begin
Result := Boolean(SendMessage(hwnd, WM_CAP_FILE_SET_INFOCHUNK, 0, LPARAM(lpInfoChunk)));
end;
function capFileSaveDIB(hwnd:THandle; szName:Pchar):Boolean;
begin
Result :=Boolean(SendMessage(hwnd, WM_CAP_FILE_SAVEDIB, 0,LPARAM(szName)));
end;
function capEditCopy(hwnd : THandle):Boolean;
begin
Result := Boolean(SendMessage(hwnd, WM_CAP_EDIT_COPY, 0, 0));
end;
function capSetAudioFormat(hwnd:THandle; s:PWaveFormatEx; wSize:Word):boolean;
begin
Result := Boolean(SendMessage(hwnd, WM_CAP_SET_AUDIOFORMAT, WPARAM(wSize),LPARAM(s)));
end;
function capGetAudioFormat(hwnd:THandle; s:PWaveFormatEx; wSize:Word):DWORD;
begin
Result :=DWORD( SendMessage(hwnd, WM_CAP_GET_AUDIOFORMAT, WPARAM(wSize),LPARAM(s)));
end;
function capGetAudioFormatSize(hwnd:THandle):DWORD;
begin
Result := DWORD(SendMessage(hwnd, WM_CAP_GET_AUDIOFORMAT, 0, 0));
end;
function capDlgVideoFormat(hwnd:THandle):boolean;
begin
Result :=boolean(SendMessage(hwnd, WM_CAP_DLG_VIDEOFORMAT, 0, 0));
end;
function capDlgVideoSource(hwnd:THandle):boolean;
begin
Result :=boolean (SendMessage(hwnd, WM_CAP_DLG_VIDEOSOURCE, 0, 0));
end;
function capDlgVideoDisplay(hwnd:THandle):boolean;
begin
Result := boolean(SendMessage(hwnd, WM_CAP_DLG_VIDEODISPLAY, 0, 0));
end;
function capDlgVideoCompression(hwnd:THandle):boolean;
begin
Result := boolean(SendMessage(hwnd, WM_CAP_DLG_VIDEOCOMPRESSION, 0, 0));
end;
function capGetVideoFormat(hwnd:THandle; s:pBitmapInfo; wSize:Word):DWord;
begin
Result := DWord(SendMessage(hwnd, WM_CAP_GET_VIDEOFORMAT, Wparam(wSize), LPARAM(s)));
end;
function capGetVideoFormatSize(hwnd:THandle):DWord;
begin
Result := DWord(SendMessage(hwnd, WM_CAP_GET_VIDEOFORMAT, 0, 0));
end;
function capSetVideoFormat(hwnd:THandle; s:PBitmapInfo; wSize:Word):Boolean;
begin
Result := Boolean(SendMessage(hwnd, WM_CAP_SET_VIDEOFORMAT, WPARAM(wSize), LPARAM(s)));
end;
function capPreview(hwnd:THandle; f:boolean):boolean;
begin
Result := Boolean(SendMessage(hwnd, WM_CAP_SET_PREVIEW, WPARAM(f), 0));
end;
function capPreviewRate(hwnd:THandle; wMS:Word):boolean;
begin
Result := Boolean(SendMessage(hwnd, WM_CAP_SET_PREVIEWRATE, WPARAM(wMS), 0));
end;
function capOverlay(hwnd:THandle; f:boolean):boolean;
begin
Result := Boolean(SendMessage(hwnd, WM_CAP_SET_OVERLAY, WPARAM(f), 0));
end;
function capPreviewScale(
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -