00001 // ========================================================================================== 00009 // ========================================================================================== 00010 00011 #ifndef _VIDEOWRAPPER_H 00012 #define _VIDEOWRAPPER_H 00013 00014 #include "VideoWrapperTypes.h" 00015 00016 // for the timeval definition 00017 #ifdef UNIX 00018 #include <sys/time.h> 00019 #else 00020 #include <time.h> 00021 #endif 00022 00023 #ifdef __cplusplus 00024 extern "C" 00025 { 00026 #endif 00027 00028 // ========================================================================================== 00029 // entry point macros 00030 // ========================================================================================== 00031 // This defines the calling conventions of the entry points for 00032 // dynamic libraries. This varies depending upon the operating system. 00033 00034 #ifdef _LIB // static library 00035 #define VW_API 00036 #define VW_API_ENTRY __cdecl 00037 typedef void (* DLL_EP)(void); 00038 #define DLL_EP_PTR __cdecl * 00039 #else 00040 #if defined (_WIN32) || defined(WIN32) || defined(__WIN32__) 00041 #ifdef VW_API_EXPORTS 00042 #define VW_API __declspec(dllexport) 00043 #else 00044 #define VW_API __declspec(dllimport) 00045 #endif 00046 #define VW_API_ENTRY __cdecl 00047 typedef void (* DLL_EP)(void); 00048 #define DLL_EP_PTR __cdecl * 00049 #else 00050 #define VW_API 00051 #define VW_API_ENTRY 00052 typedef void (* DLL_EP)(void); 00053 #define DLL_EP_PTR * 00054 #endif 00055 #endif 00056 00057 00058 // ========================================================================================== 00059 // api management functions 00060 // ========================================================================================== 00062 00063 00064 // ------------------------------------------------------------------------------------------ 00065 // VIDEO_loadLibrary 00066 // ------------------------------------------------------------------------------------------ 00079 VW_API VWResult VW_API_ENTRY VIDEO_loadLibrary(char* szLibIdentifier, char* szLibImplementation); 00080 00084 typedef void (VW_API_ENTRY VWPrintFcn)(char *); 00085 00086 // ------------------------------------------------------------------------------------------ 00087 // VIDEO_setPrintFunction 00088 // ------------------------------------------------------------------------------------------ 00094 VW_API VWResult VW_API_ENTRY VIDEO_setPrintFunction(VWPrintFcn *fp); 00095 00097 00098 // ========================================================================================== 00099 // camera management functions 00100 // ========================================================================================== 00101 00103 00104 00105 // ------------------------------------------------------------------------------------------ 00106 // VIDEO_openVideo 00107 // ------------------------------------------------------------------------------------------ 00140 VW_API VWResult VW_API_ENTRY VIDEO_openVideo(char* szInit, VWHVideo* phVideo); 00141 00142 00143 // ------------------------------------------------------------------------------------------ 00144 // VIDEO_close 00145 // ------------------------------------------------------------------------------------------ 00153 VW_API VWResult VW_API_ENTRY VIDEO_close(VWHVideo hVideo); 00154 00155 // ------------------------------------------------------------------------------------------ 00156 // VIDEO_startVideo 00157 // ------------------------------------------------------------------------------------------ 00165 VW_API VWResult VW_API_ENTRY VIDEO_startVideo(VWHVideo hVideo); 00166 00167 // ------------------------------------------------------------------------------------------ 00168 // VIDEO_stopVideo 00169 // ------------------------------------------------------------------------------------------ 00177 VW_API VWResult VW_API_ENTRY VIDEO_stopVideo(VWHVideo hVideo); 00178 00179 00180 // ------------------------------------------------------------------------------------------ 00181 // VIDEO_resetVideo 00182 // ------------------------------------------------------------------------------------------ 00191 VW_API VWResult VW_API_ENTRY VIDEO_resetVideo(VWHVideo hVideo, VWBool bAutomatic); 00192 00194 00195 00196 // ========================================================================================== 00197 // frame capture functions 00198 // ========================================================================================== 00200 00201 00202 // ------------------------------------------------------------------------------------------ 00203 // VIDEO_getFrame 00204 // ------------------------------------------------------------------------------------------ 00216 VW_API VWResult VW_API_ENTRY VIDEO_getFrame(VWHVideo hVideo, unsigned char** ppbFrame, timeval* pTimestamp); 00217 00218 // ------------------------------------------------------------------------------------------ 00219 // VIDEO_releaseFrame 00220 // ------------------------------------------------------------------------------------------ 00228 VW_API VWResult VW_API_ENTRY VIDEO_releaseFrame(VWHVideo hVideo); 00229 00230 // ------------------------------------------------------------------------------------------ 00231 // VIDEO_getFrameRate 00232 // ------------------------------------------------------------------------------------------ 00241 VW_API VWResult VW_API_ENTRY VIDEO_getFrameRate(VWHVideo hVideo, double* pdFrameRate); 00242 00244 00245 // ========================================================================================== 00246 // image format accessor functions 00247 // ========================================================================================== 00249 00250 00251 // ------------------------------------------------------------------------------------------ 00252 // VIDEO_getWidth 00253 // ------------------------------------------------------------------------------------------ 00262 VW_API VWResult VW_API_ENTRY VIDEO_getWidth(VWHVideo hVideo, int* pnWidth); 00263 00264 00265 // ------------------------------------------------------------------------------------------ 00266 // VIDEO_getHeight 00267 // ------------------------------------------------------------------------------------------ 00276 VW_API VWResult VW_API_ENTRY VIDEO_getHeight(VWHVideo hVideo, int* pnHeight); 00277 00278 00279 // ------------------------------------------------------------------------------------------ 00280 // VIDEO_getPixelFormat 00281 // ------------------------------------------------------------------------------------------ 00282 // TODO: doc 00293 VW_API VWResult VW_API_ENTRY VIDEO_getPixelFormat(VWHVideo hVideo, int* pnFormat); 00294 00295 // ------------------------------------------------------------------------------------------ 00296 // VIDEO_getDepth 00297 // ------------------------------------------------------------------------------------------ 00306 VW_API VWResult VW_API_ENTRY VIDEO_getDepth(VWHVideo hVideo, int* pnDepth); 00307 00309 00310 // ========================================================================================== 00311 // error reporting 00312 // ========================================================================================== 00314 00315 00316 // ------------------------------------------------------------------------------------------ 00317 // VIDEO_getErrDescription 00318 // ------------------------------------------------------------------------------------------ 00326 VW_API char* VW_API_ENTRY VIDEO_getErrDescription( VWResult resultCode); 00327 00328 // @} 00329 00330 // ========================================================================================== 00331 // camera property functions 00332 // ========================================================================================== 00334 00335 00336 // ------------------------------------------------------------------------------------------ 00337 // VIDEO_showPropertiesDialog 00338 // ------------------------------------------------------------------------------------------ 00347 VW_API VWResult VW_API_ENTRY VIDEO_showPropertiesDialog(VWHVideo hVideo); 00348 00349 // ------------------------------------------------------------------------------------------ 00350 // VIDEO_setPropertyLong 00351 // ------------------------------------------------------------------------------------------ 00365 VW_API VWResult VW_API_ENTRY VIDEO_setPropertyLong( VWHVideo hVideo, VWCamProp propId, long lValue1, long lValue2 = 0L, VWBool bAuto = FALSE); 00366 00367 // ------------------------------------------------------------------------------------------ 00368 // VIDEO_getPropertyLong 00369 // ------------------------------------------------------------------------------------------ 00383 VW_API VWResult VW_API_ENTRY VIDEO_getPropertyLong( VWHVideo hVideo, VWCamProp propId, long* plValue1 = NULL, long* plValue2 = NULL, VWBool* pbAuto = NULL); 00384 00385 00386 // ------------------------------------------------------------------------------------------ 00387 // VIDEO_getPropertyRangeLong 00388 // ------------------------------------------------------------------------------------------ 00401 VW_API VWResult VW_API_ENTRY VIDEO_getPropertyRangeLong( VWHVideo hVideo, VWCamProp propId, long* plMinValue = NULL, long* plMaxValue = NULL, VWBool* pbAuto = NULL); 00402 00403 // TODO: keep double property functions? 00404 /* 00405 VW_API VWResult VW_API_ENTRY VIDEO_setPropertyDouble( VWHVideo hVideo, VWCamProp propId, long lValue1, long lValue2 = 0L, VWBool bAuto = FALSE); 00406 VW_API VWResult VW_API_ENTRY VIDEO_getPropertyDouble( VWHVideo hVideo, VWCamProp propId, long* plValue1 = NULL, long* plValue2 = NULL, VWBool* pbAuto = NULL); 00407 VW_API VWResult VW_API_ENTRY VIDEO_getPropertRangeDouble( VWHVideo hVideo, VWCamProp propId, long* plMinValue = NULL, long* plMaxValue = NULL, VWBool* pbAuto = NULL); 00408 */ 00409 00410 // ------------------------------------------------------------------------------------------ 00411 // VIDEO_setPropertyString 00412 // ------------------------------------------------------------------------------------------ 00423 VW_API VWResult VW_API_ENTRY VIDEO_setPropertyString( VWHVideo hVideo, VWCamProp propId, char* szValue); 00424 00425 // ------------------------------------------------------------------------------------------ 00426 // VIDEO_getPropertyString 00427 // ------------------------------------------------------------------------------------------ 00438 VW_API VWResult VW_API_ENTRY VIDEO_getPropertyString( VWHVideo hVideo, VWCamProp propId, char* szValue, int nSize); 00439 00441 00442 // ========================================================================================== 00443 // disk capture functions 00444 // ========================================================================================== 00446 00447 00448 // ------------------------------------------------------------------------------------------ 00449 // VIDEO_startFramesToDisk 00450 // ------------------------------------------------------------------------------------------ 00467 VW_API VWResult VW_API_ENTRY VIDEO_startFramesToDisk(VWHVideo hVideo, char* szOutputDirectory, long lBufferSizeLimit = VW_UNLIMITED_BUFFER); 00468 00469 00470 // ------------------------------------------------------------------------------------------ 00471 // VIDEO_stopFramesToDisk 00472 // ------------------------------------------------------------------------------------------ 00481 VW_API VWResult VW_API_ENTRY VIDEO_stopFramesToDisk(VWHVideo hVideo, int* pnFrames = NULL); 00482 00484 00485 // ========================================================================================== 00486 // replay camera functions 00487 // ========================================================================================== 00488 //{@ 00493 00494 // ------------------------------------------------------------------------------------------ 00495 // VIDEO_replaySetPlaybackPosition 00496 // ------------------------------------------------------------------------------------------ 00505 VW_API VWResult VW_API_ENTRY VIDEO_replaySetPlaybackPosition( VWHVideo hVideo, timeval tvNewPosition); 00506 00507 // ------------------------------------------------------------------------------------------ 00508 // VIDEO_replaySetPlaybackLoop 00509 // ------------------------------------------------------------------------------------------ 00519 VW_API VWResult VW_API_ENTRY VIDEO_replaySetPlaybackLoop( VWHVideo hVideo, VWBool bLoop); 00520 00521 // ------------------------------------------------------------------------------------------ 00522 // VIDEO_replayIsPlaybackFinished 00523 // ------------------------------------------------------------------------------------------ 00533 VW_API VWBool VW_API_ENTRY VIDEO_replayIsPlaybackFinished( VWHVideo hVideo, VWBool* pbFinished); 00534 00536 00537 #ifdef __cplusplus 00538 } 00539 #endif 00540 00541 #endif // ifndef _VIDEOWRAPPER_H 00542 00543