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

📄 okapi32.h

📁 实现了java调用c的功能(JNI)
💻 H
📖 第 1 页 / 共 4 页
字号:
#define		SAMPLE_INTOPFIELD		5 //

//-----defines lParam for CAPTURE_CLIPMODE
#define		RECT_SCALERECT			0 
#define		RECT_CLIPCENTER			1 
#define		RECT_FIXLEFTTOP			2 
		//in condition video rect great than screen rect:
		//if RECT_SCALERECT video rect will be scaled to match screen rect if it can. else
		//video rect will be adjusted to match screen rect
		//(1: center, take center video rect  2: left-top fixed, take same size rect)


//-----sub-function defines for lParam of GetSignalParam
#define		SIGNAL_VIDEOEXIST		1 //0 video  absent, 1 exist
#define		SIGNAL_VIDEOTYPE		2 //0 field, 1 interlaced
#define		SIGNAL_SCANLINES		3 //scan lines per frame
#define		SIGNAL_LINEFREQ			4 //line frequency
#define		SIGNAL_FIELDFREQ		5 //frame frequency
#define		SIGNAL_FRAMEFREQ		6 //frame frequency
#define		SIGNAL_EXTTRIGGER		7 //extern trigger status, 1 trigger
#define		SIGNAL_FIELDID			8 //Field ID 0 odd, 1 even
#define		SIGNAL_VIDEOCOLOR		9 //color(1) or B/W(0)
#define		SIGNAL_TRANSFERING		10 //1 transfering video data

//-----sub-function defines for lEvent of WaitSignalEvent
#define		EVENT_FIELDHEADER		1 //field header
#define		EVENT_FRAMEHEADER		2 //frame header
#define		EVENT_ODDFIELD			3 //odd field come
#define		EVENT_EVENFIELD			4 //even field come
#define		EVENT_EXTTRIGGER		5 //extern trigger come, 
									  //(HIWORD(lEvent) is pole)

//-----sub-function defines for lParam of PutSignalParam
#define		PUTSIGNAL_TRIGGER		1 //put trigger signal, 1 trigger


//-----sub-function defines for lParam of okSetConvertParam
#define		CONVERT_RESETALL		0 //reset all to sys default
#define		CONVERT_FIELDEXTEND		1 //field extend				
#define		CONVERT_PALETTE			2 //set convert palette (just for 8 to 24 or 32)
					//lParam=0: restore system default, >0: new palette pointer 
#define		CONVERT_HORZEXTEND		3 //horzental extend (integer times)
#define		CONVERT_HORZSTRETCH		4 //horzental stretch (arbitrary number times)
#define		CONVERT_MIRROR			5 //x(=1) and y(=2) mirror (note:just to convert data with BUFFER)
#define		CONVERT_UPRIGHT			6 //up to righ(=1)(rotate right 90 D) or left (=2) (rotate left 90 D


//when wParam=CONVERT_FIELDEXTEND
//field extend mode
#define		FIELD_JUSTCOPY			0 //just copy row by row 
#define		FIELD_COPYEXTEND		1 //copy one row and expend one row (x2)
#define		FIELD_INTERLEAVE		2 //just copy odd(1.) rows (/2)
#define		FIELD_INTEREXTEND		3 //copy one odd row and expend one row 
#define		FIELD_COPYINTERPOL		4 //copy one odd row and interpolate one row
#define		FIELD_INTERINTERPOL		5 //copy odd row and interpolate even row

#define		FIELD_INTEREVEN			6 //just copy even(2.) rows (/2)
#define		FIELD_INTEREXTEVEN		7 //copy one even row and expend one row 
#define		FIELD_JUSTCOPYODD		8 //just copy odd rows to odd rows  
#define		FIELD_JUSTCOPYEVEN		9 //just copy even rows to even rows  
#define		FIELD_ODDEVENCROSS		10 //copy odd and even crossly 

									//just for the case without bit converting

//-----sub-function defines for wParam of okBeginEncode and okBeginDecode
#define		CODE_JPEG		1



//-----defines for several target we can support 
typedef	LPARAM	TARGET;

#define		BUFFER		(TARGET)1	//Buffer(physical) allocated from host memory
#define		VIDEO		(TARGET)0	//Video source input to the board 
#define		SCREEN		(TARGET)-1	//Screen supported by VGA
#define		FRAME		(TARGET)-2	//Frame buffer on the board
#define		MONITOR		(TARGET)-3	//Monitor supported by (D/A) TV standard


