9 #ifndef C_API_ADDON_BASE_H
10 #define C_API_ADDON_BASE_H
12 #if !defined(NOMINMAX)
19 #ifndef TARGET_WINDOWS
30 #undef ATTRIBUTE_PACKED
31 #undef PRAGMA_PACK_BEGIN
32 #undef PRAGMA_PACK_END
35 #define ATTRIBUTE_PACKED __attribute__((packed))
39 #if !defined(ATTRIBUTE_PACKED)
40 #define ATTRIBUTE_PACKED
48 #define ATTRIBUTE_FORCEINLINE __forceinline
49 #elif defined(__GNUC__)
50 #define ATTRIBUTE_FORCEINLINE inline __attribute__((__always_inline__))
51 #elif defined(__CLANG__)
52 #if __has_attribute(__always_inline__)
53 #define ATTRIBUTE_FORCEINLINE inline __attribute__((__always_inline__))
55 #define ATTRIBUTE_FORCEINLINE inline
58 #define ATTRIBUTE_FORCEINLINE inline
64 #if defined _WIN32 || defined __CYGWIN__
65 #define ATTR_DLL_IMPORT __declspec(dllimport)
66 #define ATTR_DLL_EXPORT __declspec(dllexport)
67 #define ATTR_DLL_LOCAL
68 #define ATTR_APIENTRY __stdcall
71 #define ATTR_DLL_IMPORT __attribute__((visibility("default")))
72 #define ATTR_DLL_EXPORT __attribute__((visibility("default")))
73 #define ATTR_DLL_LOCAL __attribute__((visibility("hidden")))
75 #define ATTR_DLL_IMPORT
76 #define ATTR_DLL_EXPORT
77 #define ATTR_DLL_LOCAL
82 #ifndef ATTR_APIENTRYP
83 #define ATTR_APIENTRYP ATTR_APIENTRY*
87 #define ATTRIBUTE_DLL_IMPORT ATTR_DLL_IMPORT
88 #define ATTRIBUTE_DLL_EXPORT ATTR_DLL_EXPORT
89 #define ATTRIBUTE_DLL_LOCAL ATTR_DLL_LOCAL
90 #define ATTRIBUTE_HIDDEN ATTR_DLL_LOCAL
94 #if !defined(_SSIZE_T_DEFINED) && !defined(HAVE_SSIZE_T)
95 typedef intptr_t ssize_t;
96 #define _SSIZE_T_DEFINED
99 #define SSIZE_MAX INTPTR_MAX
102 #include <sys/types.h>
106 #define ADDON_HARDWARE_CONTEXT void*
111 #define ADDON_STANDARD_STRING_LENGTH 1024
112 #define ADDON_STANDARD_STRING_LENGTH_SMALL 256
149 ADDON_STATUS_NOT_IMPLEMENTED
193 typedef void* KODI_HANDLE;
219 KODI_HANDLE kodiBase;
222 char* (*get_type_version)(
void* kodiBase,
int type);
224 void (*free_string)(
void* kodiBase,
char* str);
225 void (*free_string_array)(
void* kodiBase,
char** arr,
int numElements);
226 char* (*get_addon_path)(
void* kodiBase);
227 char* (*get_base_user_path)(
void* kodiBase);
228 void (*addon_log_msg)(
void* kodiBase,
const int loglevel,
const char* msg);
230 bool (*get_setting_bool)(
void* kodiBase,
const char* id,
bool* value);
231 bool (*get_setting_int)(
void* kodiBase,
const char* id,
int* value);
232 bool (*get_setting_float)(
void* kodiBase,
const char* id,
float* value);
233 bool (*get_setting_string)(
void* kodiBase,
const char* id,
char** value);
235 bool (*set_setting_bool)(
void* kodiBase,
const char* id,
bool value);
236 bool (*set_setting_int)(
void* kodiBase,
const char* id,
int value);
237 bool (*set_setting_float)(
void* kodiBase,
const char* id,
float value);
238 bool (*set_setting_string)(
void* kodiBase,
const char* id,
const char* value);
240 void* (*get_interface)(
void* kodiBase,
const char* name,
const char* version);
249 bool (*is_setting_using_default)(
void* kodiBase,
const char* id);
261 const char* instanceID,
262 KODI_HANDLE instance,
264 KODI_HANDLE* addonInstance,
266 void (*destroy_instance)(
int instanceType, KODI_HANDLE instance);
267 ADDON_STATUS (*set_setting)(
const char* settingName,
const void* settingValue);
278 const char* libBasePath;
281 const char* kodi_base_api_version;
285 KODI_HANDLE firstKodiInstance;
289 KODI_HANDLE addonBase;
293 KODI_HANDLE globalSingleInstance;
AddonLog
Definition: addon_base.h:172
@ ADDON_LOG_FATAL
4 : To notify fatal unrecoverable errors, which can may also indicate upcoming crashes.
Definition: addon_base.h:187
@ ADDON_LOG_WARNING
2 : To write warnings in the log file.
Definition: addon_base.h:180
@ ADDON_LOG_INFO
1 : To include information messages in the log file.
Definition: addon_base.h:177
@ ADDON_LOG_DEBUG
0 : To include debug information in the log file.
Definition: addon_base.h:174
@ ADDON_LOG_ERROR
3 : To report error messages in the log file.
Definition: addon_base.h:183
ADDON_STATUS
Definition: addon_base.h:128
@ ADDON_STATUS_NEED_SETTINGS
Necessary settings are not yet set.
Definition: addon_base.h:139
@ ADDON_STATUS_LOST_CONNECTION
A needed connection was lost.
Definition: addon_base.h:133
@ ADDON_STATUS_OK
For everything OK and no error.
Definition: addon_base.h:130
@ ADDON_STATUS_NEED_RESTART
Addon needs a restart inside Kodi.
Definition: addon_base.h:136
@ ADDON_STATUS_UNKNOWN
Unknown and incomprehensible error.
Definition: addon_base.h:142
@ ADDON_STATUS_PERMANENT_FAILURE
Permanent failure, like failing to resolve methods.
Definition: addon_base.h:145
Handle used to return data from the PVR add-on to CPVRClient.
Definition: addon_base.h:199
int dataIdentifier
Definition: addon_base.h:202
void * dataAddress
Definition: addon_base.h:201
void * callerAddress
Definition: addon_base.h:200
Main structure passed from kodi to addon with basic information needed to create add-on.
Definition: addon_base.h:275
Definition: addon_base.h:216
Definition: audio_engine.h:267
Definition: filesystem.h:246
Definition: definitions.h:52
Function tables from Kodi to addon.
Definition: addon_base.h:256