PlusLib  2.9.0
Software library for tracked ultrasound image acquisition, calibration, and processing.
Classes | Macros | Typedefs | Enumerations | Functions
frmgrab.h File Reference
#include "v2u_defs.h"
Include dependency graph for frmgrab.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  _FrmGrabMemCB
 
struct  _FrmGrabNetStat
 
struct  _FrmGrabVgaModes
 

Macros

#define FG_PASSWORD_SIZE   64
 
#define FG_USERNAME_SIZE   32
 
#define FrmGrab_IsLocalGrabber(fg)
 
#define FrmGrab_IsNetGrabber(fg)   ((FrmGrab_GetProductId(fg) & PRODUCT_TYPE_MASK) == PRODUCT_TYPE_NET)
 
#define FrmGrab_IsPciGrabber(fg)   ((FrmGrab_GetProductId(fg) & PRODUCT_TYPE_MASK) == PRODUCT_TYPE_PCI)
 
#define FrmGrab_IsUsbGrabber(fg)   ((FrmGrab_GetProductId(fg) & PRODUCT_TYPE_MASK) == PRODUCT_TYPE_USB)
 
#define PRODUCT_ID_MASK   0x0000ffff
 
#define PRODUCT_TYPE_FILE   0x00040000 /* Reserved */
 
#define PRODUCT_TYPE_MASK   0x00ff0000
 
#define PRODUCT_TYPE_NET   0x00020000 /* Network grabber */
 
#define PRODUCT_TYPE_NETAPP   0x00030000 /* Network appliance, not a grabber */
 
#define PRODUCT_TYPE_PCI   0x00050000 /* Local PCI grabber */
 
#define PRODUCT_TYPE_USB   0x00010000 /* Local USB grabber */
 

Typedefs

typedef V2U_BOOL(* FrmGrabAuthProc) (char *user, char *pass, void *param)
 
typedef struct _FrmGrabber FrmGrabber
 
typedef enum _FrmGrabConnectStatus FrmGrabConnectStatus
 
typedef void *(* FrmGrabMemAlloc) (void *param, V2U_UINT32 len)
 
typedef struct _FrmGrabMemCB FrmGrabMemCB
 
typedef void(* FrmGrabMemFree) (void *param, void *ptr)
 
typedef struct _FrmGrabNetStat FrmGrabNetStat
 
typedef struct _FrmGrabVgaModes FrmGrabVgaModes
 

Enumerations

enum  _FrmGrabConnectStatus {
  FrmGrabConnectOK, FrmGrabConnectAuthOK, FrmGrabConnectError, FrmGrabConnectAuthFail,
  FrmGrabConnectAuthCancel
}
 

Functions

void FrmGrab_Close (FrmGrabber *fg)
 
void FrmGrab_Deinit (void)
 
V2U_BOOL FrmGrab_DetectVideoMode (FrmGrabber *fg, V2U_VideoMode *vm)
 
FrmGrabberFrmGrab_Dup (FrmGrabber *fg)
 
V2U_GrabFrame2FrmGrab_Frame (FrmGrabber *fg, V2U_UINT32 format, const V2URect *crop)
 
void FrmGrab_Free (void *ptr)
 
V2U_UINT32 FrmGrab_GetCaps (FrmGrabber *fg)
 
V2U_BOOL FrmGrab_GetGrabParams (FrmGrabber *fg, V2U_GrabParameters *gp)
 
V2U_BOOL FrmGrab_GetGrabParams2 (FrmGrabber *fg, V2U_GrabParameters *gp, V2UAdjRange *range)
 
const char * FrmGrab_GetLocation (FrmGrabber *fg)
 
int FrmGrab_GetProductId (FrmGrabber *fg)
 
const char * FrmGrab_GetProductName (FrmGrabber *fg)
 
V2U_BOOL FrmGrab_GetProperty (FrmGrabber *fg, V2U_Property *prop)
 
const char * FrmGrab_GetSN (FrmGrabber *fg)
 
FrmGrabVgaModesFrmGrab_GetVGAModes (FrmGrabber *fg)
 
void FrmGrab_GetVideoMode (FrmGrabber *fg, V2U_VideoMode *vm)
 
void FrmGrab_Init (void)
 
FrmGrabberFrmGrab_Open (const char *location)
 
void FrmGrab_Release (FrmGrabber *fg, V2U_GrabFrame2 *frame)
 
V2U_BOOL FrmGrab_SendPS2 (FrmGrabber *fg, const V2U_SendPS2 *ps2)
 
void FrmGrab_SetAlloc (FrmGrabber *fg, const FrmGrabMemCB *memcb, void *param)
 
V2U_BOOL FrmGrab_SetGrabParams (FrmGrabber *fg, const V2U_GrabParameters *gp)
 
V2U_BOOL FrmGrab_SetMaxFps (FrmGrabber *fg, double maxFps)
 
V2U_BOOL FrmGrab_SetProperty (FrmGrabber *fg, const V2U_Property *prop)
 
V2U_BOOL FrmGrab_SetVGAModes (FrmGrabber *fg, const FrmGrabVgaModes *vgaModes)
 
V2U_BOOL FrmGrab_Start (FrmGrabber *fg)
 
void FrmGrab_Stop (FrmGrabber *fg)
 
int FrmGrabLocal_Count (void)
 
FrmGrabberFrmGrabLocal_Open (void)
 
int FrmGrabLocal_OpenAll (FrmGrabber *grabbers[], int maxcount)
 
FrmGrabberFrmGrabLocal_OpenIndex (int i)
 
FrmGrabberFrmGrabLocal_OpenSN (const char *sn)
 
FrmGrabConnectStatus FrmGrabNet_Auth (FrmGrabber *fg, FrmGrabAuthProc authproc, void *param)
 
FrmGrabConnectStatus FrmGrabNet_Auth2 (FrmGrabber *fg, const char *user, const char *pass)
 
void FrmGrabNet_Deinit (void)
 
V2U_BOOL FrmGrabNet_GetRemoteAddr (FrmGrabber *fg, struct sockaddr_in *addr)
 
V2U_BOOL FrmGrabNet_GetStat (FrmGrabber *fg, FrmGrabNetStat *netstat)
 
void FrmGrabNet_Init (void)
 
V2U_BOOL FrmGrabNet_IsAlive (FrmGrabber *fg)
 
V2U_BOOL FrmGrabNet_IsProtected (FrmGrabber *fg)
 
FrmGrabberFrmGrabNet_Open (void)
 
FrmGrabberFrmGrabNet_OpenAddress (V2U_UINT32 ipaddr, V2U_UINT16 port)
 
FrmGrabberFrmGrabNet_OpenAddress2 (V2U_UINT32 ipaddr, V2U_UINT16 port, FrmGrabAuthProc authproc, void *param, FrmGrabConnectStatus *status)
 
FrmGrabberFrmGrabNet_OpenLocation (const char *location)
 
FrmGrabberFrmGrabNet_OpenSN (const char *sn)
 
V2U_BOOL FrmGrabNet_SetAutoReconnect (FrmGrabber *fg, V2U_BOOL enable)
 

Macro Definition Documentation

◆ FG_PASSWORD_SIZE

#define FG_PASSWORD_SIZE   64

Definition at line 51 of file frmgrab.h.

◆ FG_USERNAME_SIZE

#define FG_USERNAME_SIZE   32

Definition at line 50 of file frmgrab.h.

◆ FrmGrab_IsLocalGrabber

#define FrmGrab_IsLocalGrabber (   fg)
Value:
FrmGrab_IsPciGrabber(fg))
#define FrmGrab_IsUsbGrabber(fg)
Definition: frmgrab.h:164

Definition at line 170 of file frmgrab.h.

◆ FrmGrab_IsNetGrabber

#define FrmGrab_IsNetGrabber (   fg)    ((FrmGrab_GetProductId(fg) & PRODUCT_TYPE_MASK) == PRODUCT_TYPE_NET)

Definition at line 161 of file frmgrab.h.

◆ FrmGrab_IsPciGrabber

#define FrmGrab_IsPciGrabber (   fg)    ((FrmGrab_GetProductId(fg) & PRODUCT_TYPE_MASK) == PRODUCT_TYPE_PCI)

Definition at line 167 of file frmgrab.h.

◆ FrmGrab_IsUsbGrabber

#define FrmGrab_IsUsbGrabber (   fg)    ((FrmGrab_GetProductId(fg) & PRODUCT_TYPE_MASK) == PRODUCT_TYPE_USB)

Definition at line 164 of file frmgrab.h.

◆ PRODUCT_ID_MASK

#define PRODUCT_ID_MASK   0x0000ffff

Definition at line 153 of file frmgrab.h.

◆ PRODUCT_TYPE_FILE

#define PRODUCT_TYPE_FILE   0x00040000 /* Reserved */

Definition at line 158 of file frmgrab.h.

◆ PRODUCT_TYPE_MASK

#define PRODUCT_TYPE_MASK   0x00ff0000

Definition at line 154 of file frmgrab.h.

◆ PRODUCT_TYPE_NET

#define PRODUCT_TYPE_NET   0x00020000 /* Network grabber */

Definition at line 156 of file frmgrab.h.

◆ PRODUCT_TYPE_NETAPP

#define PRODUCT_TYPE_NETAPP   0x00030000 /* Network appliance, not a grabber */

Definition at line 157 of file frmgrab.h.

◆ PRODUCT_TYPE_PCI

#define PRODUCT_TYPE_PCI   0x00050000 /* Local PCI grabber */

Definition at line 159 of file frmgrab.h.

◆ PRODUCT_TYPE_USB

#define PRODUCT_TYPE_USB   0x00010000 /* Local USB grabber */

Definition at line 155 of file frmgrab.h.

Typedef Documentation

◆ FrmGrabAuthProc

typedef V2U_BOOL(* FrmGrabAuthProc) (char *user, char *pass, void *param)

VGA2Ethernet authentication callback. Username buffer pointer is NULL if username is not required. Maximum sizes of username and password are defined below. Non-ASCII username and passwords must be UTF-8 encoded. Note that FG_USERNAME_SIZE and FG_PASSWORD_SIZE define maximum number of bytes (including NULL terminator), not characters. In case of UTF-8 encoding it's not the same thing.

Definition at line 49 of file frmgrab.h.

◆ FrmGrabber

typedef struct _FrmGrabber FrmGrabber

Definition at line 20 of file frmgrab.h.

◆ FrmGrabConnectStatus

Connection status returned by FrmGrabNet_OpenAddress2

◆ FrmGrabMemAlloc

typedef void*(* FrmGrabMemAlloc) (void *param, V2U_UINT32 len)

Memory allocation callbacks

Definition at line 317 of file frmgrab.h.

◆ FrmGrabMemCB

typedef struct _FrmGrabMemCB FrmGrabMemCB

◆ FrmGrabMemFree

typedef void(* FrmGrabMemFree) (void *param, void *ptr)

Definition at line 318 of file frmgrab.h.

◆ FrmGrabNetStat

Network statistics for a network frame grabber. These functions return V2U_FALSE if invoked on a local frame grabber.

◆ FrmGrabVgaModes

VGA mode table can be queried or modified with a bunch of GetProperty or SetProperty calls, but getting and settinng the entire VGA mode table with one call is more efficient, especially for network frame grabbers. Number of custom modes doesn't exceed V2U_CUSTOM_VIDEOMODE_COUNT. The whole FrmGrabVgaModes structure returned by FrmGrab_GetVGAModes is allocated as a single memory block. The caller is responsible for deallocating it with with a single FrmGrab_Free call.

Enumeration Type Documentation

◆ _FrmGrabConnectStatus

Connection status returned by FrmGrabNet_OpenAddress2

Enumerator
FrmGrabConnectOK 
FrmGrabConnectAuthOK 
FrmGrabConnectError 
FrmGrabConnectAuthFail 
FrmGrabConnectAuthCancel 

Definition at line 56 of file frmgrab.h.

Function Documentation

◆ FrmGrab_Close()

void FrmGrab_Close ( FrmGrabber fg)

Closes the frame grabber and invalidates the handle.

◆ FrmGrab_Deinit()

void FrmGrab_Deinit ( void  )

◆ FrmGrab_DetectVideoMode()

V2U_BOOL FrmGrab_DetectVideoMode ( FrmGrabber fg,
V2U_VideoMode vm 
)

Detects current video mode. If no signal is detected, the output V2U_VideoMode structure is zeroed.

◆ FrmGrab_Dup()

FrmGrabber* FrmGrab_Dup ( FrmGrabber fg)

Duplicates handle to the frame grabber. Returns a new independent FrmGrabber instance pointing to the same piece of hardware.

◆ FrmGrab_Frame()

V2U_GrabFrame2* FrmGrab_Frame ( FrmGrabber fg,
V2U_UINT32  format,
const V2URect crop 
)

Grabs one frame. The caller doesn't have to call FrmGrab_Start first, but it's recommended in order to get maximum frame rate.

The second parameter is the capture format, i.e. one of V2U_GRABFRAME_FORMAT_* constants defined in v2u_defs.h

The last parameter is a pointer to the requested crop rectangle. Pass NULL if you need the whole frame.

◆ FrmGrab_Free()

void FrmGrab_Free ( void *  ptr)

Deallocates memory allocated by frmgrab.

◆ FrmGrab_GetCaps()

