diff options
Diffstat (limited to 'xbmc/addons')
17 files changed, 262 insertions, 237 deletions
diff --git a/xbmc/addons/addon-bindings.mk b/xbmc/addons/addon-bindings.mk index 71fe609..6bfed36 100644 --- a/xbmc/addons/addon-bindings.mk +++ b/xbmc/addons/addon-bindings.mk | |||
| @@ -1,3 +1,6 @@ | |||
| 1 | # Please also update bindings in ../../project/cmake/scripts/linux/Install.cmake | ||
| 2 | # TODO: Cleanup file after autotools is gone | ||
| 3 | |||
| 1 | BINDINGS =xbmc/addons/kodi-addon-dev-kit/include/kodi/xbmc_addon_cpp_dll.h | 4 | BINDINGS =xbmc/addons/kodi-addon-dev-kit/include/kodi/xbmc_addon_cpp_dll.h |
| 2 | BINDINGS+=xbmc/addons/kodi-addon-dev-kit/include/kodi/xbmc_addon_dll.h | 5 | BINDINGS+=xbmc/addons/kodi-addon-dev-kit/include/kodi/xbmc_addon_dll.h |
| 3 | BINDINGS+=xbmc/addons/kodi-addon-dev-kit/include/kodi/xbmc_addon_types.h | 6 | BINDINGS+=xbmc/addons/kodi-addon-dev-kit/include/kodi/xbmc_addon_types.h |
diff --git a/xbmc/addons/kodi-addon-dev-kit/include/kodi/kodi_inputstream_dll.h b/xbmc/addons/kodi-addon-dev-kit/include/kodi/kodi_inputstream_dll.h index bb9a2d4..3721971 100644 --- a/xbmc/addons/kodi-addon-dev-kit/include/kodi/kodi_inputstream_dll.h +++ b/xbmc/addons/kodi-addon-dev-kit/include/kodi/kodi_inputstream_dll.h | |||
| @@ -82,14 +82,6 @@ extern "C" | |||
| 82 | void EnableStream(int streamid, bool enable); | 82 | void EnableStream(int streamid, bool enable); |
| 83 | 83 | ||
| 84 | /*! | 84 | /*! |
| 85 | * Enables a stream at the given PTS. | ||
| 86 | * @param streamId unique id of stream | ||
| 87 | * @param pts position in stream in microseconds | ||
| 88 | * @remarks will only be called if CAPABILITIES::m_supportsEnableAtPTS is set to true | ||
| 89 | */ | ||
| 90 | void EnableStreamAtPTS(int streamid, uint64_t pts); | ||
| 91 | |||
| 92 | /*! | ||
| 93 | * Reset the demultiplexer in the add-on. | 85 | * Reset the demultiplexer in the add-on. |
| 94 | * @remarks Required if bHandlesDemuxing is set to true. | 86 | * @remarks Required if bHandlesDemuxing is set to true. |
| 95 | */ | 87 | */ |
| @@ -222,6 +214,12 @@ extern "C" | |||
| 222 | */ | 214 | */ |
| 223 | bool IsRealTimeStream(); | 215 | bool IsRealTimeStream(); |
| 224 | 216 | ||
| 217 | const char* GetApiVersion() | ||
| 218 | { | ||
| 219 | static const char *ApiVersion = INPUTSTREAM_API_VERSION; | ||
| 220 | return ApiVersion; | ||
| 221 | } | ||
| 222 | |||
| 225 | /*! | 223 | /*! |
| 226 | * Called by XBMC to assign the function pointers of this add-on to pClient. | 224 | * Called by XBMC to assign the function pointers of this add-on to pClient. |
| 227 | * @param pClient The struct to assign the function pointers to. | 225 | * @param pClient The struct to assign the function pointers to. |
| @@ -232,11 +230,11 @@ extern "C" | |||
| 232 | pClient->Close = Close; | 230 | pClient->Close = Close; |
| 233 | pClient->GetPathList = GetPathList; | 231 | pClient->GetPathList = GetPathList; |
| 234 | pClient->GetCapabilities = GetCapabilities; | 232 | pClient->GetCapabilities = GetCapabilities; |
| 233 | pClient->GetApiVersion = GetApiVersion; | ||
| 235 | 234 | ||
| 236 | pClient->GetStreamIds = GetStreamIds; | 235 | pClient->GetStreamIds = GetStreamIds; |
| 237 | pClient->GetStream = GetStream; | 236 | pClient->GetStream = GetStream; |
| 238 | pClient->EnableStream = EnableStream; | 237 | pClient->EnableStream = EnableStream; |
| 239 | pClient->EnableStreamAtPTS = EnableStreamAtPTS; | ||
| 240 | pClient->DemuxReset = DemuxReset; | 238 | pClient->DemuxReset = DemuxReset; |
| 241 | pClient->DemuxAbort = DemuxAbort; | 239 | pClient->DemuxAbort = DemuxAbort; |
| 242 | pClient->DemuxFlush = DemuxFlush; | 240 | pClient->DemuxFlush = DemuxFlush; |
diff --git a/xbmc/addons/kodi-addon-dev-kit/include/kodi/kodi_inputstream_types.h b/xbmc/addons/kodi-addon-dev-kit/include/kodi/kodi_inputstream_types.h index 3a2e2da..ad47bb5 100644 --- a/xbmc/addons/kodi-addon-dev-kit/include/kodi/kodi_inputstream_types.h +++ b/xbmc/addons/kodi-addon-dev-kit/include/kodi/kodi_inputstream_types.h | |||
| @@ -30,6 +30,9 @@ | |||
| 30 | #include "cores/VideoPlayer/DVDDemuxers/DVDDemuxPacket.h" | 30 | #include "cores/VideoPlayer/DVDDemuxers/DVDDemuxPacket.h" |
| 31 | #endif | 31 | #endif |
| 32 | 32 | ||
| 33 | /* current API version */ | ||
| 34 | #define INPUTSTREAM_API_VERSION "1.0.5" | ||
| 35 | |||
| 33 | extern "C" { | 36 | extern "C" { |
| 34 | 37 | ||
| 35 | // this are properties given to the addon on create | 38 | // this are properties given to the addon on create |
| @@ -49,7 +52,6 @@ extern "C" { | |||
| 49 | bool m_supportsIDisplayTime; /*!< @brief supports interface IDisplayTime */ | 52 | bool m_supportsIDisplayTime; /*!< @brief supports interface IDisplayTime */ |
| 50 | bool m_supportsSeek; /*!< @brief supports seek */ | 53 | bool m_supportsSeek; /*!< @brief supports seek */ |
| 51 | bool m_supportsPause; /*!< @brief supports pause */ | 54 | bool m_supportsPause; /*!< @brief supports pause */ |
| 52 | bool m_supportsEnableAtPTS; /*!< @brief supports enabling streams at a given PTS time */ | ||
| 53 | } INPUTSTREAM_CAPABILITIES; | 55 | } INPUTSTREAM_CAPABILITIES; |
| 54 | 56 | ||
| 55 | /*! | 57 | /*! |
| @@ -128,12 +130,12 @@ extern "C" { | |||
| 128 | void (__cdecl* Close)(void); | 130 | void (__cdecl* Close)(void); |
| 129 | const char* (__cdecl* GetPathList)(void); | 131 | const char* (__cdecl* GetPathList)(void); |
| 130 | struct INPUTSTREAM_CAPABILITIES (__cdecl* GetCapabilities)(void); | 132 | struct INPUTSTREAM_CAPABILITIES (__cdecl* GetCapabilities)(void); |
| 133 | const char* (__cdecl* GetApiVersion)(void); | ||
| 131 | 134 | ||
| 132 | // IDemux | 135 | // IDemux |
| 133 | struct INPUTSTREAM_IDS (__cdecl* GetStreamIds)(); | 136 | struct INPUTSTREAM_IDS (__cdecl* GetStreamIds)(); |
| 134 | struct INPUTSTREAM_INFO (__cdecl* GetStream)(int); | 137 | struct INPUTSTREAM_INFO (__cdecl* GetStream)(int); |
| 135 | void (__cdecl* EnableStream)(int, bool); | 138 | void (__cdecl* EnableStream)(int, bool); |
| 136 | void (__cdecl* EnableStreamAtPTS)(int, uint64_t); | ||
| 137 | void (__cdecl* DemuxReset)(void); | 139 | void (__cdecl* DemuxReset)(void); |
| 138 | void (__cdecl* DemuxAbort)(void); | 140 | void (__cdecl* DemuxAbort)(void); |
| 139 | void (__cdecl* DemuxFlush)(void); | 141 | void (__cdecl* DemuxFlush)(void); |
diff --git a/xbmc/addons/kodi-addon-dev-kit/include/kodi/kodi_peripheral_callbacks.h b/xbmc/addons/kodi-addon-dev-kit/include/kodi/kodi_peripheral_callbacks.h index 720c62f..2dfc571 100644 --- a/xbmc/addons/kodi-addon-dev-kit/include/kodi/kodi_peripheral_callbacks.h +++ b/xbmc/addons/kodi-addon-dev-kit/include/kodi/kodi_peripheral_callbacks.h | |||
| @@ -44,6 +44,16 @@ typedef struct CB_PeripheralLib | |||
| 44 | */ | 44 | */ |
| 45 | void (*RefreshButtonMaps)(void* addonData, const char* deviceName, const char* controllerId); | 45 | void (*RefreshButtonMaps)(void* addonData, const char* deviceName, const char* controllerId); |
| 46 | 46 | ||
| 47 | /*! | ||
| 48 | * @brief Return the number of features belonging to the specified controller | ||
| 49 | * | ||
| 50 | * @param controllerId The controller ID to enumerate | ||
| 51 | * @param type[optional] Type to filter by, or JOYSTICK_FEATURE_TYPE_UNKNOWN for all features | ||
| 52 | * | ||
| 53 | * @return The number of features matching the request parameters | ||
| 54 | */ | ||
| 55 | unsigned int (*FeatureCount)(void* addonData, const char* controllerId, JOYSTICK_FEATURE_TYPE type); | ||
| 56 | |||
| 47 | } CB_PeripheralLib; | 57 | } CB_PeripheralLib; |
| 48 | 58 | ||
| 49 | #ifdef __cplusplus | 59 | #ifdef __cplusplus |
diff --git a/xbmc/addons/kodi-addon-dev-kit/include/kodi/kodi_peripheral_dll.h b/xbmc/addons/kodi-addon-dev-kit/include/kodi/kodi_peripheral_dll.h index 591afcc..f9d7482 100644 --- a/xbmc/addons/kodi-addon-dev-kit/include/kodi/kodi_peripheral_dll.h +++ b/xbmc/addons/kodi-addon-dev-kit/include/kodi/kodi_peripheral_dll.h | |||
| @@ -22,7 +22,7 @@ | |||
| 22 | 22 | ||
| 23 | #include "kodi_peripheral_types.h" | 23 | #include "kodi_peripheral_types.h" |
| 24 | 24 | ||
| 25 | #define PERIPHERAL_ADDON_JOYSTICKS // TODO | 25 | #define PERIPHERAL_ADDON_JOYSTICKS //! @todo |
| 26 | 26 | ||
| 27 | #ifdef __cplusplus | 27 | #ifdef __cplusplus |
| 28 | extern "C" | 28 | extern "C" |
| @@ -100,6 +100,14 @@ extern "C" | |||
| 100 | * @param events The array of allocated events | 100 | * @param events The array of allocated events |
| 101 | */ | 101 | */ |
| 102 | void FreeEvents(unsigned int event_count, PERIPHERAL_EVENT* events); | 102 | void FreeEvents(unsigned int event_count, PERIPHERAL_EVENT* events); |
| 103 | |||
| 104 | /*! | ||
| 105 | * @brief Send an input event to the specified peripheral | ||
| 106 | * @param peripheralIndex The index of the device receiving the input event | ||
| 107 | * @param event The input event | ||
| 108 | * @return true if the event was handled, false otherwise | ||
| 109 | */ | ||
| 110 | bool SendEvent(const PERIPHERAL_EVENT* event); | ||
| 103 | ///} | 111 | ///} |
| 104 | 112 | ||
| 105 | /// @name Joystick operations | 113 | /// @name Joystick operations |
| @@ -150,12 +158,57 @@ extern "C" | |||
| 150 | * @brief Add or update joystick features | 158 | * @brief Add or update joystick features |
| 151 | * @param joystick The device's joystick properties; unknown values may be left at their default | 159 | * @param joystick The device's joystick properties; unknown values may be left at their default |
| 152 | * @param controller_id The game controller profile being updated | 160 | * @param controller_id The game controller profile being updated |
| 153 | * @param feature_count The number of features int the features array | 161 | * @param feature_count The number of features in the features array |
| 154 | * @param features The array of features | 162 | * @param features The array of features |
| 155 | * @return PERIPHERAL_NO_ERROR if successful | 163 | * @return PERIPHERAL_NO_ERROR if successful |
| 156 | */ | 164 | */ |
| 157 | PERIPHERAL_ERROR MapFeatures(const JOYSTICK_INFO* joystick, const char* controller_id, | 165 | PERIPHERAL_ERROR MapFeatures(const JOYSTICK_INFO* joystick, const char* controller_id, |
| 158 | unsigned int feature_count, JOYSTICK_FEATURE* features); | 166 | unsigned int feature_count, const JOYSTICK_FEATURE* features); |
| 167 | |||
| 168 | /*! | ||
| 169 | * @brief Get the driver primitives that should be ignored while mapping the device | ||
| 170 | * @param joystick The device's joystick properties; unknown values may be left at their default | ||
| 171 | * @param primitive_count The number of features allocated for the primitives array | ||
| 172 | * @param primitives The array of allocated driver primitives to be ignored | ||
| 173 | * @return PERIPHERAL_NO_ERROR if successful; array must be freed using | ||
| 174 | * FreePrimitives() in this case | ||
| 175 | */ | ||
| 176 | PERIPHERAL_ERROR GetIgnoredPrimitives(const JOYSTICK_INFO* joystick, | ||
| 177 | unsigned int* primitive_count, | ||
| 178 | JOYSTICK_DRIVER_PRIMITIVE** primitives); | ||
| 179 | |||
| 180 | /*! | ||
| 181 | * @brief Free the memory allocated in GetIgnoredPrimitives() | ||
| 182 | * | ||
| 183 | * Must be called if GetIgnoredPrimitives() returns PERIPHERAL_NO_ERROR. | ||
| 184 | * | ||
| 185 | * @param primitive_count The number of driver primitives allocated for the primitives array | ||
| 186 | * @param primitives The array of allocated driver primitives | ||
| 187 | */ | ||
| 188 | void FreePrimitives(unsigned int primitive_count, JOYSTICK_DRIVER_PRIMITIVE* primitives); | ||
| 189 | |||
| 190 | /*! | ||
| 191 | * @brief Set the list of driver primitives that are ignored for the device | ||
| 192 | * @param joystick The device's joystick properties; unknown values may be left at their default | ||
| 193 | * @param primitive_count The number of driver features in the primitives array | ||
| 194 | * @param primitives The array of driver primitives to ignore | ||
| 195 | * @return PERIPHERAL_NO_ERROR if successful | ||
| 196 | */ | ||
| 197 | PERIPHERAL_ERROR SetIgnoredPrimitives(const JOYSTICK_INFO* joystick, | ||
| 198 | unsigned int primitive_count, | ||
| 199 | const JOYSTICK_DRIVER_PRIMITIVE* primitives); | ||
| 200 | |||
| 201 | /*! | ||
| 202 | * @brief Save the button map for the given joystick | ||
| 203 | * @param joystick The device's joystick properties | ||
| 204 | */ | ||
| 205 | void SaveButtonMap(const JOYSTICK_INFO* joystick); | ||
| 206 | |||
| 207 | /*! | ||
| 208 | * @brief Revert the button map to the last time it was loaded or committed to disk | ||
| 209 | * @param joystick The device's joystick properties | ||
| 210 | */ | ||
| 211 | void RevertButtonMap(const JOYSTICK_INFO* joystick); | ||
| 159 | 212 | ||
| 160 | /*! | 213 | /*! |
| 161 | * @brief Reset the button map for the given joystick and controller profile ID | 214 | * @brief Reset the button map for the given joystick and controller profile ID |
| @@ -163,6 +216,12 @@ extern "C" | |||
| 163 | * @param controller_id The game controller profile being reset | 216 | * @param controller_id The game controller profile being reset |
| 164 | */ | 217 | */ |
| 165 | void ResetButtonMap(const JOYSTICK_INFO* joystick, const char* controller_id); | 218 | void ResetButtonMap(const JOYSTICK_INFO* joystick, const char* controller_id); |
| 219 | |||
| 220 | /*! | ||
| 221 | * @brief Powers off the given joystick if supported | ||
| 222 | * @param index The joystick's driver index | ||
| 223 | */ | ||
| 224 | void PowerOffJoystick(unsigned int index); | ||
| 166 | #endif | 225 | #endif |
| 167 | ///} | 226 | ///} |
| 168 | 227 | ||
| @@ -180,6 +239,7 @@ extern "C" | |||
| 180 | pClient->FreeScanResults = FreeScanResults; | 239 | pClient->FreeScanResults = FreeScanResults; |
| 181 | pClient->GetEvents = GetEvents; | 240 | pClient->GetEvents = GetEvents; |
| 182 | pClient->FreeEvents = FreeEvents; | 241 | pClient->FreeEvents = FreeEvents; |
| 242 | pClient->SendEvent = SendEvent; | ||
| 183 | 243 | ||
| 184 | #ifdef PERIPHERAL_ADDON_JOYSTICKS | 244 | #ifdef PERIPHERAL_ADDON_JOYSTICKS |
| 185 | pClient->GetJoystickInfo = GetJoystickInfo; | 245 | pClient->GetJoystickInfo = GetJoystickInfo; |
| @@ -187,7 +247,13 @@ extern "C" | |||
| 187 | pClient->GetFeatures = GetFeatures; | 247 | pClient->GetFeatures = GetFeatures; |
| 188 | pClient->FreeFeatures = FreeFeatures; | 248 | pClient->FreeFeatures = FreeFeatures; |
| 189 | pClient->MapFeatures = MapFeatures; | 249 | pClient->MapFeatures = MapFeatures; |
| 250 | pClient->GetIgnoredPrimitives = GetIgnoredPrimitives; | ||
| 251 | pClient->FreePrimitives = FreePrimitives; | ||
| 252 | pClient->SetIgnoredPrimitives = SetIgnoredPrimitives; | ||
| 253 | pClient->SaveButtonMap = SaveButtonMap; | ||
| 254 | pClient->RevertButtonMap = RevertButtonMap; | ||
| 190 | pClient->ResetButtonMap = ResetButtonMap; | 255 | pClient->ResetButtonMap = ResetButtonMap; |
| 256 | pClient->PowerOffJoystick = PowerOffJoystick; | ||
| 191 | #endif | 257 | #endif |
| 192 | } | 258 | } |
| 193 | 259 | ||
diff --git a/xbmc/addons/kodi-addon-dev-kit/include/kodi/kodi_peripheral_types.h b/xbmc/addons/kodi-addon-dev-kit/include/kodi/kodi_peripheral_types.h index 85e2363..2df5622 100644 --- a/xbmc/addons/kodi-addon-dev-kit/include/kodi/kodi_peripheral_types.h +++ b/xbmc/addons/kodi-addon-dev-kit/include/kodi/kodi_peripheral_types.h | |||
| @@ -1,3 +1,4 @@ | |||
| 1 | |||
| 1 | /* | 2 | /* |
| 2 | * Copyright (C) 2014-2016 Team Kodi | 3 | * Copyright (C) 2014-2016 Team Kodi |
| 3 | * http://kodi.tv | 4 | * http://kodi.tv |
| @@ -50,10 +51,10 @@ | |||
| 50 | #endif | 51 | #endif |
| 51 | 52 | ||
| 52 | /* current Peripheral API version */ | 53 | /* current Peripheral API version */ |
| 53 | #define PERIPHERAL_API_VERSION "1.0.17" | 54 | #define PERIPHERAL_API_VERSION "1.2.0" |
| 54 | 55 | ||
| 55 | /* min. Peripheral API version */ | 56 | /* min. Peripheral API version */ |
| 56 | #define PERIPHERAL_MIN_API_VERSION "1.0.16" | 57 | #define PERIPHERAL_MIN_API_VERSION "1.2.0" |
| 57 | 58 | ||
| 58 | /* indicates a joystick has no preference for port number */ | 59 | /* indicates a joystick has no preference for port number */ |
| 59 | #define NO_PORT_REQUESTED (-1) | 60 | #define NO_PORT_REQUESTED (-1) |
| @@ -111,6 +112,7 @@ extern "C" | |||
| 111 | typedef struct PERIPHERAL_CAPABILITIES | 112 | typedef struct PERIPHERAL_CAPABILITIES |
| 112 | { | 113 | { |
| 113 | bool provides_joysticks; /*!< @brief true if the add-on provides joysticks */ | 114 | bool provides_joysticks; /*!< @brief true if the add-on provides joysticks */ |
| 115 | bool provides_buttonmaps; /*!< @brief true if the add-on provides button maps */ | ||
| 114 | } ATTRIBUTE_PACKED PERIPHERAL_CAPABILITIES; | 116 | } ATTRIBUTE_PACKED PERIPHERAL_CAPABILITIES; |
| 115 | ///} | 117 | ///} |
| 116 | 118 | ||
| @@ -122,6 +124,7 @@ extern "C" | |||
| 122 | PERIPHERAL_EVENT_TYPE_DRIVER_BUTTON, /*!< @brief state changed for joystick driver button */ | 124 | PERIPHERAL_EVENT_TYPE_DRIVER_BUTTON, /*!< @brief state changed for joystick driver button */ |
| 123 | PERIPHERAL_EVENT_TYPE_DRIVER_HAT, /*!< @brief state changed for joystick driver hat */ | 125 | PERIPHERAL_EVENT_TYPE_DRIVER_HAT, /*!< @brief state changed for joystick driver hat */ |
| 124 | PERIPHERAL_EVENT_TYPE_DRIVER_AXIS, /*!< @brief state changed for joystick driver axis */ | 126 | PERIPHERAL_EVENT_TYPE_DRIVER_AXIS, /*!< @brief state changed for joystick driver axis */ |
| 127 | PERIPHERAL_EVENT_TYPE_SET_MOTOR, /*!< @brief set the state for joystick rumble motor */ | ||
| 125 | } PERIPHERAL_EVENT_TYPE; | 128 | } PERIPHERAL_EVENT_TYPE; |
| 126 | 129 | ||
| 127 | typedef enum JOYSTICK_STATE_BUTTON | 130 | typedef enum JOYSTICK_STATE_BUTTON |
| @@ -152,6 +155,8 @@ extern "C" | |||
| 152 | */ | 155 | */ |
| 153 | typedef float JOYSTICK_STATE_AXIS; | 156 | typedef float JOYSTICK_STATE_AXIS; |
| 154 | 157 | ||
| 158 | typedef float JOYSTICK_STATE_MOTOR; | ||
| 159 | |||
| 155 | typedef struct PERIPHERAL_EVENT | 160 | typedef struct PERIPHERAL_EVENT |
| 156 | { | 161 | { |
| 157 | unsigned int peripheral_index; | 162 | unsigned int peripheral_index; |
| @@ -160,6 +165,7 @@ extern "C" | |||
| 160 | JOYSTICK_STATE_BUTTON driver_button_state; | 165 | JOYSTICK_STATE_BUTTON driver_button_state; |
| 161 | JOYSTICK_STATE_HAT driver_hat_state; | 166 | JOYSTICK_STATE_HAT driver_hat_state; |
| 162 | JOYSTICK_STATE_AXIS driver_axis_state; | 167 | JOYSTICK_STATE_AXIS driver_axis_state; |
| 168 | JOYSTICK_STATE_MOTOR motor_state; | ||
| 163 | } ATTRIBUTE_PACKED PERIPHERAL_EVENT; | 169 | } ATTRIBUTE_PACKED PERIPHERAL_EVENT; |
| 164 | ///} | 170 | ///} |
| 165 | 171 | ||
| @@ -173,6 +179,8 @@ extern "C" | |||
| 173 | unsigned int button_count; /*!< @brief number of buttons reported by the driver */ | 179 | unsigned int button_count; /*!< @brief number of buttons reported by the driver */ |
| 174 | unsigned int hat_count; /*!< @brief number of hats reported by the driver */ | 180 | unsigned int hat_count; /*!< @brief number of hats reported by the driver */ |
| 175 | unsigned int axis_count; /*!< @brief number of axes reported by the driver */ | 181 | unsigned int axis_count; /*!< @brief number of axes reported by the driver */ |
| 182 | unsigned int motor_count; /*!< @brief number of motors reported by the driver */ | ||
| 183 | bool supports_poweroff; /*!< @brief whether the joystick supports being powered off */ | ||
| 176 | } ATTRIBUTE_PACKED JOYSTICK_INFO; | 184 | } ATTRIBUTE_PACKED JOYSTICK_INFO; |
| 177 | 185 | ||
| 178 | typedef enum JOYSTICK_DRIVER_PRIMITIVE_TYPE | 186 | typedef enum JOYSTICK_DRIVER_PRIMITIVE_TYPE |
| @@ -181,6 +189,7 @@ extern "C" | |||
| 181 | JOYSTICK_DRIVER_PRIMITIVE_TYPE_BUTTON, | 189 | JOYSTICK_DRIVER_PRIMITIVE_TYPE_BUTTON, |
| 182 | JOYSTICK_DRIVER_PRIMITIVE_TYPE_HAT_DIRECTION, | 190 | JOYSTICK_DRIVER_PRIMITIVE_TYPE_HAT_DIRECTION, |
| 183 | JOYSTICK_DRIVER_PRIMITIVE_TYPE_SEMIAXIS, | 191 | JOYSTICK_DRIVER_PRIMITIVE_TYPE_SEMIAXIS, |
| 192 | JOYSTICK_DRIVER_PRIMITIVE_TYPE_MOTOR, | ||
| 184 | } JOYSTICK_DRIVER_PRIMITIVE_TYPE; | 193 | } JOYSTICK_DRIVER_PRIMITIVE_TYPE; |
| 185 | 194 | ||
| 186 | typedef struct JOYSTICK_DRIVER_BUTTON | 195 | typedef struct JOYSTICK_DRIVER_BUTTON |
| @@ -216,6 +225,11 @@ extern "C" | |||
| 216 | JOYSTICK_DRIVER_SEMIAXIS_DIRECTION direction; | 225 | JOYSTICK_DRIVER_SEMIAXIS_DIRECTION direction; |
| 217 | } ATTRIBUTE_PACKED JOYSTICK_DRIVER_SEMIAXIS; | 226 | } ATTRIBUTE_PACKED JOYSTICK_DRIVER_SEMIAXIS; |
| 218 | 227 | ||
| 228 | typedef struct JOYSTICK_DRIVER_MOTOR | ||
| 229 | { | ||
| 230 | int index; | ||
| 231 | } ATTRIBUTE_PACKED JOYSTICK_DRIVER_MOTOR; | ||
| 232 | |||
| 219 | typedef struct JOYSTICK_DRIVER_PRIMITIVE | 233 | typedef struct JOYSTICK_DRIVER_PRIMITIVE |
| 220 | { | 234 | { |
| 221 | JOYSTICK_DRIVER_PRIMITIVE_TYPE type; | 235 | JOYSTICK_DRIVER_PRIMITIVE_TYPE type; |
| @@ -224,6 +238,7 @@ extern "C" | |||
| 224 | struct JOYSTICK_DRIVER_BUTTON button; | 238 | struct JOYSTICK_DRIVER_BUTTON button; |
| 225 | struct JOYSTICK_DRIVER_HAT hat; | 239 | struct JOYSTICK_DRIVER_HAT hat; |
| 226 | struct JOYSTICK_DRIVER_SEMIAXIS semiaxis; | 240 | struct JOYSTICK_DRIVER_SEMIAXIS semiaxis; |
| 241 | struct JOYSTICK_DRIVER_MOTOR motor; | ||
| 227 | }; | 242 | }; |
| 228 | } ATTRIBUTE_PACKED JOYSTICK_DRIVER_PRIMITIVE; | 243 | } ATTRIBUTE_PACKED JOYSTICK_DRIVER_PRIMITIVE; |
| 229 | 244 | ||
| @@ -233,42 +248,41 @@ extern "C" | |||
| 233 | JOYSTICK_FEATURE_TYPE_SCALAR, | 248 | JOYSTICK_FEATURE_TYPE_SCALAR, |
| 234 | JOYSTICK_FEATURE_TYPE_ANALOG_STICK, | 249 | JOYSTICK_FEATURE_TYPE_ANALOG_STICK, |
| 235 | JOYSTICK_FEATURE_TYPE_ACCELEROMETER, | 250 | JOYSTICK_FEATURE_TYPE_ACCELEROMETER, |
| 251 | JOYSTICK_FEATURE_TYPE_MOTOR, | ||
| 236 | } JOYSTICK_FEATURE_TYPE; | 252 | } JOYSTICK_FEATURE_TYPE; |
| 237 | 253 | ||
| 238 | typedef struct JOYSTICK_FEATURE_SCALAR | 254 | typedef enum JOYSTICK_FEATURE_PRIMITIVE |
| 239 | { | 255 | { |
| 240 | struct JOYSTICK_DRIVER_PRIMITIVE primitive; | 256 | // Scalar feature |
| 241 | } ATTRIBUTE_PACKED JOYSTICK_FEATURE_SCALAR; | 257 | JOYSTICK_SCALAR_PRIMITIVE = 0, |
| 242 | 258 | ||
| 243 | typedef struct JOYSTICK_FEATURE_ANALOG_STICK | 259 | // Analog stick |
| 244 | { | 260 | JOYSTICK_ANALOG_STICK_UP = 0, |
| 245 | struct JOYSTICK_DRIVER_PRIMITIVE up; | 261 | JOYSTICK_ANALOG_STICK_DOWN = 1, |
| 246 | struct JOYSTICK_DRIVER_PRIMITIVE down; | 262 | JOYSTICK_ANALOG_STICK_RIGHT = 2, |
| 247 | struct JOYSTICK_DRIVER_PRIMITIVE right; | 263 | JOYSTICK_ANALOG_STICK_LEFT = 3, |
| 248 | struct JOYSTICK_DRIVER_PRIMITIVE left; | ||
| 249 | } ATTRIBUTE_PACKED JOYSTICK_FEATURE_ANALOG_STICK; | ||
| 250 | 264 | ||
| 251 | typedef struct JOYSTICK_FEATURE_ACCELEROMETER | 265 | // Accelerometer |
| 252 | { | 266 | JOYSTICK_ACCELEROMETER_POSITIVE_X = 0, |
| 253 | struct JOYSTICK_DRIVER_PRIMITIVE positive_x; | 267 | JOYSTICK_ACCELEROMETER_POSITIVE_Y = 1, |
| 254 | struct JOYSTICK_DRIVER_PRIMITIVE positive_y; | 268 | JOYSTICK_ACCELEROMETER_POSITIVE_Z = 2, |
| 255 | struct JOYSTICK_DRIVER_PRIMITIVE positive_z; | 269 | |
| 256 | } ATTRIBUTE_PACKED JOYSTICK_FEATURE_ACCELEROMETER; | 270 | // Motor |
| 271 | JOYSTICK_MOTOR_PRIMITIVE = 0, | ||
| 272 | |||
| 273 | // Maximum number of primitives | ||
| 274 | JOYSTICK_PRIMITIVE_MAX = 4, | ||
| 275 | } JOYSTICK_FEATURE_PRIMITIVE; | ||
| 257 | 276 | ||
| 258 | typedef struct JOYSTICK_FEATURE | 277 | typedef struct JOYSTICK_FEATURE |
| 259 | { | 278 | { |
| 260 | char* name; | 279 | char* name; |
| 261 | JOYSTICK_FEATURE_TYPE type; | 280 | JOYSTICK_FEATURE_TYPE type; |
| 262 | union | 281 | struct JOYSTICK_DRIVER_PRIMITIVE primitives[JOYSTICK_PRIMITIVE_MAX]; |
| 263 | { | ||
| 264 | struct JOYSTICK_FEATURE_SCALAR scalar; | ||
| 265 | struct JOYSTICK_FEATURE_ANALOG_STICK analog_stick; | ||
| 266 | struct JOYSTICK_FEATURE_ACCELEROMETER accelerometer; | ||
| 267 | }; | ||
| 268 | } ATTRIBUTE_PACKED JOYSTICK_FEATURE; | 282 | } ATTRIBUTE_PACKED JOYSTICK_FEATURE; |
| 269 | ///} | 283 | ///} |
| 270 | 284 | ||
| 271 | // TODO: Mouse, light gun, multitouch | 285 | //! @todo Mouse, light gun, multitouch |
| 272 | 286 | ||
| 273 | /*! | 287 | /*! |
| 274 | * @brief Structure to transfer the methods from kodi_peripheral_dll.h to the frontend | 288 | * @brief Structure to transfer the methods from kodi_peripheral_dll.h to the frontend |
| @@ -282,6 +296,7 @@ extern "C" | |||
| 282 | void (__cdecl* FreeScanResults)(unsigned int, PERIPHERAL_INFO*); | 296 | void (__cdecl* FreeScanResults)(unsigned int, PERIPHERAL_INFO*); |
| 283 | PERIPHERAL_ERROR (__cdecl* GetEvents)(unsigned int*, PERIPHERAL_EVENT**); | 297 | PERIPHERAL_ERROR (__cdecl* GetEvents)(unsigned int*, PERIPHERAL_EVENT**); |
| 284 | void (__cdecl* FreeEvents)(unsigned int, PERIPHERAL_EVENT*); | 298 | void (__cdecl* FreeEvents)(unsigned int, PERIPHERAL_EVENT*); |
| 299 | bool (__cdecl* SendEvent)(const PERIPHERAL_EVENT*); | ||
| 285 | 300 | ||
| 286 | /// @name Joystick operations | 301 | /// @name Joystick operations |
| 287 | ///{ | 302 | ///{ |
| @@ -289,8 +304,14 @@ extern "C" | |||
| 289 | void (__cdecl* FreeJoystickInfo)(JOYSTICK_INFO*); | 304 | void (__cdecl* FreeJoystickInfo)(JOYSTICK_INFO*); |
| 290 | PERIPHERAL_ERROR (__cdecl* GetFeatures)(const JOYSTICK_INFO*, const char*, unsigned int*, JOYSTICK_FEATURE**); | 305 | PERIPHERAL_ERROR (__cdecl* GetFeatures)(const JOYSTICK_INFO*, const char*, unsigned int*, JOYSTICK_FEATURE**); |
| 291 | void (__cdecl* FreeFeatures)(unsigned int, JOYSTICK_FEATURE*); | 306 | void (__cdecl* FreeFeatures)(unsigned int, JOYSTICK_FEATURE*); |
| 292 | PERIPHERAL_ERROR (__cdecl* MapFeatures)(const JOYSTICK_INFO*, const char*, unsigned int, JOYSTICK_FEATURE*); | 307 | PERIPHERAL_ERROR (__cdecl* MapFeatures)(const JOYSTICK_INFO*, const char*, unsigned int, const JOYSTICK_FEATURE*); |
| 308 | PERIPHERAL_ERROR (__cdecl* GetIgnoredPrimitives)(const JOYSTICK_INFO*, unsigned int*, JOYSTICK_DRIVER_PRIMITIVE**); | ||
| 309 | void (__cdecl* FreePrimitives)(unsigned int, JOYSTICK_DRIVER_PRIMITIVE*); | ||
| 310 | PERIPHERAL_ERROR (__cdecl* SetIgnoredPrimitives)(const JOYSTICK_INFO*, unsigned int, const JOYSTICK_DRIVER_PRIMITIVE*); | ||
| 311 | void (__cdecl* SaveButtonMap)(const JOYSTICK_INFO*); | ||
| 312 | void (__cdecl* RevertButtonMap)(const JOYSTICK_INFO*); | ||
| 293 | void (__cdecl* ResetButtonMap)(const JOYSTICK_INFO*, const char*); | 313 | void (__cdecl* ResetButtonMap)(const JOYSTICK_INFO*, const char*); |
| 314 | void (__cdecl* PowerOffJoystick)(unsigned int); | ||
| 294 | ///} | 315 | ///} |
| 295 | } PeripheralAddon; | 316 | } PeripheralAddon; |
| 296 | 317 | ||
diff --git a/xbmc/addons/kodi-addon-dev-kit/include/kodi/kodi_peripheral_utils.hpp b/xbmc/addons/kodi-addon-dev-kit/include/kodi/kodi_peripheral_utils.hpp index 4423cb4..f01180b 100644 --- a/xbmc/addons/kodi-addon-dev-kit/include/kodi/kodi_peripheral_utils.hpp +++ b/xbmc/addons/kodi-addon-dev-kit/include/kodi/kodi_peripheral_utils.hpp | |||
| @@ -21,6 +21,7 @@ | |||
| 21 | 21 | ||
| 22 | #include "kodi_peripheral_types.h" | 22 | #include "kodi_peripheral_types.h" |
| 23 | 23 | ||
| 24 | #include <array> // Requires c++11 | ||
| 24 | #include <cstring> | 25 | #include <cstring> |
| 25 | #include <map> | 26 | #include <map> |
| 26 | #include <string> | 27 | #include <string> |
| @@ -204,6 +205,7 @@ namespace ADDON | |||
| 204 | JOYSTICK_STATE_BUTTON ButtonState(void) const { return m_event.driver_button_state; } | 205 | JOYSTICK_STATE_BUTTON ButtonState(void) const { return m_event.driver_button_state; } |
| 205 | JOYSTICK_STATE_HAT HatState(void) const { return m_event.driver_hat_state; } | 206 | JOYSTICK_STATE_HAT HatState(void) const { return m_event.driver_hat_state; } |
| 206 | JOYSTICK_STATE_AXIS AxisState(void) const { return m_event.driver_axis_state; } | 207 | JOYSTICK_STATE_AXIS AxisState(void) const { return m_event.driver_axis_state; } |
| 208 | JOYSTICK_STATE_MOTOR MotorState(void) const { return m_event.motor_state; } | ||
| 207 | 209 | ||
| 208 | void SetType(PERIPHERAL_EVENT_TYPE type) { m_event.type = type; } | 210 | void SetType(PERIPHERAL_EVENT_TYPE type) { m_event.type = type; } |
| 209 | void SetPeripheralIndex(unsigned int index) { m_event.peripheral_index = index; } | 211 | void SetPeripheralIndex(unsigned int index) { m_event.peripheral_index = index; } |
| @@ -211,6 +213,7 @@ namespace ADDON | |||
| 211 | void SetButtonState(JOYSTICK_STATE_BUTTON state) { m_event.driver_button_state = state; } | 213 | void SetButtonState(JOYSTICK_STATE_BUTTON state) { m_event.driver_button_state = state; } |
| 212 | void SetHatState(JOYSTICK_STATE_HAT state) { m_event.driver_hat_state = state; } | 214 | void SetHatState(JOYSTICK_STATE_HAT state) { m_event.driver_hat_state = state; } |
| 213 | void SetAxisState(JOYSTICK_STATE_AXIS state) { m_event.driver_axis_state = state; } | 215 | void SetAxisState(JOYSTICK_STATE_AXIS state) { m_event.driver_axis_state = state; } |
| 216 | void SetMotorState(JOYSTICK_STATE_MOTOR state) { m_event.motor_state = state; } | ||
| 214 | 217 | ||
| 215 | void ToStruct(PERIPHERAL_EVENT& event) const | 218 | void ToStruct(PERIPHERAL_EVENT& event) const |
| 216 | { | 219 | { |
| @@ -243,7 +246,9 @@ namespace ADDON | |||
| 243 | m_requestedPort(NO_PORT_REQUESTED), | 246 | m_requestedPort(NO_PORT_REQUESTED), |
| 244 | m_buttonCount(0), | 247 | m_buttonCount(0), |
| 245 | m_hatCount(0), | 248 | m_hatCount(0), |
| 246 | m_axisCount(0) | 249 | m_axisCount(0), |
| 250 | m_motorCount(0), | ||
| 251 | m_supportsPowerOff(false) | ||
| 247 | { | 252 | { |
| 248 | } | 253 | } |
| 249 | 254 | ||
| @@ -258,7 +263,9 @@ namespace ADDON | |||
| 258 | m_requestedPort(info.requested_port), | 263 | m_requestedPort(info.requested_port), |
| 259 | m_buttonCount(info.button_count), | 264 | m_buttonCount(info.button_count), |
| 260 | m_hatCount(info.hat_count), | 265 | m_hatCount(info.hat_count), |
| 261 | m_axisCount(info.axis_count) | 266 | m_axisCount(info.axis_count), |
| 267 | m_motorCount(info.motor_count), | ||
| 268 | m_supportsPowerOff(info.supports_poweroff) | ||
| 262 | { | 269 | { |
| 263 | } | 270 | } |
| 264 | 271 | ||
| @@ -275,6 +282,8 @@ namespace ADDON | |||
| 275 | m_buttonCount = rhs.m_buttonCount; | 282 | m_buttonCount = rhs.m_buttonCount; |
| 276 | m_hatCount = rhs.m_hatCount; | 283 | m_hatCount = rhs.m_hatCount; |
| 277 | m_axisCount = rhs.m_axisCount; | 284 | m_axisCount = rhs.m_axisCount; |
| 285 | m_motorCount = rhs.m_motorCount; | ||
| 286 | m_supportsPowerOff = rhs.m_supportsPowerOff; | ||
| 278 | } | 287 | } |
| 279 | return *this; | 288 | return *this; |
| 280 | } | 289 | } |
| @@ -284,6 +293,8 @@ namespace ADDON | |||
| 284 | unsigned int ButtonCount(void) const { return m_buttonCount; } | 293 | unsigned int ButtonCount(void) const { return m_buttonCount; } |
| 285 | unsigned int HatCount(void) const { return m_hatCount; } | 294 | unsigned int HatCount(void) const { return m_hatCount; } |
| 286 | unsigned int AxisCount(void) const { return m_axisCount; } | 295 | unsigned int AxisCount(void) const { return m_axisCount; } |
| 296 | unsigned int MotorCount(void) const { return m_motorCount; } | ||
| 297 | bool SupportsPowerOff(void) const { return m_supportsPowerOff; } | ||
| 287 | 298 | ||
| 288 | // Derived property: Counts are unknown if all are zero | 299 | // Derived property: Counts are unknown if all are zero |
| 289 | bool AreElementCountsKnown(void) const { return m_buttonCount != 0 || m_hatCount != 0 || m_axisCount != 0; } | 300 | bool AreElementCountsKnown(void) const { return m_buttonCount != 0 || m_hatCount != 0 || m_axisCount != 0; } |
| @@ -293,6 +304,8 @@ namespace ADDON | |||
| 293 | void SetButtonCount(unsigned int buttonCount) { m_buttonCount = buttonCount; } | 304 | void SetButtonCount(unsigned int buttonCount) { m_buttonCount = buttonCount; } |
| 294 | void SetHatCount(unsigned int hatCount) { m_hatCount = hatCount; } | 305 | void SetHatCount(unsigned int hatCount) { m_hatCount = hatCount; } |
| 295 | void SetAxisCount(unsigned int axisCount) { m_axisCount = axisCount; } | 306 | void SetAxisCount(unsigned int axisCount) { m_axisCount = axisCount; } |
| 307 | void SetMotorCount(unsigned int motorCount) { m_motorCount = motorCount; } | ||
| 308 | void SetSupportsPowerOff(bool supportsPowerOff) { m_supportsPowerOff = supportsPowerOff; } | ||
| 296 | 309 | ||
| 297 | void ToStruct(JOYSTICK_INFO& info) const | 310 | void ToStruct(JOYSTICK_INFO& info) const |
| 298 | { | 311 | { |
| @@ -303,6 +316,8 @@ namespace ADDON | |||
| 303 | info.button_count = m_buttonCount; | 316 | info.button_count = m_buttonCount; |
| 304 | info.hat_count = m_hatCount; | 317 | info.hat_count = m_hatCount; |
| 305 | info.axis_count = m_axisCount; | 318 | info.axis_count = m_axisCount; |
| 319 | info.motor_count = m_motorCount; | ||
| 320 | info.supports_poweroff = m_supportsPowerOff; | ||
| 306 | 321 | ||
| 307 | std::strcpy(info.provider, m_provider.c_str()); | 322 | std::strcpy(info.provider, m_provider.c_str()); |
| 308 | } | 323 | } |
| @@ -320,6 +335,8 @@ namespace ADDON | |||
| 320 | unsigned int m_buttonCount; | 335 | unsigned int m_buttonCount; |
| 321 | unsigned int m_hatCount; | 336 | unsigned int m_hatCount; |
| 322 | unsigned int m_axisCount; | 337 | unsigned int m_axisCount; |
| 338 | unsigned int m_motorCount; | ||
| 339 | bool m_supportsPowerOff; | ||
| 323 | }; | 340 | }; |
| 324 | 341 | ||
| 325 | typedef PeripheralVector<Joystick, JOYSTICK_INFO> Joysticks; | 342 | typedef PeripheralVector<Joystick, JOYSTICK_INFO> Joysticks; |
| @@ -332,6 +349,7 @@ namespace ADDON | |||
| 332 | * 1) a button | 349 | * 1) a button |
| 333 | * 2) a hat direction | 350 | * 2) a hat direction |
| 334 | * 3) a semiaxis (either the positive or negative half of an axis) | 351 | * 3) a semiaxis (either the positive or negative half of an axis) |
| 352 | * 4) a motor | ||
| 335 | * | 353 | * |
| 336 | * The type determines the fields in use: | 354 | * The type determines the fields in use: |
| 337 | * | 355 | * |
| @@ -345,9 +363,24 @@ namespace ADDON | |||
| 345 | * Semiaxis: | 363 | * Semiaxis: |
| 346 | * - driver index | 364 | * - driver index |
| 347 | * - semiaxis direction | 365 | * - semiaxis direction |
| 366 | * | ||
| 367 | * Motor: | ||
| 368 | * - driver index | ||
| 348 | */ | 369 | */ |
| 349 | class DriverPrimitive | 370 | struct DriverPrimitive |
| 350 | { | 371 | { |
| 372 | protected: | ||
| 373 | /*! | ||
| 374 | * \brief Construct a driver primitive of the specified type | ||
| 375 | */ | ||
| 376 | DriverPrimitive(JOYSTICK_DRIVER_PRIMITIVE_TYPE type, unsigned int driverIndex) : | ||
| 377 | m_type(type), | ||
| 378 | m_driverIndex(driverIndex), | ||
| 379 | m_hatDirection(JOYSTICK_DRIVER_HAT_UNKNOWN), | ||
| 380 | m_semiAxisDirection(JOYSTICK_DRIVER_SEMIAXIS_UNKNOWN) | ||
| 381 | { | ||
| 382 | } | ||
| 383 | |||
| 351 | public: | 384 | public: |
| 352 | /*! | 385 | /*! |
| 353 | * \brief Construct an invalid driver primitive | 386 | * \brief Construct an invalid driver primitive |
| @@ -363,12 +396,9 @@ namespace ADDON | |||
| 363 | /*! | 396 | /*! |
| 364 | * \brief Construct a driver primitive representing a button | 397 | * \brief Construct a driver primitive representing a button |
| 365 | */ | 398 | */ |
| 366 | DriverPrimitive(unsigned int buttonIndex) : | 399 | static DriverPrimitive CreateButton(unsigned int buttonIndex) |
| 367 | m_type(JOYSTICK_DRIVER_PRIMITIVE_TYPE_BUTTON), | ||
| 368 | m_driverIndex(buttonIndex), | ||
| 369 | m_hatDirection(JOYSTICK_DRIVER_HAT_UNKNOWN), | ||
| 370 | m_semiAxisDirection(JOYSTICK_DRIVER_SEMIAXIS_UNKNOWN) | ||
| 371 | { | 400 | { |
| 401 | return DriverPrimitive(JOYSTICK_DRIVER_PRIMITIVE_TYPE_BUTTON, buttonIndex); | ||
| 372 | } | 402 | } |
| 373 | 403 | ||
| 374 | /*! | 404 | /*! |
| @@ -395,6 +425,14 @@ namespace ADDON | |||
| 395 | { | 425 | { |
| 396 | } | 426 | } |
| 397 | 427 | ||
| 428 | /*! | ||
| 429 | * \brief Construct a driver primitive representing a motor | ||
| 430 | */ | ||
| 431 | static DriverPrimitive CreateMotor(unsigned int motorIndex) | ||
| 432 | { | ||
| 433 | return DriverPrimitive(JOYSTICK_DRIVER_PRIMITIVE_TYPE_MOTOR, motorIndex); | ||
| 434 | } | ||
| 435 | |||
| 398 | DriverPrimitive(const JOYSTICK_DRIVER_PRIMITIVE& primitive) : | 436 | DriverPrimitive(const JOYSTICK_DRIVER_PRIMITIVE& primitive) : |
| 399 | m_type(primitive.type), | 437 | m_type(primitive.type), |
| 400 | m_driverIndex(0), | 438 | m_driverIndex(0), |
| @@ -420,6 +458,11 @@ namespace ADDON | |||
| 420 | m_semiAxisDirection = primitive.semiaxis.direction; | 458 | m_semiAxisDirection = primitive.semiaxis.direction; |
| 421 | break; | 459 | break; |
| 422 | } | 460 | } |
| 461 | case JOYSTICK_DRIVER_PRIMITIVE_TYPE_MOTOR: | ||
| 462 | { | ||
| 463 | m_driverIndex = primitive.motor.index; | ||
| 464 | break; | ||
| 465 | } | ||
| 423 | default: | 466 | default: |
| 424 | break; | 467 | break; |
| 425 | } | 468 | } |
| @@ -437,6 +480,7 @@ namespace ADDON | |||
| 437 | switch (m_type) | 480 | switch (m_type) |
| 438 | { | 481 | { |
| 439 | case JOYSTICK_DRIVER_PRIMITIVE_TYPE_BUTTON: | 482 | case JOYSTICK_DRIVER_PRIMITIVE_TYPE_BUTTON: |
| 483 | case JOYSTICK_DRIVER_PRIMITIVE_TYPE_MOTOR: | ||
| 440 | { | 484 | { |
| 441 | return m_driverIndex == other.m_driverIndex; | 485 | return m_driverIndex == other.m_driverIndex; |
| 442 | } | 486 | } |
| @@ -479,11 +523,21 @@ namespace ADDON | |||
| 479 | driver_primitive.semiaxis.direction = m_semiAxisDirection; | 523 | driver_primitive.semiaxis.direction = m_semiAxisDirection; |
| 480 | break; | 524 | break; |
| 481 | } | 525 | } |
| 526 | case JOYSTICK_DRIVER_PRIMITIVE_TYPE_MOTOR: | ||
| 527 | { | ||
| 528 | driver_primitive.motor.index = m_driverIndex; | ||
| 529 | break; | ||
| 530 | } | ||
| 482 | default: | 531 | default: |
| 483 | break; | 532 | break; |
| 484 | } | 533 | } |
| 485 | } | 534 | } |
| 486 | 535 | ||
| 536 | static void FreeStruct(JOYSTICK_DRIVER_PRIMITIVE& primitive) | ||
| 537 | { | ||
| 538 | (void)primitive; | ||
| 539 | } | ||
| 540 | |||
| 487 | private: | 541 | private: |
| 488 | JOYSTICK_DRIVER_PRIMITIVE_TYPE m_type; | 542 | JOYSTICK_DRIVER_PRIMITIVE_TYPE m_type; |
| 489 | unsigned int m_driverIndex; | 543 | unsigned int m_driverIndex; |
| @@ -491,6 +545,8 @@ namespace ADDON | |||
| 491 | JOYSTICK_DRIVER_SEMIAXIS_DIRECTION m_semiAxisDirection; | 545 | JOYSTICK_DRIVER_SEMIAXIS_DIRECTION m_semiAxisDirection; |
| 492 | }; | 546 | }; |
| 493 | 547 | ||
| 548 | typedef PeripheralVector<DriverPrimitive, JOYSTICK_DRIVER_PRIMITIVE> DriverPrimitives; | ||
| 549 | |||
| 494 | /*! | 550 | /*! |
| 495 | * ADDON::JoystickFeature | 551 | * ADDON::JoystickFeature |
| 496 | * | 552 | * |
| @@ -499,44 +555,20 @@ namespace ADDON | |||
| 499 | * 1) scalar[1] | 555 | * 1) scalar[1] |
| 500 | * 2) analog stick | 556 | * 2) analog stick |
| 501 | * 3) accelerometer | 557 | * 3) accelerometer |
| 558 | * 4) motor | ||
| 502 | * | 559 | * |
| 503 | * [1] All three driver primitives (buttons, hats and axes) have a state that | 560 | * [1] All three driver primitives (buttons, hats and axes) have a state that |
| 504 | * can be represented using a single scalar value. For this reason, | 561 | * can be represented using a single scalar value. For this reason, |
| 505 | * features that map to a single primitive are called "scalar features". | 562 | * features that map to a single primitive are called "scalar features". |
| 506 | * | ||
| 507 | * Features can be mapped to a variable number of driver primitives. The names | ||
| 508 | * of the primitives for each feature are: | ||
| 509 | * | ||
| 510 | * Scalar feature: | ||
| 511 | * - primitive | ||
| 512 | * | ||
| 513 | * Analog stick: | ||
| 514 | * - up | ||
| 515 | * - down | ||
| 516 | * - right | ||
| 517 | * - left | ||
| 518 | * | ||
| 519 | * Accelerometer: | ||
| 520 | * - positive X | ||
| 521 | * - positive Y | ||
| 522 | * - positive Z | ||
| 523 | */ | 563 | */ |
| 524 | class JoystickFeature | 564 | class JoystickFeature |
| 525 | { | 565 | { |
| 526 | public: | 566 | public: |
| 527 | const unsigned int MAX_PRIMITIVES = 4; | 567 | JoystickFeature(const std::string& name = "", JOYSTICK_FEATURE_TYPE type = JOYSTICK_FEATURE_TYPE_UNKNOWN) : |
| 528 | |||
| 529 | JoystickFeature(void) : | ||
| 530 | m_type(JOYSTICK_FEATURE_TYPE_UNKNOWN) | ||
| 531 | { | ||
| 532 | m_primitives.resize(MAX_PRIMITIVES); | ||
| 533 | } | ||
| 534 | |||
| 535 | JoystickFeature(const std::string& name, JOYSTICK_FEATURE_TYPE type) : | ||
| 536 | m_name(name), | 568 | m_name(name), |
| 537 | m_type(type) | 569 | m_type(type), |
| 570 | m_primitives() | ||
| 538 | { | 571 | { |
| 539 | m_primitives.resize(MAX_PRIMITIVES); | ||
| 540 | } | 572 | } |
| 541 | 573 | ||
| 542 | JoystickFeature(const JoystickFeature& other) | 574 | JoystickFeature(const JoystickFeature& other) |
| @@ -548,26 +580,8 @@ namespace ADDON | |||
| 548 | m_name(feature.name ? feature.name : ""), | 580 | m_name(feature.name ? feature.name : ""), |
| 549 | m_type(feature.type) | 581 | m_type(feature.type) |
| 550 | { | 582 | { |
| 551 | m_primitives.resize(MAX_PRIMITIVES); | 583 | for (unsigned int i = 0; i < JOYSTICK_PRIMITIVE_MAX; i++) |
| 552 | switch (m_type) | 584 | m_primitives[i] = feature.primitives[i]; |
| 553 | { | ||
| 554 | case JOYSTICK_FEATURE_TYPE_SCALAR: | ||
| 555 | SetPrimitive(feature.scalar.primitive); | ||
| 556 | break; | ||
| 557 | case JOYSTICK_FEATURE_TYPE_ANALOG_STICK: | ||
| 558 | SetUp(feature.analog_stick.up); | ||
| 559 | SetDown(feature.analog_stick.down); | ||
| 560 | SetRight(feature.analog_stick.right); | ||
| 561 | SetLeft(feature.analog_stick.left); | ||
| 562 | break; | ||
| 563 | case JOYSTICK_FEATURE_TYPE_ACCELEROMETER: | ||
| 564 | SetPositiveX(feature.accelerometer.positive_x); | ||
| 565 | SetPositiveY(feature.accelerometer.positive_y); | ||
| 566 | SetPositiveZ(feature.accelerometer.positive_z); | ||
| 567 | break; | ||
| 568 | default: | ||
| 569 | break; | ||
| 570 | } | ||
| 571 | } | 585 | } |
| 572 | 586 | ||
| 573 | JoystickFeature& operator=(const JoystickFeature& rhs) | 587 | JoystickFeature& operator=(const JoystickFeature& rhs) |
| @@ -590,55 +604,25 @@ namespace ADDON | |||
| 590 | 604 | ||
| 591 | const std::string& Name(void) const { return m_name; } | 605 | const std::string& Name(void) const { return m_name; } |
| 592 | JOYSTICK_FEATURE_TYPE Type(void) const { return m_type; } | 606 | JOYSTICK_FEATURE_TYPE Type(void) const { return m_type; } |
| 607 | bool IsValid() const { return m_type != JOYSTICK_FEATURE_TYPE_UNKNOWN; } | ||
| 593 | 608 | ||
| 594 | void SetName(const std::string& name) { m_name = name; } | 609 | void SetName(const std::string& name) { m_name = name; } |
| 595 | void SetType(JOYSTICK_FEATURE_TYPE type) { m_type = type; } | 610 | void SetType(JOYSTICK_FEATURE_TYPE type) { m_type = type; } |
| 611 | void SetInvalid(void) { m_type = JOYSTICK_FEATURE_TYPE_UNKNOWN; } | ||
| 612 | |||
| 613 | const DriverPrimitive& Primitive(JOYSTICK_FEATURE_PRIMITIVE which) const { return m_primitives[which]; } | ||
| 614 | void SetPrimitive(JOYSTICK_FEATURE_PRIMITIVE which, const DriverPrimitive& primitive) { m_primitives[which] = primitive; } | ||
| 596 | 615 | ||
| 597 | // Scalar methods | 616 | std::array<DriverPrimitive, JOYSTICK_PRIMITIVE_MAX>& Primitives() { return m_primitives; } |
| 598 | const DriverPrimitive& Primitive(void) const { return m_primitives[0]; } | 617 | const std::array<DriverPrimitive, JOYSTICK_PRIMITIVE_MAX>& Primitives() const { return m_primitives; } |
| 599 | void SetPrimitive(const DriverPrimitive& primitive) { m_primitives[0] = primitive; } | ||
| 600 | |||
| 601 | // Analog stick methods | ||
| 602 | const DriverPrimitive& Up(void) const { return m_primitives[0]; } | ||
| 603 | const DriverPrimitive& Down(void) const { return m_primitives[1]; } | ||
| 604 | const DriverPrimitive& Right(void) const { return m_primitives[2]; } | ||
| 605 | const DriverPrimitive& Left(void) const { return m_primitives[3]; } | ||
| 606 | void SetUp(const DriverPrimitive& primitive) { m_primitives[0] = primitive; } | ||
| 607 | void SetDown(const DriverPrimitive& primitive) { m_primitives[1] = primitive; } | ||
| 608 | void SetRight(const DriverPrimitive& primitive) { m_primitives[2] = primitive; } | ||
| 609 | void SetLeft(const DriverPrimitive& primitive) { m_primitives[3] = primitive; } | ||
| 610 | |||
| 611 | // Accelerometer methods | ||
| 612 | const DriverPrimitive& PositiveX(void) const { return m_primitives[0]; } | ||
| 613 | const DriverPrimitive& PositiveY(void) const { return m_primitives[1]; } | ||
| 614 | const DriverPrimitive& PositiveZ(void) const { return m_primitives[2]; } | ||
| 615 | void SetPositiveX(const DriverPrimitive& primitive) { m_primitives[0] = primitive; } | ||
| 616 | void SetPositiveY(const DriverPrimitive& primitive) { m_primitives[1] = primitive; } | ||
| 617 | void SetPositiveZ(const DriverPrimitive& primitive) { m_primitives[2] = primitive; } | ||
| 618 | 618 | ||
| 619 | void ToStruct(JOYSTICK_FEATURE& feature) const | 619 | void ToStruct(JOYSTICK_FEATURE& feature) const |
| 620 | { | 620 | { |
| 621 | feature.name = new char[m_name.length() + 1]; | 621 | feature.name = new char[m_name.length() + 1]; |
| 622 | feature.type = m_type; | 622 | feature.type = m_type; |
| 623 | switch (m_type) | 623 | for (unsigned int i = 0; i < JOYSTICK_PRIMITIVE_MAX; i++) |
| 624 | { | 624 | m_primitives[i].ToStruct(feature.primitives[i]); |
| 625 | case JOYSTICK_FEATURE_TYPE_SCALAR: | 625 | |
| 626 | Primitive().ToStruct(feature.scalar.primitive); | ||
| 627 | break; | ||
| 628 | case JOYSTICK_FEATURE_TYPE_ANALOG_STICK: | ||
| 629 | Up().ToStruct(feature.analog_stick.up); | ||
| 630 | Down().ToStruct(feature.analog_stick.down); | ||
| 631 | Right().ToStruct(feature.analog_stick.right); | ||
| 632 | Left().ToStruct(feature.analog_stick.left); | ||
| 633 | break; | ||
| 634 | case JOYSTICK_FEATURE_TYPE_ACCELEROMETER: | ||
| 635 | PositiveX().ToStruct(feature.accelerometer.positive_x); | ||
| 636 | PositiveY().ToStruct(feature.accelerometer.positive_y); | ||
| 637 | PositiveZ().ToStruct(feature.accelerometer.positive_z); | ||
| 638 | break; | ||
| 639 | default: | ||
| 640 | break; | ||
| 641 | } | ||
| 642 | std::strcpy(feature.name, m_name.c_str()); | 626 | std::strcpy(feature.name, m_name.c_str()); |
| 643 | } | 627 | } |
| 644 | 628 | ||
| @@ -650,7 +634,7 @@ namespace ADDON | |||
| 650 | private: | 634 | private: |
| 651 | std::string m_name; | 635 | std::string m_name; |
| 652 | JOYSTICK_FEATURE_TYPE m_type; | 636 | JOYSTICK_FEATURE_TYPE m_type; |
| 653 | std::vector<DriverPrimitive> m_primitives; | 637 | std::array<DriverPrimitive, JOYSTICK_PRIMITIVE_MAX> m_primitives; |
| 654 | }; | 638 | }; |
| 655 | 639 | ||
| 656 | typedef PeripheralVector<JoystickFeature, JOYSTICK_FEATURE> JoystickFeatures; | 640 | typedef PeripheralVector<JoystickFeature, JOYSTICK_FEATURE> JoystickFeatures; |
diff --git a/xbmc/addons/kodi-addon-dev-kit/include/kodi/libKODI_adsp.h b/xbmc/addons/kodi-addon-dev-kit/include/kodi/libKODI_adsp.h index 46e34a6..fb0c15f 100644 --- a/xbmc/addons/kodi-addon-dev-kit/include/kodi/libKODI_adsp.h +++ b/xbmc/addons/kodi-addon-dev-kit/include/kodi/libKODI_adsp.h | |||
| @@ -29,12 +29,8 @@ | |||
| 29 | 29 | ||
| 30 | typedef void* ADSPHANDLE; | 30 | typedef void* ADSPHANDLE; |
| 31 | 31 | ||
| 32 | #ifdef _WIN32 | 32 | #define ADSP_HELPER_DLL KODI_DLL("adsp") |
| 33 | #define ADSP_HELPER_DLL "\\library.kodi.adsp\\libKODI_adsp" ADDON_HELPER_EXT | 33 | #define ADSP_HELPER_DLL_NAME KODI_DLL_NAME("adsp") |
| 34 | #else | ||
| 35 | #define ADSP_HELPER_DLL_NAME "libKODI_adsp-" ADDON_HELPER_ARCH ADDON_HELPER_EXT | ||
| 36 | #define ADSP_HELPER_DLL "/library.kodi.adsp/" ADSP_HELPER_DLL_NAME | ||
| 37 | #endif | ||
| 38 | 34 | ||
| 39 | class CAddonSoundPlay; | 35 | class CAddonSoundPlay; |
| 40 | 36 | ||
| @@ -69,15 +65,6 @@ public: | |||
| 69 | libBasePath = ((cb_array*)m_Handle)->libPath; | 65 | libBasePath = ((cb_array*)m_Handle)->libPath; |
| 70 | libBasePath += ADSP_HELPER_DLL; | 66 | libBasePath += ADSP_HELPER_DLL; |
| 71 | 67 | ||
| 72 | #if defined(ANDROID) | ||
| 73 | struct stat st; | ||
| 74 | if(stat(libBasePath.c_str(),&st) != 0) | ||
| 75 | { | ||
| 76 | std::string tempbin = getenv("XBMC_ANDROID_LIBS"); | ||
| 77 | libBasePath = tempbin + "/" + ADSP_HELPER_DLL_NAME; | ||
| 78 | } | ||
| 79 | #endif | ||
| 80 | |||
| 81 | m_libKODI_adsp = dlopen(libBasePath.c_str(), RTLD_LAZY); | 68 | m_libKODI_adsp = dlopen(libBasePath.c_str(), RTLD_LAZY); |
| 82 | if (m_libKODI_adsp == NULL) | 69 | if (m_libKODI_adsp == NULL) |
| 83 | { | 70 | { |
diff --git a/xbmc/addons/kodi-addon-dev-kit/include/kodi/libKODI_audioengine.h b/xbmc/addons/kodi-addon-dev-kit/include/kodi/libKODI_audioengine.h index be3b93d..7dbf7af 100644 --- a/xbmc/addons/kodi-addon-dev-kit/include/kodi/libKODI_audioengine.h +++ b/xbmc/addons/kodi-addon-dev-kit/include/kodi/libKODI_audioengine.h | |||
| @@ -38,12 +38,8 @@ | |||
| 38 | 38 | ||
| 39 | #include "libXBMC_addon.h" | 39 | #include "libXBMC_addon.h" |
| 40 | 40 | ||
| 41 | #ifdef _WIN32 | 41 | #define AUDIOENGINE_HELPER_DLL KODI_DLL("audioengine") |
| 42 | #define AUDIOENGINE_HELPER_DLL "\\library.kodi.audioengine\\libKODI_audioengine" ADDON_HELPER_EXT | 42 | #define AUDIOENGINE_HELPER_DLL_NAME KODI_DLL_NAME("audioengine") |
| 43 | #else | ||
| 44 | #define AUDIOENGINE_HELPER_DLL_NAME "libKODI_audioengine-" ADDON_HELPER_ARCH ADDON_HELPER_EXT | ||
| 45 | #define AUDIOENGINE_HELPER_DLL "/library.kodi.audioengine/" AUDIOENGINE_HELPER_DLL_NAME | ||
| 46 | #endif | ||
| 47 | 43 | ||
| 48 | class CAddonAEStream; | 44 | class CAddonAEStream; |
| 49 | 45 | ||
| @@ -78,15 +74,6 @@ public: | |||
| 78 | libBasePath = ((cb_array*)m_Handle)->libPath; | 74 | libBasePath = ((cb_array*)m_Handle)->libPath; |
| 79 | libBasePath += AUDIOENGINE_HELPER_DLL; | 75 | libBasePath += AUDIOENGINE_HELPER_DLL; |
| 80 | 76 | ||
| 81 | #if defined(ANDROID) | ||
| 82 | struct stat st; | ||
| 83 | if(stat(libBasePath.c_str(),&st) != 0) | ||
| 84 | { | ||
| 85 | std::string tempbin = getenv("XBMC_ANDROID_LIBS"); | ||
| 86 | libBasePath = tempbin + "/" + AUDIOENGINE_HELPER_DLL; | ||
| 87 | } | ||
| 88 | #endif | ||
| 89 | |||
| 90 | m_libKODI_audioengine = dlopen(libBasePath.c_str(), RTLD_LAZY); | 77 | m_libKODI_audioengine = dlopen(libBasePath.c_str(), RTLD_LAZY); |
| 91 | if (m_libKODI_audioengine == NULL) | 78 | if (m_libKODI_audioengine == NULL) |
| 92 | { | 79 | { |
| @@ -207,8 +194,8 @@ public: | |||
| 207 | virtual bool IsBuffering(); | 194 | virtual bool IsBuffering(); |
| 208 | 195 | ||
| 209 | /** | 196 | /** |
| 210 | * Returns the time in seconds that it will take | 197 | * Returns the time in seconds of the stream's |
| 211 | * to underrun the cache if no sample is added. | 198 | * cached audio samples. Engine buffers excluded. |
| 212 | * @return seconds | 199 | * @return seconds |
| 213 | */ | 200 | */ |
| 214 | virtual double GetCacheTime(); | 201 | virtual double GetCacheTime(); |
diff --git a/xbmc/addons/kodi-addon-dev-kit/include/kodi/libKODI_guilib.h b/xbmc/addons/kodi-addon-dev-kit/include/kodi/libKODI_guilib.h index bdaeb4c..3fe12c9 100644 --- a/xbmc/addons/kodi-addon-dev-kit/include/kodi/libKODI_guilib.h +++ b/xbmc/addons/kodi-addon-dev-kit/include/kodi/libKODI_guilib.h | |||
| @@ -28,12 +28,8 @@ | |||
| 28 | 28 | ||
| 29 | typedef void* GUIHANDLE; | 29 | typedef void* GUIHANDLE; |
| 30 | 30 | ||
| 31 | #ifdef _WIN32 | 31 | #define GUI_HELPER_DLL KODI_DLL("guilib") |
| 32 | #define GUI_HELPER_DLL "\\library.kodi.guilib\\libKODI_guilib" ADDON_HELPER_EXT | 32 | #define GUI_HELPER_DLL_NAME KODI_DLL_NAME("guilib") |
| 33 | #else | ||
| 34 | #define GUI_HELPER_DLL_NAME "libKODI_guilib-" ADDON_HELPER_ARCH ADDON_HELPER_EXT | ||
| 35 | #define GUI_HELPER_DLL "/library.kodi.guilib/" GUI_HELPER_DLL_NAME | ||
| 36 | #endif | ||
| 37 | 33 | ||
| 38 | /* current ADDONGUI API version */ | 34 | /* current ADDONGUI API version */ |
| 39 | #define KODI_GUILIB_API_VERSION "5.11.0" | 35 | #define KODI_GUILIB_API_VERSION "5.11.0" |
| @@ -80,15 +76,6 @@ public: | |||
| 80 | libBasePath = ((cb_array*)m_Handle)->libPath; | 76 | libBasePath = ((cb_array*)m_Handle)->libPath; |
| 81 | libBasePath += GUI_HELPER_DLL; | 77 | libBasePath += GUI_HELPER_DLL; |
| 82 | 78 | ||
| 83 | #if defined(ANDROID) | ||
| 84 | struct stat st; | ||
| 85 | if(stat(libBasePath.c_str(),&st) != 0) | ||
| 86 | { | ||
| 87 | std::string tempbin = getenv("XBMC_ANDROID_LIBS"); | ||
| 88 | libBasePath = tempbin + "/" + GUI_HELPER_DLL_NAME; | ||
| 89 | } | ||
| 90 | #endif | ||
| 91 | |||
| 92 | m_libKODI_guilib = dlopen(libBasePath.c_str(), RTLD_LAZY); | 79 | m_libKODI_guilib = dlopen(libBasePath.c_str(), RTLD_LAZY); |
| 93 | if (m_libKODI_guilib == NULL) | 80 | if (m_libKODI_guilib == NULL) |
| 94 | { | 81 | { |
diff --git a/xbmc/addons/kodi-addon-dev-kit/include/kodi/libKODI_inputstream.h b/xbmc/addons/kodi-addon-dev-kit/include/kodi/libKODI_inputstream.h index 7fe1725..a6e83cb 100644 --- a/xbmc/addons/kodi-addon-dev-kit/include/kodi/libKODI_inputstream.h +++ b/xbmc/addons/kodi-addon-dev-kit/include/kodi/libKODI_inputstream.h | |||
| @@ -33,12 +33,8 @@ | |||
| 33 | #include "cores/VideoPlayer/DVDDemuxers/DVDDemuxPacket.h" | 33 | #include "cores/VideoPlayer/DVDDemuxers/DVDDemuxPacket.h" |
| 34 | #endif | 34 | #endif |
| 35 | 35 | ||
| 36 | #ifdef _WIN32 | 36 | #define INPUTSTREAM_HELPER_DLL KODI_DLL("inputstream") |
| 37 | #define INPUTSTREAM_HELPER_DLL "\\library.kodi.inputstream\\libKODI_inputstream" ADDON_HELPER_EXT | 37 | #define INPUTSTREAM_HELPER_DLL_NAME KODI_DLL_NAME("inputstream") |
| 38 | #else | ||
| 39 | #define INPUTSTREAM_HELPER_DLL_NAME "libKODI_inputstream-" ADDON_HELPER_ARCH ADDON_HELPER_EXT | ||
| 40 | #define INPUTSTREAM_HELPER_DLL "/library.kodi.inputstream/" INPUTSTREAM_HELPER_DLL_NAME | ||
| 41 | #endif | ||
| 42 | 38 | ||
| 43 | /* current input stream API version */ | 39 | /* current input stream API version */ |
| 44 | #define KODI_INPUTSTREAM_API_VERSION "1.0.0" | 40 | #define KODI_INPUTSTREAM_API_VERSION "1.0.0" |
diff --git a/xbmc/addons/kodi-addon-dev-kit/include/kodi/libKODI_peripheral.h b/xbmc/addons/kodi-addon-dev-kit/include/kodi/libKODI_peripheral.h index 9f3f986..a28e48d 100644 --- a/xbmc/addons/kodi-addon-dev-kit/include/kodi/libKODI_peripheral.h +++ b/xbmc/addons/kodi-addon-dev-kit/include/kodi/libKODI_peripheral.h | |||
| @@ -105,6 +105,7 @@ public: | |||
| 105 | if (!PERIPHERAL_REGISTER_SYMBOL(m_libKODI_peripheral, PERIPHERAL_unregister_me)) return false; | 105 | if (!PERIPHERAL_REGISTER_SYMBOL(m_libKODI_peripheral, PERIPHERAL_unregister_me)) return false; |
| 106 | if (!PERIPHERAL_REGISTER_SYMBOL(m_libKODI_peripheral, PERIPHERAL_trigger_scan)) return false; | 106 | if (!PERIPHERAL_REGISTER_SYMBOL(m_libKODI_peripheral, PERIPHERAL_trigger_scan)) return false; |
| 107 | if (!PERIPHERAL_REGISTER_SYMBOL(m_libKODI_peripheral, PERIPHERAL_refresh_button_maps)) return false; | 107 | if (!PERIPHERAL_REGISTER_SYMBOL(m_libKODI_peripheral, PERIPHERAL_refresh_button_maps)) return false; |
| 108 | if (!PERIPHERAL_REGISTER_SYMBOL(m_libKODI_peripheral, PERIPHERAL_feature_count)) return false; | ||
| 108 | 109 | ||
| 109 | m_callbacks = PERIPHERAL_register_me(m_handle); | 110 | m_callbacks = PERIPHERAL_register_me(m_handle); |
| 110 | return m_callbacks != NULL; | 111 | return m_callbacks != NULL; |
| @@ -120,11 +121,17 @@ public: | |||
| 120 | return PERIPHERAL_refresh_button_maps(m_handle, m_callbacks, strDeviceName.c_str(), strControllerId.c_str()); | 121 | return PERIPHERAL_refresh_button_maps(m_handle, m_callbacks, strDeviceName.c_str(), strControllerId.c_str()); |
| 121 | } | 122 | } |
| 122 | 123 | ||
| 124 | unsigned int FeatureCount(const std::string& strControllerId, JOYSTICK_FEATURE_TYPE type = JOYSTICK_FEATURE_TYPE_UNKNOWN) | ||
| 125 | { | ||
| 126 | return PERIPHERAL_feature_count(m_handle, m_callbacks, strControllerId.c_str(), type); | ||
| 127 | } | ||
| 128 | |||
| 123 | protected: | 129 | protected: |
| 124 | CB_PeripheralLib* (*PERIPHERAL_register_me)(void* handle); | 130 | CB_PeripheralLib* (*PERIPHERAL_register_me)(void* handle); |
| 125 | void (*PERIPHERAL_unregister_me)(void* handle, CB_PeripheralLib* cb); | 131 | void (*PERIPHERAL_unregister_me)(void* handle, CB_PeripheralLib* cb); |
| 126 | void (*PERIPHERAL_trigger_scan)(void* handle, CB_PeripheralLib* cb); | 132 | void (*PERIPHERAL_trigger_scan)(void* handle, CB_PeripheralLib* cb); |
| 127 | void (*PERIPHERAL_refresh_button_maps)(void* handle, CB_PeripheralLib* cb, const char* deviceName, const char* controllerId); | 133 | void (*PERIPHERAL_refresh_button_maps)(void* handle, CB_PeripheralLib* cb, const char* deviceName, const char* controllerId); |
| 134 | unsigned int (*PERIPHERAL_feature_count)(void* handle, CB_PeripheralLib* cb, const char* controllerId, JOYSTICK_FEATURE_TYPE type); | ||
| 128 | 135 | ||
| 129 | private: | 136 | private: |
| 130 | void* m_handle; | 137 | void* m_handle; |
diff --git a/xbmc/addons/kodi-addon-dev-kit/include/kodi/libXBMC_addon.h b/xbmc/addons/kodi-addon-dev-kit/include/kodi/libXBMC_addon.h index ddeb1db..70bd19b 100644 --- a/xbmc/addons/kodi-addon-dev-kit/include/kodi/libXBMC_addon.h +++ b/xbmc/addons/kodi-addon-dev-kit/include/kodi/libXBMC_addon.h | |||
| @@ -34,6 +34,7 @@ | |||
| 34 | #endif | 34 | #endif |
| 35 | 35 | ||
| 36 | struct VFSDirEntry; | 36 | struct VFSDirEntry; |
| 37 | struct __stat64; | ||
| 37 | 38 | ||
| 38 | #ifdef _WIN32 // windows | 39 | #ifdef _WIN32 // windows |
| 39 | #ifndef _SSIZE_T_DEFINED | 40 | #ifndef _SSIZE_T_DEFINED |
| @@ -47,9 +48,14 @@ typedef intptr_t ssize_t; | |||
| 47 | #include "dlfcn-win32.h" | 48 | #include "dlfcn-win32.h" |
| 48 | #endif | 49 | #endif |
| 49 | 50 | ||
| 50 | #define ADDON_DLL "\\library.xbmc.addon\\libXBMC_addon" ADDON_HELPER_EXT | ||
| 51 | #define ADDON_HELPER_EXT ".dll" | 51 | #define ADDON_HELPER_EXT ".dll" |
| 52 | #define ADDON_HELPER_PATHSEP "\\" | ||
| 53 | #define ADDON_HELPER_ARCHSEP "" | ||
| 54 | #define ADDON_HELPER_ARCH "" | ||
| 55 | |||
| 52 | #else // windows | 56 | #else // windows |
| 57 | #define ADDON_HELPER_PATHSEP "/" | ||
| 58 | #define ADDON_HELPER_ARCHSEP "-" | ||
| 53 | // the ADDON_HELPER_ARCH is the platform dependend name which is used | 59 | // the ADDON_HELPER_ARCH is the platform dependend name which is used |
| 54 | // as part of the name of dynamic addon libraries. It has to match the | 60 | // as part of the name of dynamic addon libraries. It has to match the |
| 55 | // strings which are set in configure.ac for the "ARCH" variable. | 61 | // strings which are set in configure.ac for the "ARCH" variable. |
| @@ -79,14 +85,20 @@ typedef intptr_t ssize_t; | |||
| 79 | #define ADDON_HELPER_EXT ".so" | 85 | #define ADDON_HELPER_EXT ".so" |
| 80 | #endif | 86 | #endif |
| 81 | #include <dlfcn.h> // linux+osx | 87 | #include <dlfcn.h> // linux+osx |
| 82 | #define ADDON_DLL_NAME "libXBMC_addon-" ADDON_HELPER_ARCH ADDON_HELPER_EXT | ||
| 83 | #define ADDON_DLL "/library.xbmc.addon/" ADDON_DLL_NAME | ||
| 84 | #endif | 88 | #endif |
| 89 | |||
| 90 | #define KODI_DLL_NAME(name) "libKODI_" name ADDON_HELPER_ARCHSEP ADDON_HELPER_ARCH ADDON_HELPER_EXT | ||
| 91 | #define XBMC_DLL_NAME(name) "libXBMC_" name ADDON_HELPER_ARCHSEP ADDON_HELPER_ARCH ADDON_HELPER_EXT | ||
| 85 | #if defined(ANDROID) | 92 | #if defined(ANDROID) |
| 86 | #include <sys/stat.h> | 93 | #define KODI_DLL(name) ADDON_HELPER_PATHSEP KODI_DLL_NAME(name) |
| 94 | #define XBMC_DLL(name) ADDON_HELPER_PATHSEP XBMC_DLL_NAME(name) | ||
| 95 | #else | ||
| 96 | #define KODI_DLL(name) ADDON_HELPER_PATHSEP "library.kodi." name ADDON_HELPER_PATHSEP KODI_DLL_NAME(name) | ||
| 97 | #define XBMC_DLL(name) ADDON_HELPER_PATHSEP "library.xbmc." name ADDON_HELPER_PATHSEP XBMC_DLL_NAME(name) | ||
| 87 | #endif | 98 | #endif |
| 88 | 99 | ||
| 89 | struct __stat64; | 100 | #define ADDON_DLL_NAME XBMC_DLL_NAME("addon") |
| 101 | #define ADDON_DLL XBMC_DLL("addon") | ||
| 90 | 102 | ||
| 91 | #ifdef LOG_DEBUG | 103 | #ifdef LOG_DEBUG |
| 92 | #undef LOG_DEBUG | 104 | #undef LOG_DEBUG |
| @@ -147,15 +159,6 @@ namespace ADDON | |||
| 147 | libBasePath = ((cb_array*)m_Handle)->libPath; | 159 | libBasePath = ((cb_array*)m_Handle)->libPath; |
| 148 | libBasePath += ADDON_DLL; | 160 | libBasePath += ADDON_DLL; |
| 149 | 161 | ||
| 150 | #if defined(ANDROID) | ||
| 151 | struct stat st; | ||
| 152 | if(stat(libBasePath.c_str(),&st) != 0) | ||
| 153 | { | ||
| 154 | std::string tempbin = getenv("XBMC_ANDROID_LIBS"); | ||
| 155 | libBasePath = tempbin + "/" + ADDON_DLL_NAME; | ||
| 156 | } | ||
| 157 | #endif | ||
| 158 | |||
| 159 | m_libXBMC_addon = dlopen(libBasePath.c_str(), RTLD_LAZY); | 162 | m_libXBMC_addon = dlopen(libBasePath.c_str(), RTLD_LAZY); |
| 160 | if (m_libXBMC_addon == NULL) | 163 | if (m_libXBMC_addon == NULL) |
| 161 | { | 164 | { |
diff --git a/xbmc/addons/kodi-addon-dev-kit/include/kodi/libXBMC_codec.h b/xbmc/addons/kodi-addon-dev-kit/include/kodi/libXBMC_codec.h index 3853f08..0e64b11 100644 --- a/xbmc/addons/kodi-addon-dev-kit/include/kodi/libXBMC_codec.h +++ b/xbmc/addons/kodi-addon-dev-kit/include/kodi/libXBMC_codec.h | |||
| @@ -27,12 +27,8 @@ | |||
| 27 | #include "xbmc_codec_types.h" | 27 | #include "xbmc_codec_types.h" |
| 28 | #include "libXBMC_addon.h" | 28 | #include "libXBMC_addon.h" |
| 29 | 29 | ||
| 30 | #ifdef _WIN32 | 30 | #define CODEC_HELPER_DLL_NAME XBMC_DLL_NAME("codec") |
| 31 | #define CODEC_HELPER_DLL "\\library.xbmc.codec\\libXBMC_codec" ADDON_HELPER_EXT | 31 | #define CODEC_HELPER_DLL XBMC_DLL("codec") |
| 32 | #else | ||
| 33 | #define CODEC_HELPER_DLL_NAME "libXBMC_codec-" ADDON_HELPER_ARCH ADDON_HELPER_EXT | ||
| 34 | #define CODEC_HELPER_DLL "/library.xbmc.codec/" CODEC_HELPER_DLL_NAME | ||
| 35 | #endif | ||
| 36 | 32 | ||
| 37 | class CHelper_libXBMC_codec | 33 | class CHelper_libXBMC_codec |
| 38 | { | 34 | { |
| @@ -65,15 +61,6 @@ public: | |||
| 65 | libBasePath = ((cb_array*)m_Handle)->libPath; | 61 | libBasePath = ((cb_array*)m_Handle)->libPath; |
| 66 | libBasePath += CODEC_HELPER_DLL; | 62 | libBasePath += CODEC_HELPER_DLL; |
| 67 | 63 | ||
| 68 | #if defined(ANDROID) | ||
| 69 | struct stat st; | ||
| 70 | if(stat(libBasePath.c_str(),&st) != 0) | ||
| 71 | { | ||
| 72 | std::string tempbin = getenv("XBMC_ANDROID_LIBS"); | ||
| 73 | libBasePath = tempbin + "/" + CODEC_HELPER_DLL_NAME; | ||
| 74 | } | ||
| 75 | #endif | ||
| 76 | |||
| 77 | m_libXBMC_codec = dlopen(libBasePath.c_str(), RTLD_LAZY); | 64 | m_libXBMC_codec = dlopen(libBasePath.c_str(), RTLD_LAZY); |
| 78 | if (m_libXBMC_codec == NULL) | 65 | if (m_libXBMC_codec == NULL) |
| 79 | { | 66 | { |
diff --git a/xbmc/addons/kodi-addon-dev-kit/include/kodi/libXBMC_pvr.h b/xbmc/addons/kodi-addon-dev-kit/include/kodi/libXBMC_pvr.h index 700f912..a769328 100644 --- a/xbmc/addons/kodi-addon-dev-kit/include/kodi/libXBMC_pvr.h +++ b/xbmc/addons/kodi-addon-dev-kit/include/kodi/libXBMC_pvr.h | |||
| @@ -27,16 +27,12 @@ | |||
| 27 | #include "xbmc_pvr_types.h" | 27 | #include "xbmc_pvr_types.h" |
| 28 | #include "libXBMC_addon.h" | 28 | #include "libXBMC_addon.h" |
| 29 | 29 | ||
| 30 | #ifdef _WIN32 | 30 | #define PVR_HELPER_DLL_NAME XBMC_DLL_NAME("pvr") |
| 31 | #define PVR_HELPER_DLL "\\library.xbmc.pvr\\libXBMC_pvr" ADDON_HELPER_EXT | 31 | #define PVR_HELPER_DLL XBMC_DLL("pvr") |
| 32 | #else | ||
| 33 | #define PVR_HELPER_DLL_NAME "libXBMC_pvr-" ADDON_HELPER_ARCH ADDON_HELPER_EXT | ||
| 34 | #define PVR_HELPER_DLL "/library.xbmc.pvr/" PVR_HELPER_DLL_NAME | ||
| 35 | #endif | ||
| 36 | 32 | ||
| 37 | #define DVD_TIME_BASE 1000000 | 33 | #define DVD_TIME_BASE 1000000 |
| 38 | 34 | ||
| 39 | //TODO original definition is in DVDClock.h | 35 | //! @todo original definition is in DVDClock.h |
| 40 | #define DVD_NOPTS_VALUE 0xFFF0000000000000 | 36 | #define DVD_NOPTS_VALUE 0xFFF0000000000000 |
| 41 | 37 | ||
| 42 | class CHelper_libXBMC_pvr | 38 | class CHelper_libXBMC_pvr |
| @@ -70,15 +66,6 @@ public: | |||
| 70 | libBasePath = ((cb_array*)m_Handle)->libPath; | 66 | libBasePath = ((cb_array*)m_Handle)->libPath; |
| 71 | libBasePath += PVR_HELPER_DLL; | 67 | libBasePath += PVR_HELPER_DLL; |
| 72 | 68 | ||
| 73 | #if defined(ANDROID) | ||
| 74 | struct stat st; | ||
| 75 | if(stat(libBasePath.c_str(),&st) != 0) | ||
| 76 | { | ||
| 77 | std::string tempbin = getenv("XBMC_ANDROID_LIBS"); | ||
| 78 | libBasePath = tempbin + "/" + PVR_HELPER_DLL_NAME; | ||
| 79 | } | ||
| 80 | #endif | ||
| 81 | |||
| 82 | m_libXBMC_pvr = dlopen(libBasePath.c_str(), RTLD_LAZY); | 69 | m_libXBMC_pvr = dlopen(libBasePath.c_str(), RTLD_LAZY); |
| 83 | if (m_libXBMC_pvr == NULL) | 70 | if (m_libXBMC_pvr == NULL) |
| 84 | { | 71 | { |
diff --git a/xbmc/addons/kodi-addon-dev-kit/include/kodi/xbmc_epg_types.h b/xbmc/addons/kodi-addon-dev-kit/include/kodi/xbmc_epg_types.h index 9460952..b6200bf 100644 --- a/xbmc/addons/kodi-addon-dev-kit/include/kodi/xbmc_epg_types.h +++ b/xbmc/addons/kodi-addon-dev-kit/include/kodi/xbmc_epg_types.h | |||
| @@ -90,7 +90,7 @@ extern "C" { | |||
| 90 | * @brief Representation of an EPG event. | 90 | * @brief Representation of an EPG event. |
| 91 | */ | 91 | */ |
| 92 | typedef struct EPG_TAG { | 92 | typedef struct EPG_TAG { |
| 93 | unsigned int iUniqueBroadcastId; /*!< @brief (required) identifier for this event. Valid uids must be greater than EPG_TAG_INVALID_UID. */ | 93 | unsigned int iUniqueBroadcastId; /*!< @brief (required) identifier for this event. Event uids must be unique for a channel. Valid uids must be greater than EPG_TAG_INVALID_UID. */ |
| 94 | const char * strTitle; /*!< @brief (required) this event's title */ | 94 | const char * strTitle; /*!< @brief (required) this event's title */ |
| 95 | unsigned int iChannelNumber; /*!< @brief (required) the number of the channel this event occurs on */ | 95 | unsigned int iChannelNumber; /*!< @brief (required) the number of the channel this event occurs on */ |
| 96 | time_t startTime; /*!< @brief (required) start time in UTC */ | 96 | time_t startTime; /*!< @brief (required) start time in UTC */ |
diff --git a/xbmc/addons/kodi-addon-dev-kit/include/kodi/xbmc_pvr_types.h b/xbmc/addons/kodi-addon-dev-kit/include/kodi/xbmc_pvr_types.h index b50483d..08ae183 100644 --- a/xbmc/addons/kodi-addon-dev-kit/include/kodi/xbmc_pvr_types.h +++ b/xbmc/addons/kodi-addon-dev-kit/include/kodi/xbmc_pvr_types.h | |||
| @@ -455,7 +455,7 @@ extern "C" { | |||
| 455 | unsigned int iWeekdays; /*!< @brief (optional) week days, for repeating timers */ | 455 | unsigned int iWeekdays; /*!< @brief (optional) week days, for repeating timers */ |
| 456 | unsigned int iPreventDuplicateEpisodes; /*!< @brief (optional) 1 if backend should only record new episodes in case of a repeating epg-based timer, 0 if all episodes shall be recorded (no duplicate detection). Actual algorithm for | 456 | unsigned int iPreventDuplicateEpisodes; /*!< @brief (optional) 1 if backend should only record new episodes in case of a repeating epg-based timer, 0 if all episodes shall be recorded (no duplicate detection). Actual algorithm for |
| 457 | duplicate detection is defined by the backend. Addons may define own values for different duplicate detection algorithms, thus this is not just a bool.*/ | 457 | duplicate detection is defined by the backend. Addons may define own values for different duplicate detection algorithms, thus this is not just a bool.*/ |
| 458 | unsigned int iEpgUid; /*!< @brief (optional) EPG event id associated with this timer. Valid ids must be greater than EPG_TAG_INVALID_UID. */ | 458 | unsigned int iEpgUid; /*!< @brief (optional) EPG event id associated with this timer. Event ids must be unique for a channel. Valid ids must be greater than EPG_TAG_INVALID_UID. */ |
| 459 | unsigned int iMarginStart; /*!< @brief (optional) if set, the backend starts the recording iMarginStart minutes before startTime. */ | 459 | unsigned int iMarginStart; /*!< @brief (optional) if set, the backend starts the recording iMarginStart minutes before startTime. */ |
| 460 | unsigned int iMarginEnd; /*!< @brief (optional) if set, the backend ends the recording iMarginEnd minutes after endTime. */ | 460 | unsigned int iMarginEnd; /*!< @brief (optional) if set, the backend ends the recording iMarginEnd minutes after endTime. */ |
| 461 | int iGenreType; /*!< @brief (optional) genre type */ | 461 | int iGenreType; /*!< @brief (optional) genre type */ |