#define		SEQFILE			0x5153	//SQ 
#define		BMPFILE			0x4d42	//BM
#define		JPGFILE			0x504A	//JP 

#define		BLKHEADER		0x4b42	//BK
#define		BMPHEADER		0x4d42	//BM
#define		BUFHEADER		0x4642	//BF

//-----defines messages for user 

#define	WM_CLOSEREPLAY			WM_USER+100
		//send this message when close replay dlg

#define	WM_BEGINSEQPROC			WM_USER+101
		//begin seq proc, wParam=hBaord
#define	WM_SEQPROGRESS			WM_USER+102
		//seq in progress, wParam=hBaord, lParam=No. to
#define	WM_ENDSEQPROC			WM_USER+103
		//end seq proc, wParam=hBaord

//-----------struct defines---------------

//--app user used struct

typedef struct _boardtype {
	short	iBoardTypeCode; //ok board type code (e.g. 2030)
	char	szBoardName[18]; //board name (eg."OK_M20H")
	short	iBoardIdentCode; //ok board identity code (e.g. 2130)
	short	iBoardRankCode; //ok board model code 0,1,..
} BOARDTYPE, *LPBOARDTYPE; //24 bytes

//image file block size
typedef struct _blocksize {
	short	iWidth;		//width
	short	iHeight;	//height
	short	iBitCount; //pixel bytes iBitCount
	short	iFormType;	//rgb format type, need to fill when RGB565 or RGB 555
	long	lBlockStep; //block stride (step to next image header)
						//need to fill when treat multi block else set 0
}BLOCKSIZE;



//image block info
typedef struct _blockinfo {
	short	iType;	//=BK or SQ, BM
	//struct _blocksize;
	short	iWidth;		//width
	short	iHeight;	//height
	short	iBitCount; //pixel bytes iBitCount
	short	iFormType;	//rgb format type, need to fill when RGB565 or RGB 555
	short	lBlockStep; //block stride (step to next image header)
	short	iHiStep;// HIWORD of block stride
	short	lTotal;	//frame num
	short	iHiTotal;// HIWORD of total
	short	iInterval; //frame interval
	LPBYTE	lpBits;// image data pointer / file path name
	LPBYTE	lpExtra;// extra data (like as palette, mask) pointer
} BLOCKINFO, *LPBLOCKINFO;

//sequence file info
typedef struct { //file info for seq
	short	iType;	//=SQ or BM
	//struct _blocksize;
	short	iWidth;		//width
	short	iHeight;	//height
	short	iBitCount; //pixel bytes iBitCount
	short	iFormType;	//rgb format type, need to fill when RGB565 or RGB 555
	short	lBlockStep; //block stride (step to next image header)
	short	iHiStep;// HIWORD of block stride
	short	lTotal;	//frame num
	short	iHiTotal;// HIWORD of total
	short	iInterval; //frame interval
} SEQINFO;


//for replay
typedef struct { //file info for seq
	LPBITMAPINFOHEADER	lpbi; //bitmap info
	BYTE			*lpdib; //dib data
	HWND			hwndPlayBox; //1 replaying, 0 quit
	short			iCurrFrame; //current frame in buffer
	short			iReserved; //
} DIBINFO, *LPDIBINFO;



//---image size------
typedef struct _imagesize {
	DWORD	dwWidth;
	DWORD	dwHeight;
	DWORD	dwBitCount;
	DWORD	dwReserved1;
}IMAGESIZE, *LPIMAGESIZE;

//--jpeg set params
typedef struct _jpegparam {
	DWORD		dwSize; // the size of this strcut, must be set
	LPSTR		lpstrName;	//must be NULL if not use
	DWORD		dwQuality; //
	DWORD		dwReserved1;
} JPEGPARAM, *LPJPEGPARAM;


//---set text mode----
typedef struct _settextmode {
	DWORD	dwForeColor; // forecolor, see macro RGB in win
	DWORD	dwBackColor; // backcolor, see macro RGB in win
	DWORD	dwSetMode; // 0:FULLCOPY, 1: FULLXOR, ...
	WORD	wFrameNo; // place which frame of target
	WORD	wReserved; // not used
} SETTEXTMODE;

