Engage Engine API  1.244.9084
Loading...
Searching...
No Matches
EngageLm.h
Go to the documentation of this file.
1
7//
8// Copyright (c) 2019 Rally Tactical Systems, Inc.
9// All rights reserved.
10//
11
12#ifndef EngageLm_h
13#define EngageLm_h
14
15#include <stdint.h>
16
17#ifdef __cplusplus
18extern "C"
19{
20#endif
21
22#if !defined(ENGAGE_LM_API)
23 #if defined(WIN32)
24 #ifdef ENGAGE_LM_EXPORTS
25 #define ENGAGE_LM_API __declspec(dllexport) extern
26 #else
27 #define ENGAGE_LM_API extern
28 #endif
29 #else
30 #define ENGAGE_LM_API __attribute__ ((visibility ("default")))
31 #endif
32#endif
33
34typedef uintptr_t ENGAGE_HANDLE;
35#define NULL_ENGAGE_HANDLE ((uintptr_t)nullptr)
36
37#pragma pack(push, 1)
38 // The V-table passed from the Engine to the loadable module
39 typedef struct _EngineVT_t
40 {
41 // The size of the vtable is like a "version"
42 unsigned int vtSize;
43
44 #ifdef WIN32
45 void (*pfnLogger)(int level, const char *tag, _Printf_format_string_ const char *fmt, ...);
46 #else
47 void (*pfnLogger)(int level, const char *tag, const char *fmt, ...)
48 __attribute__((__format__(__printf__, 3, 4)));
49 #endif
50 } EngineVT_t;
51
52 // The base of loadable module V-tables
53 typedef struct _LmVTBase_t
54 {
55 // The size of the vtable is like a "version"
56 unsigned int vtSize;
57
58 // Module-level
59 int (*initializeModule)(const char *moduleConfiguration);
60 int (*deinitializeModule)();
61 const char *(*getModuleDescriptor)();
62
63 // Instance level
64 ENGAGE_HANDLE (*createInstance)(const char *instanceConfiguration);
65 void (*deleteInstance)(ENGAGE_HANDLE h);
66 const char *(*getInstanceDescriptor)(ENGAGE_HANDLE h);
67
68 void (*startInstance)(ENGAGE_HANDLE h);
69 void (*stopInstance)(ENGAGE_HANDLE h);
70 void (*pauseInstance)(ENGAGE_HANDLE h);
71 void (*resumeInstance)(ENGAGE_HANDLE h);
72 void (*resetInstance)(ENGAGE_HANDLE h);
73 } LmVTBase_t;
74
75 // A V-table for a codec instance
76 typedef struct _LmVTCodec_t
77 {
78 LmVTBase_t base;
79
80 // Encoding
81 void (*setEncoderFramingMs)(ENGAGE_HANDLE h, int ms);
82 void (*feedEncoder)(ENGAGE_HANDLE h, const int16_t *pInput, size_t inputSize, int vadResult);
83 size_t (*extractFromEncoder)(ENGAGE_HANDLE h, uint8_t *pOutput, size_t *pSamplesEncoded);
84
85 // Decoding
86 int (*decodeUsingDecoder)(ENGAGE_HANDLE h, const uint8_t *pInput, size_t inputSize, int16_t *pOutput, size_t maxOutputSize);
88#pragma pack(pop)
89
90// The vtable-exchange function that the module needs to export
91ENGAGE_LM_API int EngageLM_XVT(const EngineVT_t *evt, void *mvt, unsigned int maxMvtSize);
92
93#ifdef __cplusplus
94}
95#endif
96#endif // EngageLm_h