⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 vfw.pas

📁 制作摄相头的。网上下的
💻 PAS
📖 第 1 页 / 共 5 页
字号:
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;

// Helper fucntion for FOURCC

function MKFOURCC(ch0, ch1, ch2, ch3: Char): FOURCC;

{== COMPMAN - Installable Compression Manager ================================}

const
ICVERSION = $0104 ;

type
HIC = THandle; // Handle to an Installable Compressor

//
// this code in biCompression means the DIB must be accesed via
// 48 bit pointers! using *ONLY* the selector given.
//
const
BI_1632 = $32333631; // '1632'

function mmioFOURCC(ch0, ch1, ch2, ch3: Char): FOURCC;

type
TWOCC = Word;

function aviTWOCC(ch0, ch1: Char): TWOCC;

const
ICTYPE_VIDEO = $63646976; // mmioFOURCC('v', 'i', 'd', 'c')
ICTYPE_AUDIO = $63647561; // mmioFOURCC('a', 'u', 'd', 'c')

const
ICERR_OK = 0 ;
ICERR_DONTDRAW = 1 ;
ICERR_NEWPALETTE = 2 ;
ICERR_GOTOKEYFRAME = 3 ;
ICERR_STOPDRAWING = 4 ;

ICERR_UNSUPPORTED = -1 ;
ICERR_BADFORMAT = -2 ;
ICERR_MEMORY = -3 ;
ICERR_INTERNAL = -4 ;
ICERR_BADFLAGS = -5 ;
ICERR_BADPARAM = -6 ;
ICERR_BADSIZE = -7 ;
ICERR_BADHANDLE = -8 ;
ICERR_CANTUPDATE = -9 ;
ICERR_ABORT = -10 ;
ICERR_ERROR = -100 ;
ICERR_BADBITDEPTH = -200 ;
ICERR_BADIMAGESIZE = -201 ;

ICERR_CUSTOM = -400 ; // errors less than ICERR_CUSTOM...

{-- Values for dwFlags of ICOpen() -------------------------------------------}

ICMODE_COMPRESS = 1 ;
ICMODE_DECOMPRESS = 2 ;
ICMODE_FASTDECOMPRESS = 3 ;
ICMODE_QUERY = 4 ;
ICMODE_FASTCOMPRESS = 5 ;
ICMODE_DRAW = 8 ;

{-- Flags for AVI file index -------------------------------------------------}

AVIIF_LIST = $00000001 ;
AVIIF_TWOCC = $00000002 ;
AVIIF_KEYFRAME = $00000010 ;

{-- quality flags ------------------------------------------------------------}

ICQUALITY_LOW = 0 ;
ICQUALITY_HIGH = 10000 ;
ICQUALITY_DEFAULT = -1 ;

{-----------------------------------------------------------------------------}

ICM_USER = (DRV_USER+$0000) ;

ICM_RESERVED_LOW = (DRV_USER+$1000) ;
ICM_RESERVED_HIGH = (DRV_USER+$2000) ;
ICM_RESERVED = ICM_RESERVED_LOW ;

{-- Messages -----------------------------------------------------------------}

ICM_GETSTATE = (ICM_RESERVED+0) ; // Get compressor state
ICM_SETSTATE = (ICM_RESERVED+1) ; // Set compressor state
ICM_GETINFO = (ICM_RESERVED+2) ; // Query info about the compressor

ICM_CONFIGURE = (ICM_RESERVED+10); // show the configure dialog
ICM_ABOUT = (ICM_RESERVED+11); // show the about box

ICM_GETDEFAULTQUALITY = (ICM_RESERVED+30); // get the default value for quality
ICM_GETQUALITY = (ICM_RESERVED+31); // get the current value for quality
ICM_SETQUALITY = (ICM_RESERVED+32); // set the default value for quality

ICM_SET = (ICM_RESERVED+40); // Tell the driver something
ICM_GET = (ICM_RESERVED+41); // Ask the driver something

{-- Constants for ICM_SET: ---------------------------------------------------}

ICM_FRAMERATE = $526D7246; // mmioFOURCC('F','r','m','R')
ICM_KEYFRAMERATE = $5279654B; // mmioFOURCC('K','e','y','R')

{-- ICM specific messages ----------------------------------------------------}

ICM_COMPRESS_GET_FORMAT = (ICM_USER+4) ; // get compress format or size
ICM_COMPRESS_GET_SIZE = (ICM_USER+5) ; // get output size
ICM_COMPRESS_QUERY = (ICM_USER+6) ; // query support for compress
ICM_COMPRESS_BEGIN = (ICM_USER+7) ; // begin a series of compress calls.
ICM_COMPRESS = (ICM_USER+8) ; // compress a frame
ICM_COMPRESS_END = (ICM_USER+9) ; // end of a series of compress calls.

ICM_DECOMPRESS_GET_FORMAT = (ICM_USER+10) ; // get decompress format or size
ICM_DECOMPRESS_QUERY = (ICM_USER+11) ; // query support for dempress
ICM_DECOMPRESS_BEGIN = (ICM_USER+12) ; // start a series of decompress calls
ICM_DECOMPRESS = (ICM_USER+13) ; // decompress a frame
ICM_DECOMPRESS_END = (ICM_USER+14) ; // end a series of decompress calls
ICM_DECOMPRESS_SET_PALETTE = (ICM_USER+29) ; // fill in the DIB color table
ICM_DECOMPRESS_GET_PALETTE = (ICM_USER+30) ; // fill in the DIB color table

