📄 okapi32.h
字号:
short WINAPI okGetSlotBoard(BOARDTYPE **lpOkInfo);
//Query all Ok boards available in PCI bus, return total number
short WINAPI okGetBoardIndex(char *szBoardName, short iNo);
//Get index (start 0) of specified board name string (it can also be typcode string)
// and order in same name (start 0),
//return -1 if no this specified ok board
long WINAPI okGetBoardName(long lIndex, LPSTR szBoardName);
//get the board code and name of the specified index
//return the type code if success else return 0 if no card
//multi cards capture
BOOL WINAPI okMulCaptureTo(HANDLE *lphBaord,TARGET Dest, long start, LPARAM lParam);
//control multi boards to capture to target simultaneously, lphBaord are pointer of hBoard of multi board
//other functions are same as okCaptureByBuffer
BOOL WINAPI okMulCaptureByBuffer(HANDLE *lphBaord,TARGET tgt, long start, long num);
//control multi boards to capture by buffer simultaneously, lphBaord are pointer of hBoard of multi board
//other functions are same as okCaptureByBuffer
//multi channels:
BOOL WINAPI okLoadInitParam(HANDLE hBoard, short iChannNo);
//load specified chann (and as current chann.)of initial params
BOOL WINAPI okSaveInitParam(HANDLE hBoard, short iChannNo);
//save current init param to specified chann (and as current chann.)
//get and lock buffer
long WINAPI okGetAvailBuffer(void **lpLinear, DWORD *dwSize);
//Get free meomery buffers pre-allocated .
//call it when user hope to access buffer directly or lock for some one board
long WINAPI okLockBuffer(HANDLE hBoard, DWORD dwSizeByte, void **lpBasLinear);
//Lock speicfiled size meomery buffers, then other handle can not use them
//return the size of locked buffer in fact
BOOL WINAPI okUnlockAllBuffer(void);
//Unlock all buffer for all handle
//Mem Block Buffer appended to BUFFER
long WINAPI okApplyMemBlock(DWORD dwBlockSize, DWORD dwBlockNo);
//apply mem block used as buffer appended to BUFFER
//return the number of blocks allocated actually
BOOL WINAPI okFreeMemBlock();
//release appended MemBlock by okApplyMemBlock
long WINAPI okGetMemBlock(HANDLE hBoard, DWORD *dwEachSize, DWORD *dwBlockNo);
//get the number of MemBlock and size per block applied by okApplyMemBlock
//and return the number can be as buffer as to cureent set size of BUFFER
long WINAPI okLockMemBlock(HANDLE hBoard, long lBlockNo);
//lock number of MemBlock to specified handle
BOOL WINAPI okUnlockMemBlock(void);
//unlcok all locked MemBlock
//--4. apps utilities-----------------
//apps setup dialog
BOOL WINAPI okOpenSetParamDlg( HANDLE hBoard, HWND hParentWnd);
//dialog to setup video param
BOOL WINAPI okOpenSeqCaptureDlg( HANDLE hBoard, HWND hParentWnd);
//dialog to capture sequence image
LPDIBINFO WINAPI okOpenReplayDlg( HANDLE hBoard, HWND hWnd, TARGET src, long total);
//open modeless dialog to replay sequence images(in BUFFER, USERBUF or seq file) on SCREEN or MONITOR
HWND WINAPI okOpenReplayDlgEx( HANDLE hBoard, HWND hWnd, TARGET src, long total, LPBITMAPINFOHEADER lpbi, LPBYTE lpdib);
//open modeless dialog to replay sequence images(in BUFFER, USERBUF or seq file) on SCREEN or MONITOR
//-------
BOOL WINAPI okUnifyFields(HANDLE hBoard, TARGET target, long start);
//unify odd and even two fields which have different intensive brightness
//
//text and graphics
BOOL WINAPI okSetTextTo(HANDLE hBoard, TARGET target, LPRECT lpRect, LOGFONT *lfLogFont, SETTEXTMODE *textMode, LPSTR lpString, long lLength);
//set text into the image of specified target
//target can be SCREEN, BUFFER, FRAME, also BLOCKINFO
//lpRect: just use its (left,top) to points start posision
//lfLogFont: windows font definition, see window's document
//textMode: specify forecolor, backcolor and set mode
//lpString, lLength: text string and it's length
long WINAPI okDrawEllipsTo(HANDLE hBoard, TARGET target, long lStart, LPRECT lpRect, long iForeColor);
//draw a ellips into specified target
//target can be SCREEN, BUFFER, FRAME, also BLOCKINFO
//lpRect: specify the rect region of expected ellips
//iForeColor: draw value on to target
//return the pixel count of ellips
HDC WINAPI okCreateDCBitmap(HANDLE hBoard, TARGET target, HANDLE *hDCBitmap);
//create a memory DC compatible with windows's GDI, draw graphic and text etc. with GDI functions
//target can be SCREEN, BUFFER, FRAME, also BLOCKINFO
//hDCBitmap: return a handle with which we can map the graphics on the memory DC
//to our target.
//return the memory DC with which you can use windows"s GDI functions
BOOL WINAPI okMapDCBitmapTo(HANDLE hDCBitmap, long lStart);
//map the graphics of memory DC created by okCreateDCBitmap into specified target
//hDCBitmap: the handle created by okCreateDCBitmap
BOOL WINAPI okFreeDCBitmap(HANDLE hDCBitmap);
//free the allocated resource by okCreateDCBitmap
//hDCBitmap: the handle created by okCreateDCBitmap
//-----
//-----sub-function defines for wParam of okBeginEncode and okBeginDecode
#define CODE_JPEG 1
#define CODE_MPEG2 2
#define CODE_MJPG 3
#define CODE_MPEG4 4
#define CODE_JPG2K 5
//encode and decode
HANDLE WINAPI okBeginEncode(HANDLE hBoard, DWORD dwCodeWay, LPARAM lpImageInfo);
//start to encode images. wCodeWay is CODE_JPEG or other compress,
//lpImageInfo is address of preset parameters like size to encode
//return a handle of encoder if sucessful, else return 0
long WINAPI okEncodeImage(HANDLE hCoder, TARGET src, long start, LPBYTE lpData, long maxlen);
//encode one frame image . src is source like BUFFER, SCREEN, FRAME and BLOCK.
//lpData to store coded data, maxlen is maximum length of lpCodedData
//return the length coded data
long WINAPI okEndEncode(HANDLE hCoder);
//end encode and release resources of encoder
HANDLE WINAPI okBeginDecode(HANDLE hBoard, DWORD dwCodeWay, LPBYTE lpData, LPARAM lpImageInfo);
//start to decode images. wCodeWay is CODE_JPEG or other compress,
//lpData is current start pos of coded data,
//lpImageInfo will return image info like size, no return when it is NULL
//return a handle of decoder if sucessful, else return 0
long WINAPI okDecodeImage(HANDLE hCoder, LPBYTE lpData, long *length, TARGET target, long start);
//decode coded data to image.
//lpData is pointer with coded data
//length is input length of coded data, it also output length of real used data
//target is aim to decode, like BUFFER, SCREEN, FRAME,BLOCK or memory pointer
//start is pos of specified target
//return TRUE if one image finished, else return 0
long WINAPI okEndDecode(HANDLE hCoder);
//end decoder and release resources of decoder
//protect
long WINAPI okReadProtCode(HANDLE hBoard, short iIndex);
long WINAPI okWriteProtCode(HANDLE hBoard, short iIndex, long code);
//
//--5. audio section routines--------------
//-----defines wParam in okSetAudioParam
#define AUDIO_RESETALL 0 //reset all to sys default
#define AUDIO_SAMPLEFRQ 1 //Sample rate, in samples per second
#define AUDIO_SAMPLEBITS 2 //Bits per sample
#define AUDIO_INVOLUME 3 //Audio input gain control
#define AUDIO_CALLINTERVAL 4 //callback after interval times
//prolog and epilog
HANDLE WINAPI okOpenAudio(HANDLE hBoard, LPARAM lParam);
//open audio device owned by the video capture board
//hBoard is handle of image board, lParam reserved argument must ne set to 0
//return handle of the audio device
BOOL WINAPI okCloseAudio(HANDLE hAudio);
//close audio device
//capture and stop
long WINAPI okCaptureAudio(HANDLE hAudio, TARGET target, FARPROC lpfnUserProc, LPARAM lParam);
//start to capture audio data, target can be BUFFER(audio data buffer) or file name
//lpfnUserProc is callback function pointer, it must be NULL if not using callback
// lParam reserved argument must be set to 0
//return the maximum times in miliseconds the inner audio data memory can be stored for
BOOL CALLBACK WriteAudioProc(HANDLE hAudio, LPBYTE lpAudBuf, long length);
//this callback function must written as the above protype by user
//call this function when there are enough audio data (the length in byte)
//call this function when capture ended with argument length=0;
BOOL WINAPI okStopCaptureAudio(HANDLE hAudio);
//stop capturing audio data
//return total length of read out by okReadAudioData
//set and get audio
long WINAPI okSetAudioParam(HANDLE hAudio, WORD wParam, LPARAM lParam);
//set the parameters to sample audio, wParam see above defines
//return the new set value if success
//if not support return -1, if error return -2
//if input lParam=-1, just return previous param
long WINAPI okReadAudioData(HANDLE hAudio, LPBYTE lpAudioBuf, long lReadSize);
//read audio captured from inner data buffer
//lpAudioBuf is your memory address to store
//lReadSize is data length (in byte) you expect to read
//return the data length (in byte) truelly read
//--6. stream section routines--------------
#define NONE 0 //
//-----defines wParam in okSetStreamParam
#define STREAM_RESETALL 0 //reset all to sys default
#define STREAM_RESOLUTION 1 //Sample resolution, 0=D1,1=2/3D1,2=1/2D1,3=SIF
#define STREAM_BITRATEMODE 2 //Bit Rate mode 0: VBR(Variable BR), 1: CBR(Constant)
#define STREAM_MAXBITRATE 3 //Max Bit Rate, it is BR for CBR, it is max BR for VBR
#define STREAM_CALLINTERVAL 4 //callback after interval times
//prolog and epilog
HANDLE WINAPI okOpenStream(HANDLE hBoard, LPARAM lParam);
//open stream device owned by the video capture board
//hBoard is handle of image board, when normaly open lParam must be 0.
//when lParam is 1 just check if this board support hardware compressing
//return handle of the stream device
BOOL WINAPI okCloseStream(HANDLE hStream);
//close audio device
//capture and stop
long WINAPI okCaptureStream(HANDLE hStream, TARGET target, FARPROC lpfnUserProc, long lMiliSeconds);
//start to capture stream data, target can be NONE(0)/BUFFER(stream buffer), or file name
//lpfnUserProc is callback function pointer, it must be NULL if not using callback
//lMiliSeconds=0: forever capturing until stop by okStopCaptureStream;
// non 0: specified periods to capture in mili-second
//success if return non 0
BOOL CALLBACK WriteStreamProc(HANDLE hStream, LPBYTE lpStreamBuf, long length);
//this callback function must written as the above protype by user
//call this function when there are enough stream data (the length in byte)
//call this function when capture ended with argument length=0;
BOOL WINAPI okStopCaptureStream(HANDLE hStream, DWORD dwPause);
//stop or pause/re-encode capturing stream data
//dwPause=0: stop, dwPause=1: pause, dwPause:=2: re-encode
//return total length of read out by okReadStreamData
//set and get stream
long WINAPI okSetStreamParam(HANDLE hStream, WORD wParam, LPARAM lParam);
//set the parameters to sample stream, wParam see above defines
//return the new set value if success
//if not support return -1, if error return -2
//if input lParam=-1, just return previous param
long WINAPI okReadStreamData(HANDLE hStream, LPBYTE lpStreamBuf, long lReadSize);
//read stream captured from inner data buffer
//lpStreamBuf is your memory address to store
//lReadSize is data length (in byte) you expect to read
//return the data length (in byte) truelly read
//--7. serial device embedded in board--------------
long WINAPI okSetSerial(HANDLE hBoard, WPARAM wParam, LPARAM lParam);
//set serial device config parameter and return previous parameter;
//wParam is item to set, lParam is parameter value
//if input lParam=-1, just return previous parameter not to set
//if not support return -1, if error return -2
#define SERIAL_COMMINDEX 0 //current comm index to r/w, default value=0
#define SERIAL_BAUTRATE 1 //comm baut rate,like 9600,1200...default=9600
#define SERIAL_DATABITS 2 //data bits, like 8,9...default=8
#define SERIAL_STOPBITS 3 //stop bits, 0=1, 1=1.5, 2=2, default=0
#define SERIAL_PARITY 4 //parity bit, 0:no, 1:odd,2:even, default=0
long WINAPI okReadSerial(HANDLE hBoard, LPVOID lpBuffer, long lSize, long lTimeOut);
//read data from current serial comm device
//lpBuffer is buffer to read, lSize is size of buffer
//return the size read actually
BOOL WINAPI okWriteSerial(HANDLE hBoard, LPVOID lpBuffer, long lSize, long lTimeOut);
//write data to current serial comm device
//lpBuffer is buffer stored data to write, lSize is data length to write
//return true if success
//--8. ports io utilities--------------
// for Non-PCI IO cards on WinNT/Win2000
// you must call this function before using follow port io functions
BOOL WINAPI okSetPortBase(WORD wPortBase, short iPortCount);
//preset ports to use by setting port base address and port count
//to use some ports (default port=0x300, count=4) must preset by calling this one
//and these ports can be used correctly only after system restarted
//this function only used for OK PCI GPIO20
short WINAPI okGetGPIOPort(short index, WORD *wPortBase);
//get port base and count of ok PCI GPIO20
//index is the nomber (0 based) of gpio cards,
//wPortBase: port base, return port count if success else return 0
BOOL WINAPI okOutputByte(WORD wPort, BYTE data);
//output a byte at specified port
BOOL WINAPI okOutputShort(WORD wPort, short data);
//output a word at specified port
BOOL WINAPI okOutputLong(WORD wPort, long data);
//output a dword at specified port
//----------- input data at port
BYTE WINAPI okInputByte(WORD wPort);
//input a byte at specified port
short WINAPI okInputShort(WORD wPort);
//input a word at specified port
long WINAPI okInputLong(WORD wPort);
//input a dword at specified port
//--9. others--------------
BOOL WINAPI okSetPortBase(WORD wPortBase, short iPortCount);
#define okGetDriverVer(a, b) okGetProgramInfo(2, a, b)
DWORD WINAPI okGetAddrForVB(void *);
//return array address for VB
//-----------get time elapse
DWORD WINAPI okGetTickCount(void);
//same as GetTickCount but exactly than it on Win2k
void WINAPI okSleep(DWORD dwMill);
//same as Sleep but exactly than it on Win2k
DWORD WINAPI okGetTickCountMicro(LPDWORD lpHiDWord);
//same as GetTickCount but exactly in Micro Second
//if lpHiDWord get high dword
#ifdef __cplusplus
}
#endif /* __cplusplus */
#endif
//-------------------end-------------------------------------------------------------------
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -