{
****************************************************************************
* *
* Translated from avicap.h *
* *
* Main include file. *
* *
* Microsoft Video for Windows Sample Capture Class *
* *
* *
* C/C++ Run Time Library - Version 8.0 *
* *
* Copyright (c) 1994, 1997 by Borland International *
* All Rights Reserved. *
* *
* *
****************************************************************************
}
unit AviCapH;
interface
uses windows,messages;
// ------------------------------------------------------------------
// Window Messages WM_CAP... which can be sent to an AVICAP window
// ------------------------------------------------------------------
// Defines start of the message range
const
avicap32='avicap32.dll';
WM_CAP_START= WM_USER;
// start of unicode messages
WM_CAP_UNICODE_START= WM_USER+100;
type
TCapDriverCaps =Record
wDeviceIndex:UINT;
// Driver index in system.ini
fHasOverlay:BOOL;
// Can device overlay?
fHasDlgVideoSource:BOOL;
// Has Video source dlg?
fHasDlgVideoFormat:BOOL;
// Has Format dlg?
fHasDlgVideoDisplay:BOOL;
// Has External out dlg?
fCaptureInitialized:BOOL;
// Driver ready to capture?
fDriverSuppliesPalettes:BOOL;
// Can driver make palettes?
// following always NULL on Win32.
hVideoIn:THANDLE;
// Driver In channel
hVideoOut:THANDLE;
// Driver Out channel
hVideoExtIn:THANDLE;
// Driver Ext In channel
hVideoExtOut:THANDLE;
// Driver Ext Out channel
end;
type
TCapStatus = record
uiImageWidth:UINT ;
// Width of the image
uiImageHeight:UINT ;
// Height of the image
fLiveWindow:BOOL ;
// Now Previewing video?
fOverlayWindow:BOOL ;
// Now Overlaying video?
fScale:BOOL ;
// Scale image to client?
ptScroll:TPOINT ;
// Scroll position
fUsingDefaultPalette:BOOL ;
// Using default driver palette?
fAudioHardware:BOOL ;
// Audio hardware present?
fCapFileExists:BOOL ;
//do
es capture file exist?
dwCurrentVideoFrameWORD ;
// # of video frames cap'td
dwCurrentVideoFramesDroppedWORD ;// # of video frames dropped
dwCurrentWaveSamplesWORD ;
// # of wave samples cap'td
dwCurrentTimeElapsedMSWORD ;
// Elapsed capture duration
hPalCurrent:HPALETTE ;
// Current palette in use
fCapturingNow:BOOL ;
// Capture in progress?
dwReturnWORD ;
// Error value after any operation
wNumVideoAllocated:UINT ;
// Actual number of video buffers
wNumAudioAllocated:UINT ;
// Actual number of audio buffers
end;
type
TCaptureParms = Record
dwRequestMicroSecPerFrameWORD ;
// Requested capture rate
fMakeUserHitOKToCapture:BOOL ;
// Show "Hit OK to cap"
dlg?
wPercentDropForError:UINT ;
// Give error msg if > (10%)
fYield:BOOL ;
// Capture via background task?
dwIndexSizeWORD ;
// Max index size in frames (32K)
wChunkGranularity:UINT ;
// Junk chunk granularity (2K)
fUsingDOSMemory:BOOL ;
// Usedo
S buffers?
wNumVideoRequested:UINT ;
// # video buffers, If 0, autocalc
fCaptureAudio:BOOL ;
// Capture audio?
wNumAudioRequested:UINT ;
// # audio buffers, If 0, autocalc
vKeyAbort:UINT ;
// Virtual key causing abort
fAbortLeftMouse:BOOL ;
// Abort on left mouse?
fAbortRightMouse:BOOL ;
// Abort on right mouse?
fLimitEnabled:BOOL ;
// Use wTimeLimit?
wTimeLimit:UINT ;
// Seconds to capture
fMCIControl:BOOL ;
// Use MCI video source?
fStepMCIDevice:BOOL ;
// Step MCI device?
dwMCIStartTimeWORD ;
// Time to start in MS
dwMCIStopTimeWORD ;
// Time to stop in MS
fStepCaptureAt2x:BOOL ;
// Perform spatial averaging 2x
wStepCaptureAverageFrames:UINT ;
// Temporal average n Frames
dwAudioBufferSizeWORD ;
// Size of audio bufs (0 = default)
fDisableWriteCache:BOOL ;
// Attempt to disable write cache
AVStreamMasterWORD;
end;
type
TByteRec = record
Lo, Hi: Byte;
end;
TWordRec = record
Low, High: TByteRec;
end;
Type
FOURCC=TWordRec;
function mmioFOURCC(const c0,c1,c2,c3:Char):FOURCC;
type
TCapInfoChunk = record
fccInfoID:FOURCC ;
// Chunk ID, "ICOP"
for copyright
lpDataointer ;
// pointer to data
cbData:LONGINT ;
// size of lpData
end;
// ------------------------------------------------------------------
// CapControlCallback states
// ------------------------------------------------------------------
const
CONTROLCALLBACK_PREROLL = 1;
//* Waiting to start capture */
CONTROLCALLBACK_CAPTURING= 2;
//* Now capturing */
// ------------------------------------------------------------------
// New Information chunk IDs
// ------------------------------------------------------------------
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."
*/
================================================================================
Unit AviCap;
{
This code was written by : A. Waintrub
email: awaint1102@aol.com
This code is copyright 1997 by
A. Waintrub
+++++++++++++++++++++++++++++++++++++++++++++++++++
+ NUR F躌 PRIVATE NUTZUNG!!! +
+++++++++++++++++++++++++++++++++++++++++++++++++++}
constructor TAviCap.Create(AOwner: TComponent);
var
a1,a2:ARRAY [0..127] of char;
b:Byte;
begin
inherited Create(AOwner);
parent:=AOwner as TWinCOntrol;
capturing:=false;
width:=260;
height:=180;
FDriverDescripton:=TStringList.Create;
for b :=0 to 8do
if FConnected then
disconnect;
if assigned(FDriverDescripton) then
FDriverDescripton.free;
DeleteDC(DC);
CloseHandle(FCapWndHandle);
inherited Destroy;
end;
procedure TAviCap.Connect(b:Boolean);
begin
if b then
begin
TextOut(dc,10,10,'Connecting',10);
fconnected:=capDriverConnect (FCapWndHandle, 0);
SetOverlay(FOverlay);
end
else
disconnect;
end;
procedure TAviCap.Disconnect;
var
B:boolean;
begin
inherited Paint;
SetWindowPos(FCapWndHandle,HWND_TOP,0,0,width,height,SWP_SHOWWINDOW);
if dc=0 then
dc:=Getdc(FCapWndHandle);
If csDesigning in ComponentState then
TextOut(dc,10,10,PChar(NAme),Length(NAme));
end;