9#ifndef C_API_ADDON_BASE_H
10#define C_API_ADDON_BASE_H
32#undef PRAGMA_PACK_BEGIN
36#define ATTR_PACKED __attribute__((packed))
40#if !defined(ATTR_PACKED)
49#define ATTR_FORCEINLINE __forceinline
50#elif defined(__GNUC__)
51#define ATTR_FORCEINLINE inline __attribute__((__always_inline__))
52#elif defined(__CLANG__)
53#if __has_attribute(__always_inline__)
54#define ATTR_FORCEINLINE inline __attribute__((__always_inline__))
56#define ATTR_FORCEINLINE inline
59#define ATTR_FORCEINLINE inline
65#if defined _WIN32 || defined _WIN64 || defined __CYGWIN__
66#define ATTR_DLL_IMPORT __declspec(dllimport)
67#define ATTR_DLL_EXPORT __declspec(dllexport)
70#define ATTR_APIENTRY __stdcall
72#define ATTR_APIENTRY __cdecl
76#define ATTR_DLL_IMPORT __attribute__((visibility("default")))
77#define ATTR_DLL_EXPORT __attribute__((visibility("default")))
79#define ATTR_DLL_LOCAL __attribute__((visibility("hidden")))
84#define ATTR_DLL_IMPORT
85#define ATTR_DLL_EXPORT
92#define ATTR_APIENTRYP ATTR_APIENTRY*
97#if !defined(_SSIZE_T_DEFINED) && !defined(HAVE_SSIZE_T)
98typedef intptr_t ssize_t;
99#define _SSIZE_T_DEFINED
102#define SSIZE_MAX INTPTR_MAX
105#include <sys/types.h>
111#define ADDON_STANDARD_STRING_LENGTH 1024
112#define ADDON_STANDARD_STRING_LENGTH_SMALL 256
119 typedef void* KODI_ADDON_HDL;
120 typedef void* KODI_ADDON_BACKEND_HDL;
121 typedef void* KODI_ADDON_INSTANCE_HDL;
122 typedef void* KODI_ADDON_INSTANCE_BACKEND_HDL;
125 typedef void* ADDON_HARDWARE_CONTEXT;
127 typedef void* KODI_ADDON_FUNC_DUMMY;
159 ADDON_STATUS_NOT_IMPLEMENTED
202 typedef enum ADDON_STATUS(ATTR_APIENTRYP PFN_KODI_ADDON_INSTANCE_SETTING_CHANGE_STRING_V1)(
203 const KODI_ADDON_INSTANCE_HDL hdl,
const char* name,
const char* value);
204 typedef enum ADDON_STATUS(ATTR_APIENTRYP PFN_KODI_ADDON_INSTANCE_SETTING_CHANGE_BOOLEAN_V1)(
205 const KODI_ADDON_INSTANCE_HDL hdl,
const char* name,
bool value);
206 typedef enum ADDON_STATUS(ATTR_APIENTRYP PFN_KODI_ADDON_INSTANCE_SETTING_CHANGE_INTEGER_V1)(
207 const KODI_ADDON_INSTANCE_HDL hdl,
const char* name,
int value);
208 typedef enum ADDON_STATUS(ATTR_APIENTRYP PFN_KODI_ADDON_INSTANCE_SETTING_CHANGE_FLOAT_V1)(
209 const KODI_ADDON_INSTANCE_HDL hdl,
const char* name,
float value);
213 PFN_KODI_ADDON_INSTANCE_SETTING_CHANGE_STRING_V1 instance_setting_change_string;
214 PFN_KODI_ADDON_INSTANCE_SETTING_CHANGE_BOOLEAN_V1 instance_setting_change_boolean;
215 PFN_KODI_ADDON_INSTANCE_SETTING_CHANGE_INTEGER_V1 instance_setting_change_integer;
216 PFN_KODI_ADDON_INSTANCE_SETTING_CHANGE_FLOAT_V1 instance_setting_change_float;
221 char* (*get_instance_user_path)(
const KODI_ADDON_INSTANCE_BACKEND_HDL hdl);
222 bool (*is_instance_setting_using_default)(
const KODI_ADDON_INSTANCE_BACKEND_HDL hdl,
225 bool (*get_instance_setting_bool)(
const KODI_ADDON_INSTANCE_BACKEND_HDL hdl,
228 bool (*get_instance_setting_int)(
const KODI_ADDON_INSTANCE_BACKEND_HDL hdl,
231 bool (*get_instance_setting_float)(
const KODI_ADDON_INSTANCE_BACKEND_HDL hdl,
234 bool (*get_instance_setting_string)(
const KODI_ADDON_INSTANCE_BACKEND_HDL hdl,
238 bool (*set_instance_setting_bool)(
const KODI_ADDON_INSTANCE_BACKEND_HDL hdl,
241 bool (*set_instance_setting_int)(
const KODI_ADDON_INSTANCE_BACKEND_HDL hdl,
244 bool (*set_instance_setting_float)(
const KODI_ADDON_INSTANCE_BACKEND_HDL hdl,
247 bool (*set_instance_setting_string)(
const KODI_ADDON_INSTANCE_BACKEND_HDL hdl,
252 typedef int KODI_ADDON_INSTANCE_TYPE;
256 KODI_ADDON_INSTANCE_TYPE type;
260 KODI_ADDON_INSTANCE_BACKEND_HDL kodi;
261 KODI_ADDON_INSTANCE_HDL parent;
271 KODI_ADDON_INSTANCE_HDL hdl;
275 KODI_ADDON_FUNC_DUMMY dummy;
291 typedef void* KODI_HANDLE;
295 char* (*get_addon_path)(
const KODI_ADDON_BACKEND_HDL hdl);
296 char* (*get_lib_path)(
const KODI_ADDON_BACKEND_HDL hdl);
297 char* (*get_user_path)(
const KODI_ADDON_BACKEND_HDL hdl);
298 char* (*get_temp_path)(
const KODI_ADDON_BACKEND_HDL hdl);
300 char* (*get_localized_string)(
const KODI_ADDON_BACKEND_HDL hdl,
long label_id);
302 bool (*open_settings_dialog)(
const KODI_ADDON_BACKEND_HDL hdl);
303 bool (*is_setting_using_default)(
const KODI_ADDON_BACKEND_HDL hdl,
const char* id);
305 bool (*get_setting_bool)(
const KODI_ADDON_BACKEND_HDL hdl,
const char* id,
bool* value);
306 bool (*get_setting_int)(
const KODI_ADDON_BACKEND_HDL hdl,
const char* id,
int* value);
307 bool (*get_setting_float)(
const KODI_ADDON_BACKEND_HDL hdl,
const char* id,
float* value);
308 bool (*get_setting_string)(
const KODI_ADDON_BACKEND_HDL hdl,
const char* id,
char** value);
310 bool (*set_setting_bool)(
const KODI_ADDON_BACKEND_HDL hdl,
const char* id,
bool value);
311 bool (*set_setting_int)(
const KODI_ADDON_BACKEND_HDL hdl,
const char* id,
int value);
312 bool (*set_setting_float)(
const KODI_ADDON_BACKEND_HDL hdl,
const char* id,
float value);
313 bool (*set_setting_string)(
const KODI_ADDON_BACKEND_HDL hdl,
const char* id,
const char* value);
315 char* (*get_addon_info)(
const KODI_ADDON_BACKEND_HDL hdl,
const char* id);
317 char* (*get_type_version)(
const KODI_ADDON_BACKEND_HDL hdl,
int type);
318 void* (*get_interface)(
const KODI_ADDON_BACKEND_HDL hdl,
const char* name,
const char* version);
329 KODI_ADDON_BACKEND_HDL kodiBase;
331 void (*free_string)(
const KODI_ADDON_BACKEND_HDL hdl,
char* str);
332 void (*free_string_array)(
const KODI_ADDON_BACKEND_HDL hdl,
char** arr,
int numElements);
333 void (*addon_log_msg)(
const KODI_ADDON_BACKEND_HDL hdl,
const int loglevel,
const char* msg);
343 typedef ADDON_STATUS(ATTR_APIENTRYP PFN_KODI_ADDON_CREATE_V1)(
344 const KODI_ADDON_INSTANCE_BACKEND_HDL first_instance, KODI_ADDON_HDL* hdl);
345 typedef void(ATTR_APIENTRYP PFN_KODI_ADDON_DESTROY_V1)(
const KODI_ADDON_HDL hdl);
346 typedef ADDON_STATUS(ATTR_APIENTRYP PFN_KODI_ADDON_CREATE_INSTANCE_V1)(
348 typedef void(ATTR_APIENTRYP PFN_KODI_ADDON_DESTROY_INSTANCE_V1)(
350 typedef enum ADDON_STATUS(ATTR_APIENTRYP PFN_KODI_ADDON_SETTING_CHANGE_STRING_V1)(
351 const KODI_ADDON_HDL hdl,
const char* name,
const char* value);
352 typedef enum ADDON_STATUS(ATTR_APIENTRYP PFN_KODI_ADDON_SETTING_CHANGE_BOOLEAN_V1)(
353 const KODI_ADDON_HDL hdl,
const char* name,
bool value);
354 typedef enum ADDON_STATUS(ATTR_APIENTRYP PFN_KODI_ADDON_SETTING_CHANGE_INTEGER_V1)(
355 const KODI_ADDON_HDL hdl,
const char* name,
int value);
356 typedef enum ADDON_STATUS(ATTR_APIENTRYP PFN_KODI_ADDON_SETTING_CHANGE_FLOAT_V1)(
357 const KODI_ADDON_HDL hdl,
const char* name,
float value);
364 PFN_KODI_ADDON_CREATE_V1 create;
365 PFN_KODI_ADDON_DESTROY_V1 destroy;
366 PFN_KODI_ADDON_CREATE_INSTANCE_V1 create_instance;
367 PFN_KODI_ADDON_DESTROY_INSTANCE_V1 destroy_instance;
368 PFN_KODI_ADDON_SETTING_CHANGE_STRING_V1 setting_change_string;
369 PFN_KODI_ADDON_SETTING_CHANGE_BOOLEAN_V1 setting_change_boolean;
370 PFN_KODI_ADDON_SETTING_CHANGE_INTEGER_V1 setting_change_integer;
371 PFN_KODI_ADDON_SETTING_CHANGE_FLOAT_V1 setting_change_float;
386 KODI_ADDON_HDL addonBase;
390 KODI_ADDON_INSTANCE_HDL globalSingleInstance;
ADDON_LOG
Definition addon_base.h:182
@ ADDON_LOG_FATAL
4 : To notify fatal unrecoverable errors, which can may also indicate upcoming crashes.
Definition addon_base.h:197
@ ADDON_LOG_WARNING
2 : To write warnings in the log file.
Definition addon_base.h:190
@ ADDON_LOG_INFO
1 : To include information messages in the log file.
Definition addon_base.h:187
@ ADDON_LOG_DEBUG
0 : To include debug information in the log file.
Definition addon_base.h:184
@ ADDON_LOG_ERROR
3 : To report error messages in the log file.
Definition addon_base.h:193
ADDON_STATUS
Definition addon_base.h:138
@ ADDON_STATUS_NEED_SETTINGS
Necessary settings are not yet set.
Definition addon_base.h:149
@ ADDON_STATUS_LOST_CONNECTION
A needed connection was lost.
Definition addon_base.h:143
@ ADDON_STATUS_OK
For everything OK and no error.
Definition addon_base.h:140
@ ADDON_STATUS_NEED_RESTART
Addon needs a restart inside Kodi.
Definition addon_base.h:146
@ ADDON_STATUS_UNKNOWN
Unknown and incomprehensible error.
Definition addon_base.h:152
@ ADDON_STATUS_PERMANENT_FAILURE
Permanent failure, like failing to resolve methods.
Definition addon_base.h:155
Main structure passed from kodi to addon with basic information needed to create add-on.
Definition addon_base.h:379
Definition audiodecoder.h:142
Definition audioencoder.h:65
Game instance.
Definition game.h:1279
Definition imagedecoder.h:441
Definition peripheral.h:731
Definition screensaver.h:51
Definition video_codec.h:268
Definition visualization.h:130
Callback function tables from addon to Kodi Set complete from Kodi!
Definition addon_base.h:326
Definition addon_base.h:294
Definition audio_engine.h:267
Definition filesystem.h:255
Definition definitions.h:26
Definition addon_base.h:220
Definition addon_base.h:212
Definition addon_base.h:255
Definition addon_base.h:268
Function tables from Kodi to addon.
Definition addon_base.h:363