V2U_UINT32 FrmGrab_GetCaps ( FrmGrabber fg)

Returns device capabilities (V2U_CAPS_* flags defined in v2u_defs.h). Returns zero if an error occurs.

◆ FrmGrab_GetGrabParams()

V2U_BOOL FrmGrab_GetGrabParams ( FrmGrabber fg,
V2U_GrabParameters gp 
)

Queries current VGA capture parameters.

◆ FrmGrab_GetGrabParams2()

V2U_BOOL FrmGrab_GetGrabParams2 ( FrmGrabber fg,
V2U_GrabParameters gp,
V2UAdjRange range 
)

Queries current VGA capture parameters and adjustment ranges in one shot. More efficient for network grabbers. FrmGrab_GetGrabParams2(fg,gp,NULL) is equivalent to FrmGrab_GetGrabParams(fg,gp)

◆ FrmGrab_GetLocation()

const char* FrmGrab_GetLocation ( FrmGrabber fg)

Returns a string that describes the location of the grabber ("USB, "192.168.0.122", etc)

◆ FrmGrab_GetProductId()

int FrmGrab_GetProductId ( FrmGrabber fg)

Returns the unique product id. Includes product type bits OR'ed with type-specific product id.

◆ FrmGrab_GetProductName()

const char* FrmGrab_GetProductName ( FrmGrabber fg)

Returns the product description ("VGA2USB", "VGA2Ethernet", etc)

◆ FrmGrab_GetProperty()

V2U_BOOL FrmGrab_GetProperty ( FrmGrabber fg,
V2U_Property prop 
)

Queries the device property.

◆ FrmGrab_GetSN()

const char* FrmGrab_GetSN ( FrmGrabber fg)

Returns frame grabber's serial number.

◆ FrmGrab_GetVGAModes()

FrmGrabVgaModes* FrmGrab_GetVGAModes ( FrmGrabber fg)

Gets VGA mode table. The returned pointer must be deallocated with FrmGrab_Free()

◆ FrmGrab_GetVideoMode()

void FrmGrab_GetVideoMode ( FrmGrabber fg,
V2U_VideoMode vm 
)

Returns the last known video mode, detecting is if necessary. Unlike FrmGrab_DetectVideoMode, this function doesn't force the video mode detection, but most of the time it's accurate enough. Note that video mode detection is a relatively expensive operation.

◆ FrmGrab_Init()

void FrmGrab_Init ( void  )

Initialize/deinitialize frmgrab library. Both functions may be invoked several times, but there must be FrmGrab_Deinit call per each FrmGrab_Init.

◆ FrmGrab_Open()

FrmGrabber* FrmGrab_Open ( const char *  location)

Generic functions that work with all Frame Grabbers Open frame grabber. The URL-like location parameter can be one of the following:

local:[SERIAL]

Opens a local frame grabber. Optionally, the serial number can be specified.

net:[ADDRESS[:PORT]]

Opens a network frame grabber at the specified address/port. If no address is specified, opens a random network frame grabber.

sn:SERIAL

Opens a local or network frame grabber with the specified serial number. Checks the local frame grabbers first then goes to the network.

id:INDEX

Opens a local frame grabber with the specified index.

◆ FrmGrab_Release()

void FrmGrab_Release ( FrmGrabber fg,
V2U_GrabFrame2 frame 
)

Releases the frame previously returned by FrmGrab_Frame

◆ FrmGrab_SendPS2()

V2U_BOOL FrmGrab_SendPS2 ( FrmGrabber fg,
const V2U_SendPS2 ps2 
)

Sends PS/2 events to the frame grabber (KVM capable products only).

◆ FrmGrab_SetAlloc()

void FrmGrab_SetAlloc ( FrmGrabber fg,
const FrmGrabMemCB memcb,
void *  param 
)

Sets functions for allocating and deallocating memory for the frame buffers. NOTE that these callbacks are ONLY invoked to allocate memory for the frame buffer. For all other allocations, frmgrab library uses its own allocator. The allocator and deallocator callbacks may be invoked in arbitrary thread context, not necessarily the thread that invokes FrmGrab_Frame. The contents of FrmGrabMemCB is copied to internal storage.

◆ FrmGrab_SetGrabParams()

V2U_BOOL FrmGrab_SetGrabParams ( FrmGrabber fg,
const V2U_GrabParameters gp 
)

Sets VGA capture parameters.

◆ FrmGrab_SetMaxFps()

V2U_BOOL FrmGrab_SetMaxFps ( FrmGrabber fg,
double  maxFps 
)

Sets intended frame rate limit (average number of FrmGrab_Frame calls per second). The frame grabber may use this hint to reduce resource usage, especially in low fps case.

◆ FrmGrab_SetProperty()

V2U_BOOL FrmGrab_SetProperty ( FrmGrabber fg,
const V2U_Property prop 
)

Sets the device property.

◆ FrmGrab_SetVGAModes()

V2U_BOOL FrmGrab_SetVGAModes ( FrmGrabber fg,
const FrmGrabVgaModes vgaModes 
)

Sets VGA mode table. Custom modes can be modified, standard modes can only enabled or disabled (VIDEOMODE_TYPE_ENABLED flag).

◆ FrmGrab_Start()

V2U_BOOL FrmGrab_Start ( FrmGrabber fg)

Signals the grabber to prepare for capturing frames with maximum frame rate. While it currently doesn't matter for local grabbers, it's really important for network grabbers (it turns streaming on, otherwise FrmGrab_Frame will have to work on request/response basis, which is much slower). Returns V2U_TRUE if streaming is supported, or V2U_FALSE if this call has no effect.

◆ FrmGrab_Stop()

void FrmGrab_Stop ( FrmGrabber fg)

Signals the grabber to stop capturing frames with maximum frame rate.

◆ FrmGrabLocal_Count()

int FrmGrabLocal_Count ( void  )

◆ FrmGrabLocal_Open()

FrmGrabber* FrmGrabLocal_Open ( void  )

Functions specific to local frame grabbers.

◆ FrmGrabLocal_OpenAll()

int FrmGrabLocal_OpenAll ( FrmGrabber grabbers[],
int  maxcount 
)

◆ FrmGrabLocal_OpenIndex()

FrmGrabber* FrmGrabLocal_OpenIndex ( int  i)

◆ FrmGrabLocal_OpenSN()

FrmGrabber* FrmGrabLocal_OpenSN ( const char *  sn)

◆ FrmGrabNet_Auth()

FrmGrabConnectStatus FrmGrabNet_Auth ( FrmGrabber fg,
FrmGrabAuthProc  authproc,
void *  param 
)

◆ FrmGrabNet_Auth2()

FrmGrabConnectStatus FrmGrabNet_Auth2 ( FrmGrabber fg,
const char *  user,
const char *  pass 
)

Simple non-interactive username/password authentication. VGA2Ethernet grabbers normally don't use usernames for viewer authentication, you should pass NULL as the second parameter.

Available since version 3.26.0.15

◆ FrmGrabNet_Deinit()

void FrmGrabNet_Deinit ( void  )

◆ FrmGrabNet_GetRemoteAddr()

V2U_BOOL FrmGrabNet_GetRemoteAddr ( FrmGrabber fg,
struct sockaddr_in *  addr 
)

◆ FrmGrabNet_GetStat()

V2U_BOOL FrmGrabNet_GetStat ( FrmGrabber fg,
FrmGrabNetStat netstat 
)

◆ FrmGrabNet_Init()

void FrmGrabNet_Init ( void  )

◆ FrmGrabNet_IsAlive()

V2U_BOOL FrmGrabNet_IsAlive ( FrmGrabber fg)

◆ FrmGrabNet_IsProtected()

V2U_BOOL FrmGrabNet_IsProtected ( FrmGrabber fg)

VGA2Ethernet authentication. These functions fail (but don't crash) on local frame grabbers.

◆ FrmGrabNet_Open()

FrmGrabber* FrmGrabNet_Open ( void  )

VGA2Ethernet specific functions. IP address is in the host byte order.

◆ FrmGrabNet_OpenAddress()

FrmGrabber* FrmGrabNet_OpenAddress ( V2U_UINT32  ipaddr,
V2U_UINT16  port 
)

◆ FrmGrabNet_OpenAddress2()

FrmGrabber* FrmGrabNet_OpenAddress2 ( V2U_UINT32  ipaddr,
V2U_UINT16  port,
FrmGrabAuthProc  authproc,
void *  param,
FrmGrabConnectStatus status 
)

◆ FrmGrabNet_OpenLocation()

FrmGrabber* FrmGrabNet_OpenLocation ( const char *  location)

◆ FrmGrabNet_OpenSN()

FrmGrabber* FrmGrabNet_OpenSN ( const char *  sn)

◆ FrmGrabNet_SetAutoReconnect()

V2U_BOOL FrmGrabNet_SetAutoReconnect ( FrmGrabber fg,
V2U_BOOL  enable 
)