#define		FULLCOPY		0		//copy full text region into target
#define		FULLXOR			1		//xor full text region and target
#define		COPYFONT		2		//just copy fonts strokes to target
#define		XORFONT			3		//just xor fonts strokes and target



//------ okapi32 functions list -----------

#ifdef __cplusplus
extern "C" {            /* Assume C declarations for C++ */
#endif /* __cplusplus */


//--1. basic routines--------------

//prolog and epilog
HANDLE	WINAPI okOpenBoard(long *iIndex); //okLockBoard
		//open a Ok series board in specified index(0 based), return 0 if not found any
		//if success, return a handle to control specified board
		//if set index=-1, mean takes default index no. (default is 0 
		//if user not specified by 'Ok Device Manager' in Control Pannel)
		//this index can be also a specified board type code
		//this function will change iIndex to the true used index, 
		//if index input is -1 or type code 

BOOL	WINAPI okCloseBoard(HANDLE hBoard); //okCloseBoard
		//Unlock and close Ok board specified handle

long	WINAPI okGetLastError();
		//Get last error msg

long	WINAPI okGetDriverVer(LPSTR lpString, int iSize);
		//get version of current ok cards driver
		//lpString return version char string (e.g "5.08"),  iSize is lpString' size


long	WINAPI okGetBufferSize(HANDLE hBoard, void **lpLinear, DWORD *dwSize);
		//get base address and size of pre-allocated buffer,
		//if success return the max. frame num in which can be store according to current set
		//else return false;
LPVOID  WINAPI okGetBufferAddr(HANDLE hBoard, long lNoFrame);
		//get base address of specified frame No. in BUFFER
		//if success return the linear base address 
		//else return false;

LPVOID  WINAPI okGetTargetInfo(HANDLE hBoard, TARGET tgt, long lNoFrame, short * wid, short * ht, long *stride);
		//get target info include base address, width, height and stride specified frame No. 
		//if success return the linear base address and other infos, else return false;

short	WINAPI okGetTypeCode(HANDLE hBoard, LPSTR lpBoardName);
		//return type code and name of specified handle 


//set rect and capture 
long	WINAPI okSetTargetRect(HANDLE hBoard, TARGET target, LPRECT lpTgtRect);
		//set target (VIDEO, SCREEN, BUFFER, FRAME)capture to or from
		//if Rect.right or .bottom) are -1 , they will be filled current value
		//special note for target=BUFFER:
		//if never set CAPTURE_BUFBLOCKSIZE, the block size(W,H) of buffer will be changed 
		//according to size of right x bottom of lpRect, else the size will not changed 
		//if success return max frames this target can support, else return <=0

BOOL	WINAPI okSetToWndRect(HANDLE hBoard, HWND hWnd);
		//set client rect of hwnd as screen rect


BOOL	WINAPI okCaptureSingle(HANDLE hBoard, TARGET Dest, LONG lStart);
		//capture video source to target which can be BUFFER, SCREEN, FRAME, MONITOR 
		//start(o based).if success return 1, if failed return 0, if not support target -1
		//when this function sent command to grabber, then return immediately not wait to finish.
		//this function same as okCaptureTo(hBoard, Dest, wParam, 1);

BOOL	WINAPI okCaptureActive(HANDLE hBoard, TARGET Dest, LONG lStart);
		//capture continuous active video to same position in target which can be BUFFER, SCREEN, FRAME, MONITOR 
		//start(o based).if success return 1, if failed return 0, if not support target -1
		//when this function sent continuous command to grabber, then return immediately
		//but note that some card like RGB30. when target is SCREEN, this function is a thread.
		//this function same as okCaptureTo(hBoard, Dest, wParam, 0);

BOOL	WINAPI okCaptureThread(HANDLE hBoard, TARGET Dest, LONG lStart, LPARAM lNoFrame);
		//capture sequencely video to target which can be BUFFER, SCREEN, FRAME, MONITOR 
		//start(o based). lParam>0: number of frame to capture to,
 		//if lParam > total frames in BUFER, it will loop in rewind mode(i%total)
		//if lParam=-N mean it loop in buffer of N frame infinitely until call okStopCapture, 
		//when -1 mean loop in all buffer.
		//return max num frame can be stored in the target if success,

⌨️ 快捷键说明

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