📄 vfw.pas
字号:
cbName : Integer;
lpszVer : PChar;
cbVer : Integer ) : Boolean; stdcall;
// ------------------------------------------------------------------
// New Information chunk IDs
// ------------------------------------------------------------------
(*
infotypeDIGITIZATION_TIME = mmioStringToFOURCC(PChar('IDIT'), MMIO_TOUPPER);
infotypeSMPTE_TIME = mmioStringToFOURCC(PChar('ISMP'), MMIO_TOUPPER);
*)
// ------------------------------------------------------------------
// String IDs from status and error callbacks
// ------------------------------------------------------------------
Const
IDS_CAP_BEGIN = 300; (* "Capture Start" *)
IDS_CAP_END = 301; (* "Capture End" *)
IDS_CAP_INFO = 401; (* "%s" *)
IDS_CAP_OUTOFMEM = 402; (* "Out of memory" *)
IDS_CAP_FILEEXISTS = 403; (* "File '%s' exists -- overwrite it?" *)
IDS_CAP_ERRORPALOPEN = 404; (* "Error opening palette '%s'" *)
IDS_CAP_ERRORPALSAVE = 405; (* "Error saving palette '%s'" *)
IDS_CAP_ERRORDIBSAVE = 406; (* "Error saving frame '%s'" *)
IDS_CAP_DEFAVIEXT = 407; (* "avi" *)
IDS_CAP_DEFPALEXT = 408; (* "pal" *)
IDS_CAP_CANTOPEN = 409; (* "Cannot open '%s'" *)
IDS_CAP_SEQ_MSGSTART = 410; (* "Select OK to start capture\nof video sequence\nto %s." *)
IDS_CAP_SEQ_MSGSTOP = 411; (* "Hit ESCAPE or click to end capture" *)
IDS_CAP_VIDEDITERR = 412; (* "An error occurred while trying to run VidEdit." *)
IDS_CAP_READONLYFILE = 413; (* "The file '%s' is a read-only file." *)
IDS_CAP_WRITEERROR = 414; (* "Unable to write to file '%s'.\nDisk may be full." *)
IDS_CAP_NODISKSPACE = 415; (* "There is no space to create a capture file on the specified device." *)
IDS_CAP_SETFILESIZE = 416; (* "Set File Size" *)
IDS_CAP_SAVEASPERCENT = 417; (* "SaveAs: %2ld%% Hit Escape to abort." *)
IDS_CAP_DRIVER_ERROR = 418; (* Driver specific error message *)
IDS_CAP_WAVE_OPEN_ERROR = 419; (* "Error: Cannot open the wave input device.\nCheck sample size, frequency, and channels." *)
IDS_CAP_WAVE_ALLOC_ERROR = 420; (* "Error: Out of memory for wave buffers." *)
IDS_CAP_WAVE_PREPARE_ERROR = 421; (* "Error: Cannot prepare wave buffers." *)
IDS_CAP_WAVE_ADD_ERROR = 422; (* "Error: Cannot add wave buffers." *)
IDS_CAP_WAVE_SIZE_ERROR = 423; (* "Error: Bad wave size." *)
IDS_CAP_VIDEO_OPEN_ERROR = 424; (* "Error: Cannot open the video input device." *)
IDS_CAP_VIDEO_ALLOC_ERROR = 425; (* "Error: Out of memory for video buffers." *)
IDS_CAP_VIDEO_PREPARE_ERROR = 426; (* "Error: Cannot prepare video buffers." *)
IDS_CAP_VIDEO_ADD_ERROR = 427; (* "Error: Cannot add video buffers." *)
IDS_CAP_VIDEO_SIZE_ERROR = 428; (* "Error: Bad video size." *)
IDS_CAP_FILE_OPEN_ERROR = 429; (* "Error: Cannot open capture file." *)
IDS_CAP_FILE_WRITE_ERROR = 430; (* "Error: Cannot write to capture file. Disk may be full." *)
IDS_CAP_RECORDING_ERROR = 431; (* "Error: Cannot write to capture file. Data rate too high or disk full." *)
IDS_CAP_RECORDING_ERROR2 = 432; (* "Error while recording" *)
IDS_CAP_AVI_INIT_ERROR = 433; (* "Error: Unable to initialize for capture." *)
IDS_CAP_NO_FRAME_CAP_ERROR = 434; (* "Warning: No frames captured.\nConfirm that vertical sync interrupts\nare configured and enabled." *)
IDS_CAP_NO_PALETTE_WARN = 435; (* "Warning: Using default palette." *)
IDS_CAP_MCI_CONTROL_ERROR = 436; (* "Error: Unable to access MCI device." *)
IDS_CAP_MCI_CANT_STEP_ERROR = 437; (* "Error: Unable to step MCI device." *)
IDS_CAP_NO_AUDIO_CAP_ERROR = 438; (* "Error: No audio data captured.\nCheck audio card settings." *)
IDS_CAP_AVI_DRAWDIB_ERROR = 439; (* "Error: Unable to draw this data format." *)
IDS_CAP_COMPRESSOR_ERROR = 440; (* "Error: Unable to initialize compressor." *)
IDS_CAP_AUDIO_DROP_ERROR = 441; (* "Error: Audio data was lost during capture, reduce capture rate." *)
(* status string IDs *)
IDS_CAP_STAT_LIVE_MODE = 500; (* "Live window" *)
IDS_CAP_STAT_OVERLAY_MODE = 501; (* "Overlay window" *)
IDS_CAP_STAT_CAP_INIT = 502; (* "Setting up for capture - Please wait" *)
IDS_CAP_STAT_CAP_FINI = 503; (* "Finished capture, now writing frame %ld" *)
IDS_CAP_STAT_PALETTE_BUILD = 504; (* "Building palette map" *)
IDS_CAP_STAT_OPTPAL_BUILD = 505; (* "Computing optimal palette" *)
IDS_CAP_STAT_I_FRAMES = 506; (* "%d frames" *)
IDS_CAP_STAT_L_FRAMES = 507; (* "%ld frames" *)
IDS_CAP_STAT_CAP_L_FRAMES = 508; (* "Captured %ld frames" *)
IDS_CAP_STAT_CAP_AUDIO = 509; (* "Capturing audio" *)
IDS_CAP_STAT_VIDEOCURRENT = 510; (* "Captured %ld frames (%ld dropped) %d.%03d sec." *)
IDS_CAP_STAT_VIDEOAUDIO = 511; (* "Captured %d.%03d sec. %ld frames (%ld dropped) (%d.%03d fps). %ld audio bytes (%d,%03d sps)" *)
IDS_CAP_STAT_VIDEOONLY = 512; (* "Captured %d.%03d sec. %ld frames (%ld dropped) (%d.%03d fps)" *)
IDS_CAP_STAT_FRAMESDROPPED = 513; (* "Dropped %ld of %ld frames (%d.%02d%%) during capture." *)
{== DRAWDIB - Routines for drawing to the display ============================}
type
HDRAWDIB = THandle; // hdd
{ == DrawDib Flags ============================================================}
const
DDF_UPDATE = $0002; // re-draw the last DIB
DDF_SAME_HDC = $0004; // HDC same as last call (all setup)
DDF_SAME_DRAW = $0008; // draw params are the same
DDF_DONTDRAW = $0010; // dont draw frame, just decompress
DDF_ANIMATE = $0020; // allow palette animation
DDF_BUFFER = $0040; // always buffer image
DDF_JUSTDRAWIT = $0080; // just draw it with GDI
DDF_FULLSCREEN = $0100; // use DisplayDib
DDF_BACKGROUNDPAL = $0200; // Realize palette in background
DDF_NOTKEYFRAME = $0400; // this is a partial frame update, hint
DDF_HURRYUP = $0800; // hurry up please!
DDF_HALFTONE = $1000; // always halftone
DDF_PREROLL = DDF_DONTDRAW; // Builing up a non-keyframe
DDF_SAME_DIB = DDF_SAME_DRAW;
DDF_SAME_SIZE = DDF_SAME_DRAW;
{== DrawDib functions ========================================================}
{-- DrawDibOpen() ------------------------------------------------------------}
function DrawDibOpen: HDRAWDIB; stdcall;
{-- DrawDibClose() -----------------------------------------------------------}
function DrawDibClose(hdd: HDRAWDIB): BOOL; stdcall;
{-- DrawDibGetBuffer() -------------------------------------------------------}
function DrawDibGetBuffer(hdd: HDRAWDIB; lpbi: PBITMAPINFOHEADER; dwSize: DWORD; dwFlags: DWORD): Pointer;stdcall;
{-- DrawDibGetPalette() - get the palette used for drawing DIBs --------------}
function DrawDibGetPalette(hdd: HDRAWDIB): HPALETTE; stdcall;
{-- DrawDibSetPalette() - set the palette used for drawing DIBs --------------}
function DrawDibSetPalette(hdd: HDRAWDIB; hpal: HPALETTE): BOOL; stdcall;
{-- DrawDibChangePalette() ---------------------------------------------------}
function DrawDibChangePalette(hdd: HDRAWDIB; iStart, iLen: integer; lppe: PPALETTEENTRY): BOOL; stdcall;
{-- DrawDibRealize() - realize the palette in a HDD --------------------------}
function DrawDibRealize(hdd: HDRAWDIB; hdc: HDC; fBackground: BOOL): UINT; stdcall;
{-- DrawDibStart() - start of streaming playback -----------------------------}
function DrawDibStart(hdd: HDRAWDIB; rate: DWORD): BOOL; stdcall;
{-- DrawDibStop() - start of streaming playback ------------------------------}
function DrawDibStop(hdd: HDRAWDIB): BOOL; stdcall;
{-- DrawDibBegin() - prepare to draw -----------------------------------------}
function DrawDibBegin(
hdd : HDRAWDIB;
hdc : HDC;
dxDst : integer;
dyDst : integer;
lpbi : PBITMAPINFOHEADER;
dxSrc : integer;
dySrc : integer;
wFlags : UINT
): BOOL; stdcall;
{-- DrawDibDraw() - actually draw a DIB to the screen ------------------------}
function DrawDibDraw(
hdd : HDRAWDIB;
hdc : HDC;
xDst : integer;
yDst : integer;
dxDst : integer;
dyDst : integer;
lpbi : PBITMAPINFOHEADER;
lpBits : Pointer;
xSrc : integer;
ySrc : integer;
dxSrc : integer;
dySrc : integer;
wFlags : UINT
): BOOL; stdcall;
{-- DrawDibUpdate() - redraw last image (may only be valid with DDF_BUFFER) --}
//function DrawDibUpdate(hdd: HDRAWDIB; hdc: HDC; x, y: integer): BOOL;stdcall;
{-- DrawDibEnd() -------------------------------------------------------------}
function DrawDibEnd(hdd: HDRAWDIB): BOOL; stdcall;
{-- DrawDibTime() - for debugging purposes only ------------------------------}
type
PDRAWDIBTIME = ^TDRAWDIBTIME;
TDRAWDIBTIME = record
timeCount : DWORD;
timeDraw : DWORD;
timeDecompress : DWORD;
timeDither : DWORD;
timeStretch : DWORD;
timeBlt : DWORD;
timeSetDIBits : DWORD;
end;
function DrawDibTime(hdd: HDRAWDIB; lpddtime: PDRAWDIBTIME): BOOL; stdcall;
{-- Display profiling --------------------------------------------------------}
const
PD_CAN_DRAW_DIB = $0001; // if you can draw at all
PD_CAN_STRETCHDIB = $0002; // basicly RC_STRETCHDIB
PD_STRETCHDIB_1_1_OK = $0004; // is it fast?
PD_STRETCHDIB_1_2_OK = $0008; // ...
PD_STRETCHDIB_1_N_OK = $0010; // ...
function DrawDibProfileDisplay(lpbi: PBITMAPINFOHEADER): DWORD; 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;
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -