PlusLib  2.9.0
Software library for tracked ultrasound image acquisition, calibration, and processing.
frmgrab.h
Go to the documentation of this file.
1 /****************************************************************************
2  *
3  * $Id: frmgrab.h 14478 2011-10-17 20:49:08Z monich $
4  *
5  * Copyright (C) 2008-2011 Epiphan Systems Inc. All rights reserved.
6  *
7  * Header file for the Epiphan frame grabber library
8  *
9  ****************************************************************************/
10 
11 #ifndef _EPIPHAN_FRMGRAB_H_
12 #define _EPIPHAN_FRMGRAB_H_ 1
13 
14 #include "v2u_defs.h"
15 
16 #ifdef __cplusplus
17 extern "C" {
18 #endif /* __cplusplus */
19 
20 typedef struct _FrmGrabber FrmGrabber;
21 struct sockaddr_in;
22 
27 void FrmGrab_Init(void);
28 void FrmGrab_Deinit(void);
29 void FrmGrabNet_Init(void);
30 void FrmGrabNet_Deinit(void);
31 
36 FrmGrabber* FrmGrabLocal_OpenSN(const char* sn);
38 int FrmGrabLocal_Count(void);
39 int FrmGrabLocal_OpenAll(FrmGrabber* grabbers[], int maxcount);
40 
49 typedef V2U_BOOL (*FrmGrabAuthProc)(char* user, char* pass, void* param);
50 #define FG_USERNAME_SIZE 32
51 #define FG_PASSWORD_SIZE 64
52 
56 typedef enum _FrmGrabConnectStatus {
57  FrmGrabConnectOK, /* Connection OK, authentication not needed */
58  FrmGrabConnectAuthOK, /* Connection OK, authentication successful */
59  FrmGrabConnectError, /* Connection failed */
60  FrmGrabConnectAuthFail, /* Authentication failure */
61  FrmGrabConnectAuthCancel /* Authentication was cancelled */
63 
68 FrmGrabber* FrmGrabNet_OpenSN(const char* sn);
69 FrmGrabber* FrmGrabNet_OpenLocation(const char* location);
72  FrmGrabAuthProc authproc, void* param, FrmGrabConnectStatus* status);
73 
80  void* param);
81 
90  const char* pass);
91 
96 typedef struct _FrmGrabNetStat {
97  V2U_UINT64 bytesSent; /* Total bytes sent over the network */
98  V2U_UINT64 bytesReceived; /* Total bytes received from the network */
100 
102 V2U_BOOL FrmGrabNet_GetRemoteAddr(FrmGrabber* fg, struct sockaddr_in* addr);
103 
104 /* Other network-specific functions */
107 
134 FrmGrabber* FrmGrab_Open(const char* location);
135 
141 
145 const char* FrmGrab_GetSN(FrmGrabber* fg);
146 
152 
153 #define PRODUCT_ID_MASK 0x0000ffff
154 #define PRODUCT_TYPE_MASK 0x00ff0000
155 #define PRODUCT_TYPE_USB 0x00010000 /* Local USB grabber */
156 #define PRODUCT_TYPE_NET 0x00020000 /* Network grabber */
157 #define PRODUCT_TYPE_NETAPP 0x00030000 /* Network appliance, not a grabber */
158 #define PRODUCT_TYPE_FILE 0x00040000 /* Reserved */
159 #define PRODUCT_TYPE_PCI 0x00050000 /* Local PCI grabber */
160 
161 #define FrmGrab_IsNetGrabber(fg) \
162  ((FrmGrab_GetProductId(fg) & PRODUCT_TYPE_MASK) == PRODUCT_TYPE_NET)
163 
164 #define FrmGrab_IsUsbGrabber(fg) \
165  ((FrmGrab_GetProductId(fg) & PRODUCT_TYPE_MASK) == PRODUCT_TYPE_USB)
166 
167 #define FrmGrab_IsPciGrabber(fg) \
168  ((FrmGrab_GetProductId(fg) & PRODUCT_TYPE_MASK) == PRODUCT_TYPE_PCI)
169 
170 #define FrmGrab_IsLocalGrabber(fg) \
171  (FrmGrab_IsUsbGrabber(fg) || \
172  FrmGrab_IsPciGrabber(fg))
173 
177 const char* FrmGrab_GetProductName(FrmGrabber* fg);
178 
183 const char* FrmGrab_GetLocation(FrmGrabber* fg);
184 
190 
198 
204 
209 
216  V2UAdjRange* range);
217 
222 
227 
232 
242 typedef struct _FrmGrabVgaModes {
243  V2UVideoModeDescr* customModes; /* Custom modes */
244  V2UVideoModeDescr* stdModes; /* Standard modes */
245  int numCustomModes; /* Number of custom modes */
246  int numStdModes; /* Number of standard modes */
248 
254 
260 
265 
271 V2U_BOOL FrmGrab_SetMaxFps(FrmGrabber* fg, double maxFps);
272 
282 
286 void FrmGrab_Stop(FrmGrabber* fg);
287 
299  const V2URect* crop);
300 
304 void FrmGrab_Release(FrmGrabber* fg, V2U_GrabFrame2* frame);
305 
309 void FrmGrab_Close(FrmGrabber* fg);
310 
314 void FrmGrab_Free(void* ptr);
315 
317 typedef void* (*FrmGrabMemAlloc)(void* param, V2U_UINT32 len);
318 typedef void (*FrmGrabMemFree)(void* param, void* ptr);
319 
320 typedef struct _FrmGrabMemCB {
323 } FrmGrabMemCB;
324 
333 void FrmGrab_SetAlloc(FrmGrabber* fg, const FrmGrabMemCB* memcb, void* param);
334 
335 #ifdef __cplusplus
336 } /* end of extern "C" */
337 #endif /* __cplusplus */
338 
339 #endif /* _EPIPHAN_FRMGRAB_H_ */
340 
341 /*
342  * Local Variables:
343  * c-basic-offset: 4
344  * indent-tabs-mode: nil
345  * End:
346  */
uint64_t V2U_UINT64
Definition: v2u_defs.h:66
void FrmGrab_Close(FrmGrabber *fg)
V2U_BOOL(* FrmGrabAuthProc)(char *user, char *pass, void *param)
Definition: frmgrab.h:49
FrmGrabMemFree free
Definition: frmgrab.h:322
FrmGrabber * FrmGrabNet_Open(void)
void FrmGrab_Free(void *ptr)
V2UVideoModeDescr * stdModes
Definition: frmgrab.h:244
FrmGrabConnectStatus FrmGrabNet_Auth(FrmGrabber *fg, FrmGrabAuthProc authproc, void *param)
FrmGrabber * FrmGrab_Dup(FrmGrabber *fg)
FrmGrabMemAlloc alloc
Definition: frmgrab.h:321
FrmGrabber * FrmGrabLocal_OpenSN(const char *sn)
void FrmGrab_Stop(FrmGrabber *fg)
V2U_BOOL FrmGrab_SetVGAModes(FrmGrabber *fg, const FrmGrabVgaModes *vgaModes)
V2U_UINT64 bytesSent
Definition: frmgrab.h:97
V2U_INT32 V2U_BOOL
Definition: v2u_defs.h:71
V2U_BOOL FrmGrab_GetGrabParams(FrmGrabber *fg, V2U_GrabParameters *gp)
V2U_BOOL FrmGrab_SendPS2(FrmGrabber *fg, const V2U_SendPS2 *ps2)
V2U_BOOL FrmGrab_GetGrabParams2(FrmGrabber *fg, V2U_GrabParameters *gp, V2UAdjRange *range)
void FrmGrabNet_Deinit(void)
_FrmGrabConnectStatus
Definition: frmgrab.h:56
int numCustomModes
Definition: frmgrab.h:245
for i
void FrmGrab_Init(void)
int FrmGrab_GetProductId(FrmGrabber *fg)
uint16_t V2U_UINT16
Definition: v2u_defs.h:62
V2U_BOOL FrmGrabNet_IsAlive(FrmGrabber *fg)
struct _FrmGrabber FrmGrabber
Definition: frmgrab.h:20
enum _FrmGrabConnectStatus FrmGrabConnectStatus
int port
Definition: phidget22.h:2454
FrmGrabber * FrmGrabLocal_Open(void)
void(* FrmGrabMemFree)(void *param, void *ptr)
Definition: frmgrab.h:318
struct _FrmGrabVgaModes FrmGrabVgaModes
const char * FrmGrab_GetSN(FrmGrabber *fg)
const char * FrmGrab_GetLocation(FrmGrabber *fg)
uint32_t V2U_UINT32
Definition: v2u_defs.h:64
V2U_BOOL FrmGrabNet_IsProtected(FrmGrabber *fg)
V2U_BOOL FrmGrabNet_SetAutoReconnect(FrmGrabber *fg, V2U_BOOL enable)
FrmGrabber * FrmGrabNet_OpenSN(const char *sn)
int FrmGrabLocal_OpenAll(FrmGrabber *grabbers[], int maxcount)
V2UVideoModeDescr * customModes
Definition: frmgrab.h:243
void FrmGrab_Deinit(void)
FrmGrabber * FrmGrabLocal_OpenIndex(int i)
V2U_BOOL FrmGrab_Start(FrmGrabber *fg)
V2U_BOOL FrmGrab_SetGrabParams(FrmGrabber *fg, const V2U_GrabParameters *gp)
V2U_BOOL FrmGrab_DetectVideoMode(FrmGrabber *fg, V2U_VideoMode *vm)
FrmGrabVgaModes * FrmGrab_GetVGAModes(FrmGrabber *fg)
FrmGrabConnectStatus FrmGrabNet_Auth2(FrmGrabber *fg, const char *user, const char *pass)
void FrmGrab_SetAlloc(FrmGrabber *fg, const FrmGrabMemCB *memcb, void *param)
struct _FrmGrabNetStat FrmGrabNetStat
void *(* FrmGrabMemAlloc)(void *param, V2U_UINT32 len)
Definition: frmgrab.h:317
void FrmGrabNet_Init(void)
struct _FrmGrabMemCB FrmGrabMemCB
V2U_BOOL FrmGrab_GetProperty(FrmGrabber *fg, V2U_Property *prop)
V2U_BOOL FrmGrabNet_GetRemoteAddr(FrmGrabber *fg, struct sockaddr_in *addr)
FrmGrabber * FrmGrabNet_OpenAddress(V2U_UINT32 ipaddr, V2U_UINT16 port)
V2U_UINT32 FrmGrab_GetCaps(FrmGrabber *fg)
void FrmGrab_GetVideoMode(FrmGrabber *fg, V2U_VideoMode *vm)
FrmGrabber * FrmGrabNet_OpenLocation(const char *location)
V2U_BOOL FrmGrab_SetProperty(FrmGrabber *fg, const V2U_Property *prop)
V2U_GrabFrame2 * FrmGrab_Frame(FrmGrabber *fg, V2U_UINT32 format, const V2URect *crop)
FrmGrabber * FrmGrabNet_OpenAddress2(V2U_UINT32 ipaddr, V2U_UINT16 port, FrmGrabAuthProc authproc, void *param, FrmGrabConnectStatus *status)
void FrmGrab_Release(FrmGrabber *fg, V2U_GrabFrame2 *frame)
V2U_BOOL FrmGrab_SetMaxFps(FrmGrabber *fg, double maxFps)
V2U_UINT64 bytesReceived
Definition: frmgrab.h:98
FrmGrabber * FrmGrab_Open(const char *location)
const char * FrmGrab_GetProductName(FrmGrabber *fg)
V2U_BOOL FrmGrabNet_GetStat(FrmGrabber *fg, FrmGrabNetStat *netstat)
int FrmGrabLocal_Count(void)