ICM_DRAW_QUERY = (ICM_USER+31) ; // query support for dempress
ICM_DRAW_BEGIN = (ICM_USER+15) ; // start a series of draw calls
ICM_DRAW_GET_PALETTE = (ICM_USER+16) ; // get the palette needed for drawing
ICM_DRAW_START = (ICM_USER+18) ; // start decompress clock
ICM_DRAW_STOP = (ICM_USER+19) ; // stop decompress clock
ICM_DRAW_END = (ICM_USER+21) ; // end a series of draw calls
ICM_DRAW_GETTIME = (ICM_USER+32) ; // get value of decompress clock
ICM_DRAW = (ICM_USER+33) ; // generalized "render" message
ICM_DRAW_WINDOW = (ICM_USER+34) ; // drawing window has moved or hidden
ICM_DRAW_SETTIME = (ICM_USER+35) ; // set correct value for decompress clock
ICM_DRAW_REALIZE = (ICM_USER+36) ; // realize palette for drawing
ICM_DRAW_FLUSH = (ICM_USER+37) ; // clear out buffered frames
ICM_DRAW_RENDERBUFFER = (ICM_USER+38) ; // draw undrawn things in queue

ICM_DRAW_START_PLAY = (ICM_USER+39) ; // start of a play
ICM_DRAW_STOP_PLAY = (ICM_USER+40) ; // end of a play

ICM_DRAW_SUGGESTFORMAT = (ICM_USER+50) ; // Like ICGetDisplayFormat
ICM_DRAW_CHANGEPALETTE = (ICM_USER+51) ; // for animating palette

ICM_GETBUFFERSWANTED = (ICM_USER+41) ; // ask about prebuffering

ICM_GETDEFAULTKEYFRAMERATE = (ICM_USER+42) ; // get the default value for key frames

ICM_DECOMPRESSEX_BEGIN = (ICM_USER+60) ; // start a series of decompress calls
ICM_DECOMPRESSEX_QUERY = (ICM_USER+61) ; // start a series of decompress calls
ICM_DECOMPRESSEX = (ICM_USER+62) ; // decompress a frame
ICM_DECOMPRESSEX_END = (ICM_USER+63) ; // end a series of decompress calls

ICM_COMPRESS_FRAMES_INFO = (ICM_USER+70) ; // tell about compress to come
ICM_SET_STATUS_PROC = (ICM_USER+72) ; // set status callback

{-----------------------------------------------------------------------------}

type
PICOPEN = ^TICOPEN;
TICOPEN = record
dwSize : DWORD ; // sizeof(TICOPEN)
fccType : DWORD ; // 'vidc'
fccHandler : DWORD ; //
dwVersion : DWORD ; // version of compman opening you
dwFlags : DWORD ; // LOWORD is type specific
dwError : DWORD ; // error return.
pV1Reserved : Pointer ; // Reserved
pV2Reserved : Pointer ; // Reserved
dnDevNode : DWORD ; // Devnode for PnP devices
end;

{-----------------------------------------------------------------------------}

PICINFO = ^TICINFO ;
TICINFO = record
dwSize : DWORD; // sizeof(TICINFO)
fccType : DWORD; // compressor type 'vidc' 'audc'
fccHandler : DWORD; // compressor sub-type 'rle ' 'jpeg' 'pcm '
dwFlags : DWORD; // flags LOWORD is type specific
dwVersion : DWORD; // version of the driver
dwVersionICM : DWORD; // version of the ICM used
//
// under Win32, the driver always returns UNICODE strings.
//
szName : array[0..15] of WideChar ; // short name
szDescription : array[0..127] of WideChar ; // DWORD name
szDriver : array[0..127] of WideChar ; // driver that contains compressor
end;

{-- Flags for the field of the structure. -----------------}

const
VIDCF_QUALITY = $0001 ; // supports quality
VIDCF_CRUNCH = $0002 ; // supports crunching to a frame size
VIDCF_TEMPORAL = $0004 ; // supports inter-frame compress
VIDCF_COMPRESSFRAMES = $0008 ; // wants the compress all frames message
VIDCF_DRAW = $0010 ; // supports drawing
VIDCF_FASTTEMPORALC = $0020 ; // does not need prev frame on compress
VIDCF_FASTTEMPORALD = $0080 ; // does not need prev frame on decompress
//VIDCF_QUALITYTIME = $0040 ; // supports temporal quality

//VIDCF_FASTTEMPORAL = (VIDCF_FASTTEMPORALC or VIDCF_FASTTEMPORALD)

{-----------------------------------------------------------------------------}

ICCOMPRESS_KEYFRAME = $00000001;

type
PICCOMPRESS = ^TICCOMPRESS;
TICCOMPRESS = record
dwFlags : DWORD; // flags

lpbiOutput : PBITMAPINFOHEADER ; // output format
lpOutput : Pointer ; // output data

lpbiInput : PBITMAPINFOHEADER ; // format of frame to compress
lpInput : Pointer ; // frame data to compress

lpckid : PDWORD ; // ckid for data in AVI file
lpdwFlags : PDWORD; // flags in the AVI index.
lFrameNum : DWORD ; // frame number of seq.
dwFrameSize : DWORD ; // reqested size in bytes. (if non zero)

dwQuality : DWORD ; // quality

// these are new fields

lpbiPrev : PBITMAPINFOHEADER ; // format of previous frame
lpPrev : Pointer ; // previous frame
end;

{-----------------------------------------------------------------------------}

const

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -