PTLib  Version 2.18.8
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
SignLanguageAnalyser.h
Go to the documentation of this file.
1 /*
2 */
3 
4 #ifndef SL_HEADER
5 #define SL_HEADER
6 
7 
8 #define SL_API_VERSION 2
9 
10 
11 #if defined(_WIN32)
12  #define SL_STDCALL __stdcall
13 #else
14  #define SL_STDCALL
15 #endif
16 
17 #ifndef SL_EXPORT
18  #define SL_EXPORT
19 #endif
20 
21 
22 #ifdef __cplusplus
23 extern "C" {
24 #endif
25 
26  typedef enum SLVideoFormat {
27  SL_GreyScale, /* 8 bits per sample */
28  SL_YUV420P, /* YUV in 420 planar format: all the 8 bit Y samples,
29  followed by half resolution U samples, and then the
30  half resolution V samples. Total size is always
31  width*height*3/2 bytes. */
32  SL_RGB24, /* 24 bits per sample, 8 bits per component, each scan line is
33  rounded to 4 byte boundary. */
34  SL_BGR24, /* 24 bits per sample, 8 bits per component, each scan line is
35  rounded to 4 byte boundary. */
36  SL_RGB32, /* 32 bits per sample, 8 bits per component with the 4th byte
37  unused. */
38  SL_BGR32, /* 32 bits per sample, 8 bits per component with the 4th byte
39  unused. */
40  } SLVideoFormat;
41 
42 
43  /* Initialise the Sign Langauge analyser system.
44  This is called once before any calls to SLAnalyse(). The caller will
45  provide an API version number for backward and forward compatibility.
46  For example, extra fields could be added to this structure and their
47  presence indicated by a new API version number.
48 
49  The library should provide to the caller with the video format required
50  and the maximum number of simultaneous anaysers that can be used.
51 
52  The function return value is zero for success, and a negative number for
53  failure.
54  */
55  typedef struct SLAnalyserInit
56  {
57  unsigned m_apiVersion; // In - API Version
58  SLVideoFormat m_videoFormat; // Out - Format for video
59  unsigned m_maxInstances; // Out - Maximum number of simultanoues instances
61 
63  typedef int(*SLInitialiseFn)(SLAnalyserInit * init);
64 
65  /* Clean up the Sign Language analyser system.
66  This is called whe the user no longer requires the DLL. It will allow the
67  library to clean up any resources it uses.
68 
69  The function return value is zero for success, and a negative number for
70  failure.
71  */
73  typedef int (*SLReleaseFn)();
74 
75 
76  /* Analyse video frame data.
77  This will be called repeatedly as video frames become available. Note, that
78  there is no guarantee that frames arrive at any particular rate, and the
79  resolution can also change at any time. Fields are provided to indicate
80  the current values for those attributes.
81 
82  The pointer m_videoData will point to block of memory that contains the
83  video frame in the format indicated during initialisation. See the
84  SLVideoFormat enum for more details on thee format. Note, that upon return
85  from this function, the memory block may be reused, the library should not
86  access this memory internally via any background threads.
87 
88  The return value is a code for the detected sign, zero for nothing detected,
89  and a negative number for a fatal error. It is expected that, at least for
90  basic signs, the standard ANSI codes are used, e.g. 49 for "1", 50 for "2"
91  etc. Special codes for non-fatal errors such as "Room too dark", "Too far
92  from camera", etc, may also be returned at values > 65536.
93  */
94 
95  typedef struct SLAnalyserData
96  {
97  unsigned m_instance; // In - Index of the analyser instance, value from 0 .. m_maxInstances-1
98  unsigned m_width; // In - Width of video frame
99  unsigned m_height; // In - Height of video frame
100  unsigned m_timestamp; // In - Timestamp in microseconds from some arbitrary starting point
101  const void * m_pixels; // In - Video pixel data
102  } SLAnalyserData;
103 
104  SL_EXPORT int SL_STDCALL SLAnalyse(const SLAnalyserData * data);
105  typedef int (*SLAnalyseFn)(const SLAnalyserData * data);
106 
107 
118  typedef struct SLPreviewData
119  {
120  unsigned m_instance; // In - Index of the analyser instance, value from 0 .. m_maxInstances-1
121  unsigned m_width; // In - Width of video frame returned from SL
122  unsigned m_height; // In - Height of video frame returned from SL
123  void * m_pixels; // In/Out - Video pixel data
124  } SLPreviewData;
125 
126  SL_EXPORT int SL_STDCALL SLPreview(const SLPreviewData * data);
127  typedef int (*SLPreviewFn)(const SLPreviewData * data);
128 
129 
140  typedef struct SLControlData
141  {
142  unsigned m_instance; // In - Index of the analyser instance, value from 0 .. m_maxInstances-1
143  const char * m_control; // In - arbitrary control string
144  } SLControlData;
145 
146  SL_EXPORT int SL_STDCALL SLControl(const SLControlData * ctrl);
147  typedef int (*SLControlFn)(const SLControlData * ctrl);
148 
149 
152  typedef struct SLErrorData
153  {
154  int m_code; // In - Error code as returned in the above functions
155  char m_text[1024]; // Out - Memory block to receive text
156  } SLErrorData;
157 
158  SL_EXPORT void SL_STDCALL SLErrorText(const SLErrorData * data);
159  typedef int (*SLErrorTextFn)(const SLErrorData * data);
160 
161 #ifdef __cplusplus
162 };
163 #endif
164 
165 #endif // SL_HEADAER
166 
const void * m_pixels
Definition: SignLanguageAnalyser.h:101
SL_EXPORT int SL_STDCALL SLRelease()
Definition: SignLanguageAnalyser.h:27
Definition: SignLanguageAnalyser.h:55
int(* SLAnalyseFn)(const SLAnalyserData *data)
Definition: SignLanguageAnalyser.h:105
Definition: SignLanguageAnalyser.h:32
unsigned m_instance
Definition: SignLanguageAnalyser.h:97
SL_EXPORT int SL_STDCALL SLAnalyse(const SLAnalyserData *data)
unsigned m_width
Definition: SignLanguageAnalyser.h:121
int m_code
Definition: SignLanguageAnalyser.h:154
unsigned m_apiVersion
Definition: SignLanguageAnalyser.h:57
Definition: SignLanguageAnalyser.h:95
int(* SLInitialiseFn)(SLAnalyserInit *init)
Definition: SignLanguageAnalyser.h:63
SL_EXPORT void SL_STDCALL SLErrorText(const SLErrorData *data)
SL_EXPORT int SL_STDCALL SLControl(const SLControlData *ctrl)
#define SL_EXPORT
Definition: SignLanguageAnalyser.h:18
void * m_pixels
Definition: SignLanguageAnalyser.h:123
unsigned m_height
Definition: SignLanguageAnalyser.h:99
Return text description for a given error code.
Definition: SignLanguageAnalyser.h:152
Execute control operation.
Definition: SignLanguageAnalyser.h:140
char m_text[1024]
Definition: SignLanguageAnalyser.h:155
Get preview video frame data.
Definition: SignLanguageAnalyser.h:118
unsigned m_maxInstances
Definition: SignLanguageAnalyser.h:59
unsigned m_instance
Definition: SignLanguageAnalyser.h:142
unsigned m_width
Definition: SignLanguageAnalyser.h:98
SLVideoFormat
Definition: SignLanguageAnalyser.h:26
SL_EXPORT int SL_STDCALL SLInitialise(SLAnalyserInit *init)
Definition: SignLanguageAnalyser.h:34
int(* SLReleaseFn)()
Definition: SignLanguageAnalyser.h:73
#define SL_STDCALL
Definition: SignLanguageAnalyser.h:14
Definition: SignLanguageAnalyser.h:28
int(* SLPreviewFn)(const SLPreviewData *data)
Definition: SignLanguageAnalyser.h:127
SL_EXPORT int SL_STDCALL SLPreview(const SLPreviewData *data)
int(* SLControlFn)(const SLControlData *ctrl)
Definition: SignLanguageAnalyser.h:147
int(* SLErrorTextFn)(const SLErrorData *data)
Definition: SignLanguageAnalyser.h:159
unsigned m_instance
Definition: SignLanguageAnalyser.h:120
unsigned m_height
Definition: SignLanguageAnalyser.h:122
Definition: SignLanguageAnalyser.h:38
SLVideoFormat m_videoFormat
Definition: SignLanguageAnalyser.h:58
unsigned m_timestamp
Definition: SignLanguageAnalyser.h:100
Definition: SignLanguageAnalyser.h:36
const char * m_control
Definition: SignLanguageAnalyser.h:143