/****************************************************************************** ** File Name : $RCSfile: vpptools.h $ ** Short Description : Interface to VideoPort Professional toolkit ** Original Project : VideoPort Professional, MS801/MS802 ** Compiler, Version : Borland C++ 3.1,4.0, Visual C++ 1.0,1.51, ** Watcom C++ 9.5, 10.0 ** Compiler Options : Optimize for speed ** Libraries Used : none ** Original Author : Roar Lauritzsen ** Created (date) : 1995/01/16 ** Last modified by : $Author: Roar_Lauritzsen.NO.MRT $ ** Last modified (date): $Date: 1996/10/15 10:06:32 $ ** Current revision : $Revision: 1.23 $ ($Name: $) ******************************************************************************/ #ifndef _VPPTOOLS_H #define _VPPTOOLS_H /****************************************************************************** ** The following Compiler macros affect the compilation of the toolkit ** ** VPP_NO_LOW_LEVEL : Disables low-level interface ** VPP_NO_FLASH : Disables flash support ** VPP_NO_mono : Disables VPP_mono readout mode ** VPP_NO_mono4 : Disables VPP_mono4 readout mode ** VPP_NO_RGB8 : Disables VPP_RGB8 readout mode ** VPP_NO_RGB15 : Disables VPP_RGB15 readout mode ** VPP_NO_RGB16 : Disables VPP_RGB16 readout mode ** VPP_NO_RGB24 : Disables VPP_RGB24 readout mode ** VPP_NO_BGR24 : Disables VPP_BGR24 readout mode ** VPP_NO_BGR032 : Disables VPP_BGR032 readout mode ** VPP_NO_YCrCb : Disables VPP_YCrCb readout mode ** VPP_NO_CbYCrY : Disables VPP_CbYCrY readout mode ** VPP_NO_YCbCr : Disables VPP_YCbCr readout mode ** VPP_NO_ASM : Disables inline 'asm' statements ** VPP_FAST_MONO : Enables fast VPP_mono readout mode with gamma disabled ** VPP_FAST_RGB16 : Enables fast VPP_RGB16 readout mode with a large lookup ** table (64/128 kB) (gamma is disabled) ** VPP_NO_DLL : Define this macro if you are not compiling the toolkit ** as a DLL but you are compiling another DLL which ** includes the toolkit. ******************************************************************************/ /* !! Define your macros here or in your project macro definitions !! */ /****************************************************************************** ** Common declarations ** ******************************************************************************/ #if defined(__WIN32__) || defined(_WIN32) #if !defined(__WIN32__) #define __WIN32__ #endif #define VPP_far #elif defined(__WATCOMC__) #if !defined(__FLAT__) #error This toolkit does only support the flat memory model for WATCOM compilers #endif #define VPP_far #else #define VPP_far far #endif #if defined(_WINDOWS) && !defined(_Windows) #define _Windows #endif #if (defined(_DLL) || defined (_WINDLL)) && !defined(__DLL__) #define __DLL__ #endif #ifdef VPP_NO_DLL #undef __DLL__ #endif #if defined(__WIN32__) #define EXTERN __stdcall #elif defined(_Windows) #define EXTERN VPP_far _pascal #else #define EXTERN #endif #ifdef __cplusplus extern "C" { #endif #ifdef __WIN32__ typedef char VPP_Char; #else typedef signed char VPP_Char; #endif typedef unsigned char VPP_Byte; typedef unsigned short VPP_Word; typedef unsigned long VPP_DWord; typedef enum { VPP_false = 0, VPP_true = 1, } VPP_Bool; typedef enum { VPP_success = 0, /* No error */ VPP_toolkitInUse, /* VideoPort toolkit is already in use */ VPP_noHardwareDetected, /* No VideoPort hardware detected */ VPP_noDriverDetected, /* No VideoPort PCMCIA driver detected */ VPP_oldVideoPortDetected, /* The installed VideoPort is old-style */ VPP_notInitialized, /* init has not been called */ VPP_notConfigured, /* videoConfig has not been called */ VPP_snapNotPrepared, /* prepareSnap has not been called */ VPP_snapNotStarted, /* startSnap has not been called */ VPP_snapNotFinished, /* finishSnap has not been called */ VPP_readoutNotStarted, /* startReadout has not been called */ VPP_noSignalDetected, /* No video signal detected */ VPP_noColorSnapped, /* Snapped image does not contain colour */ VPP_readoutOutsideSnappedImage, /* Attempt to read outsize snapped image */ VPP_parameterOutOfRange, /* Parameter to function is out of range */ VPP_imageWidthOutOfRange, /* Image width is out of range */ VPP_imageHeightOutOfRange, /* Image height is out of range */ VPP_badPointer, /* Bad pointer (possibly NULL) */ VPP_lostContact, /* Contact with VideoPort is lost */ VPP_outOfMemory, /* Could not claim the memmory needed */ VPP_fileIOError, /* File input/output error. */ #ifdef TESTMODE VPP_lostContact2, /* Contact with VideoPort is lost */ #endif } VPP_Errno; typedef void VPP_far *VPP_CardHandle; VPP_Errno EXTERN VPP_init(void); VPP_Errno EXTERN VPP_closedown(VPP_Bool powerOff); VPP_Errno EXTERN VPP_getCurrentCardHandle(VPP_CardHandle *cardHandle); VPP_Errno EXTERN VPP_setActiveCard(VPP_CardHandle cardHandle); const char VPP_far* EXTERN VPP_errorString(VPP_Errno err); const char VPP_far* EXTERN VPP_lastErrorFunctionName(void); /****************************************************************************** ** High-level interface ** ******************************************************************************/ #define VPP_DEFAULT_CHANNEL 0 /* VPP_config, default input channel */ #define VPP_MIN_BRIGHTNESS -128 /* VPP_setBrightness, minimum value */ #define VPP_MIN_CONTRAST -128 /* VPP_setContrast, minimum value */ #define VPP_MIN_SATURATION -128 /* VPP_setSaturation, minimum value */ #define VPP_MIN_HUE -128 /* VPP_setHue, minimum value */ #define VPP_DEFAULT_BRIGHTNESS 0 /* VPP_setBrightness, default value */ #define VPP_DEFAULT_CONTRAST 0 /* VPP_setContrast, default value */ #define VPP_DEFAULT_SATURATION 0 /* VPP_setSaturation, default value */ #define VPP_DEFAULT_HUE 0 /* VPP_setHue, default value */ #define VPP_DEFAULT_GAMMA 1.0f /* VPP_setGamma, default value */ #define VPP_MAX_BRIGHTNESS 127 /* VPP_setBrightness, maximum value */ #define VPP_MAX_CONTRAST 127 /* VPP_setContrast, maximum value */ #define VPP_MAX_SATURATION 127 /* VPP_setSaturation, maximum value */ #define VPP_MAX_HUE 127 /* VPP_setHue, maximum value */ typedef enum { VPP_NTSC = 0, VPP_PAL = 1, VPP_noSignal = 2, } VPP_VideoStandard; typedef enum { VPP_composite = 0, VPP_Svideo = 1, VPP_monochrome = 2, } VPP_SignalType; typedef struct { VPP_Word xActiveMax; /* PAL: 922, NTSC: 754 */ VPP_Word xPixelsMax; /* PAL: 922, NTSC: 754, VideoPort Junior: 511 */ VPP_Word xActiveRatio; /* Currently: 14 */ VPP_Word xPixelsRatio; /* Currently: 1 */ VPP_Word yActiveMax; /* PAL: 625, NTSC: 525 */ VPP_Word yPixelsMax; /* PAL: 625, NTSC: 525, VideoPort Junior: 511 */ VPP_Word yActiveRatio; /* Currently: 14 */ VPP_Word yPixelsRatio; /* Currently: 1 */ } VPP_LimitData; typedef struct { VPP_Word xOffset; /* X offset of active video area */ VPP_Word xActive; /* Width of active video area */ VPP_Word xPixels; /* Requested width in pixels of active video area */ VPP_Word yOffset; /* Y offset of active video area */ VPP_Word yActive; /* Height of active video area */ VPP_Word yPixels; /* Requested height in pixels of active video area */ VPP_Bool interlaced; /* Flag to turn on interlaced snap */ VPP_Bool monochrome; /* Flag to turn on monochrome snap */ /********************************************************************** Restrictions: xOffset+xActive <= xActiveMax yOffset+yActive <= yActiveMax (yActiveMax/2 if interlaced==VPP_false) xPixels <= xPixelsMax yPixels <= yPixelsMax xPixels <= xActive yPixels <= yActive xPixels/xActive > xPixelsRatio/xActiveRatio yPixels/yActive > yPixelsRatio/yActiveRatio Typical values: PAL,max PAL,sq.pix. PAL,2:1 NTSC,max NTSC,sq.pix. NTSC,2:1 xOffset 0 0 0 0 0 0 xActive 922 922 922 754 754 754 xPixels 922 768 384 754 640 320 yOffset 32 33 33 21 24 24 yActive 576 574 574 486 480 480 yPixels 576 574 287 486 480 240 **********************************************************************/ } VPP_SnapData; typedef enum /* Format: Size factor: */ { #ifndef VPP_NO_mono VPP_mono = 1, /* Byte I... 1 */ #endif #ifndef VPP_NO_mono4 VPP_mono4 = 2, /* Nibble IIII(2)... dithered 1/2 */ #endif #ifndef VPP_NO_RGB8 VPP_RGB8 = 3, /* Byte RRRGGGBB(2)... dithered 1 */ #endif #ifndef VPP_NO_RGB15 VPP_RGB15 = 4, /* Word 0RRRRRGG GGGBBBBB(2)... 2 */ #endif #ifndef VPP_NO_RGB16 VPP_RGB16 = 5, /* Word RRRRRGGG GGGBBBBB(2)... 2 */ #endif #ifndef VPP_NO_RGB24 VPP_RGB24 = 6, /* Byte R,G,B... 3 */ #endif #ifndef VPP_NO_BGR24 VPP_BGR24 = 7, /* Byte B,G,R... 3 */ #endif #ifndef VPP_NO_BGR032 VPP_BGR032 = 8, /* Byte B,G,R,0... 4 */ #endif #ifndef VPP_NO_YCrCb VPP_YCrCb = 9, /* Byte Y,Cr,Cb... 3 */ #endif #ifndef VPP_NO_CbYCrY VPP_CbYCrY = 10, /* Byte Cb,Y,Cr,Y... 2 */ #endif #ifndef VPP_NO_YCbCr VPP_YCbCr = 11, /* Byte Y,Cb,Cr... 3 */ #endif } VPP_ReadoutMode; #ifndef VPP_NO_FLASH typedef enum { VPP_oddFieldFlash = 1, VPP_evenFieldFlash = 2, VPP_bothFieldsFlash = 3, } VPP_FlashSelect; typedef void (VPP_far* /*_pascal*/ VPP_FlashFuncPtr)(VPP_FlashSelect whichFlash); #endif VPP_Errno EXTERN VPP_getCardIdStrings(VPP_Char VPP_far* stringBuf, VPP_Word bufSize); VPP_Errno EXTERN VPP_videoConfig(VPP_Byte inputChannel, VPP_SignalType signalType, VPP_VideoStandard VPP_far* videoStandard); VPP_Errno EXTERN VPP_testSignal(VPP_VideoStandard VPP_far* videoStandard); VPP_Errno EXTERN VPP_setBrightness(VPP_Char brightness); VPP_Errno EXTERN VPP_setContrast (VPP_Char contrast); VPP_Errno EXTERN VPP_setSaturation(VPP_Char saturation); VPP_Errno EXTERN VPP_setHue (VPP_Char hue); VPP_Errno EXTERN VPP_setGamma (float gamma); VPP_Errno EXTERN VPP_getBrightness(VPP_Char VPP_far* brightness); VPP_Errno EXTERN VPP_getContrast (VPP_Char VPP_far* contrast); VPP_Errno EXTERN VPP_getSaturation(VPP_Char VPP_far* saturation); VPP_Errno EXTERN VPP_getHue (VPP_Char VPP_far* hue); #ifndef VPP_NO_FLASH #define VPP_DEFAULT_FLASH_DELAY 8 VPP_Errno EXTERN VPP_enableFlash(VPP_FlashSelect flashSelect, VPP_FlashFuncPtr flashFunc, VPP_Word flashDelay); VPP_Errno EXTERN VPP_disableFlash(void); #endif VPP_Errno EXTERN VPP_getLimits(VPP_VideoStandard videoStandard, VPP_LimitData VPP_far* limitData); VPP_Errno EXTERN VPP_prepareSnap(const VPP_SnapData VPP_far* snapData); VPP_Errno EXTERN VPP_startSnap(void); VPP_Errno EXTERN VPP_finishSnap(void); #ifndef VPP_NO_FLASH VPP_Errno EXTERN VPP_flashSnap(void); #endif VPP_Errno EXTERN VPP_extTrigSnap(VPP_Word msecTimeout); VPP_Errno EXTERN VPP_startReadout(VPP_ReadoutMode readoutMode, VPP_Word VPP_far* lineSize); VPP_Errno EXTERN VPP_readLine(void VPP_far* destination, VPP_Word offset, VPP_Word length); VPP_Errno EXTERN VPP_skipLines(VPP_Word linesToSkip); VPP_Errno EXTERN VPP_autoCrop(VPP_SnapData VPP_far* cropData); VPP_Errno EXTERN VPP_convertCbYCrYToBGR24(void VPP_far* pBGR24, void VPP_far* pCbYCrY, VPP_Word length); /****************************************************************************** ** Low-level interface ** ******************************************************************************/ #ifndef VPP_NO_LOW_LEVEL typedef struct { VPP_Byte STATUS; VPP_Byte IFORM; VPP_Byte TDEC; VPP_Byte CROP; VPP_Byte VDELAY_LO; VPP_Byte VACTIVE_LO; VPP_Byte HDELAY_LO; VPP_Byte HACTIVE_LO; VPP_Byte HSCALE_HI; VPP_Byte HSCALE_LO; VPP_Byte BRIGHT; VPP_Byte CONTROL; VPP_Byte CONTRAST_LO; VPP_Byte SAT_U_LO; VPP_Byte SAT_V_LO; VPP_Byte HUE; VPP_Byte OFORM; VPP_Byte VSCALE_HI; VPP_Byte VSCALE_LO; VPP_Byte VPOLE; VPP_Byte IDCODE; VPP_Byte ADELAY; VPP_Byte BDELAY; VPP_Byte ADC; } VPP_DigitizerRegisters; VPP_Errno EXTERN VPP_setControlStatus(VPP_Byte value); VPP_Errno EXTERN VPP_getControlStatus(VPP_Byte VPP_far* value); VPP_Errno EXTERN VPP_getData(VPP_Word VPP_far* value); VPP_Errno EXTERN VPP_setDigitizerRegister(VPP_Byte reg, VPP_Byte value); VPP_Errno EXTERN VPP_getDigitizerRegister(VPP_Byte reg, VPP_Byte VPP_far* value); VPP_Errno EXTERN VPP_setDigitizerRegisters(const VPP_DigitizerRegisters VPP_far* regs); VPP_Errno EXTERN VPP_getDigitizerRegisters(VPP_DigitizerRegisters VPP_far* regs); VPP_Errno EXTERN VPP_windowAddress(void VPP_far** window); #endif /* VPP_NO_LOW_LEVEL */ #ifdef __cplusplus } #endif #endif /* _VPPTOOLS_H */