diff options
| author | manuel <manuel@mausz.at> | 2015-03-03 16:53:59 +0100 |
|---|---|---|
| committer | manuel <manuel@mausz.at> | 2015-03-03 16:53:59 +0100 |
| commit | ffca21f2743a7b367fa212799c6e2fea6190dd5d (patch) | |
| tree | 0608ea3a29cf644ec9ab204e2b4bb9bfaae1c381 /xbmc/addons/include | |
| download | kodi-pvr-build-ffca21f2743a7b367fa212799c6e2fea6190dd5d.tar.gz kodi-pvr-build-ffca21f2743a7b367fa212799c6e2fea6190dd5d.tar.bz2 kodi-pvr-build-ffca21f2743a7b367fa212799c6e2fea6190dd5d.zip | |
initial commit for kodi master
Diffstat (limited to 'xbmc/addons/include')
| -rw-r--r-- | xbmc/addons/include/NOTE | 12 | ||||
| -rw-r--r-- | xbmc/addons/include/xbmc_addon_cpp_dll.h | 191 | ||||
| -rw-r--r-- | xbmc/addons/include/xbmc_addon_dll.h | 55 | ||||
| -rw-r--r-- | xbmc/addons/include/xbmc_addon_types.h | 64 | ||||
| -rw-r--r-- | xbmc/addons/include/xbmc_audioenc_dll.h | 61 | ||||
| -rw-r--r-- | xbmc/addons/include/xbmc_audioenc_types.h | 113 | ||||
| -rw-r--r-- | xbmc/addons/include/xbmc_codec_types.h | 55 | ||||
| -rw-r--r-- | xbmc/addons/include/xbmc_epg_types.h | 96 | ||||
| -rw-r--r-- | xbmc/addons/include/xbmc_pvr_dll.h | 710 | ||||
| -rw-r--r-- | xbmc/addons/include/xbmc_pvr_types.h | 415 | ||||
| -rw-r--r-- | xbmc/addons/include/xbmc_scr_dll.h | 45 | ||||
| -rw-r--r-- | xbmc/addons/include/xbmc_scr_types.h | 53 | ||||
| -rw-r--r-- | xbmc/addons/include/xbmc_stream_utils.hpp | 264 | ||||
| -rw-r--r-- | xbmc/addons/include/xbmc_vis_dll.h | 55 | ||||
| -rw-r--r-- | xbmc/addons/include/xbmc_vis_types.h | 111 |
15 files changed, 2300 insertions, 0 deletions
diff --git a/xbmc/addons/include/NOTE b/xbmc/addons/include/NOTE new file mode 100644 index 0000000..dbcc329 --- /dev/null +++ b/xbmc/addons/include/NOTE | |||
| @@ -0,0 +1,12 @@ | |||
| 1 | NOTE: | ||
| 2 | |||
| 3 | This directory contains independent Headers to build Add-on's | ||
| 4 | without the whole XBMC source tree. The Add-on itself can add | ||
| 5 | this headers to his source tree without dependencies to any | ||
| 6 | XBMC related classes or functions. | ||
| 7 | |||
| 8 | Also this headers are never changed without a API Version | ||
| 9 | change. | ||
| 10 | |||
| 11 | The current PVR API version can be found in xbmc_pvr_types.h: | ||
| 12 | XBMC_PVR_API_VERSION | ||
diff --git a/xbmc/addons/include/xbmc_addon_cpp_dll.h b/xbmc/addons/include/xbmc_addon_cpp_dll.h new file mode 100644 index 0000000..3944525 --- /dev/null +++ b/xbmc/addons/include/xbmc_addon_cpp_dll.h | |||
| @@ -0,0 +1,191 @@ | |||
| 1 | #ifndef __XBMC_ADDON_CPP_H__ | ||
| 2 | #define __XBMC_ADDON_CPP_H__ | ||
| 3 | |||
| 4 | /* | ||
| 5 | * Copyright (C) 2005-2013 Team XBMC | ||
| 6 | * http://xbmc.org | ||
| 7 | * | ||
| 8 | * This Program is free software; you can redistribute it and/or modify | ||
| 9 | * it under the terms of the GNU General Public License as published by | ||
| 10 | * the Free Software Foundation; either version 2, or (at your option) | ||
| 11 | * any later version. | ||
| 12 | * | ||
| 13 | * This Program is distributed in the hope that it will be useful, | ||
| 14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| 15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
| 16 | * GNU General Public License for more details. | ||
| 17 | * | ||
| 18 | * You should have received a copy of the GNU General Public License | ||
| 19 | * along with XBMC; see the file COPYING. If not, see | ||
| 20 | * <http://www.gnu.org/licenses/>. | ||
| 21 | * | ||
| 22 | */ | ||
| 23 | |||
| 24 | #include "xbmc_addon_types.h" | ||
| 25 | |||
| 26 | #include <vector> | ||
| 27 | #include <string.h> | ||
| 28 | #include <stdlib.h> | ||
| 29 | |||
| 30 | class DllSetting | ||
| 31 | { | ||
| 32 | public: | ||
| 33 | enum SETTING_TYPE { NONE=0, CHECK, SPIN }; | ||
| 34 | |||
| 35 | DllSetting(SETTING_TYPE t, const char *n, const char *l) | ||
| 36 | { | ||
| 37 | id = NULL; | ||
| 38 | label = NULL; | ||
| 39 | if (n) | ||
| 40 | { | ||
| 41 | id = new char[strlen(n)+1]; | ||
| 42 | strcpy(id, n); | ||
| 43 | } | ||
| 44 | if (l) | ||
| 45 | { | ||
| 46 | label = new char[strlen(l)+1]; | ||
| 47 | strcpy(label, l); | ||
| 48 | } | ||
| 49 | current = 0; | ||
| 50 | type = t; | ||
| 51 | } | ||
| 52 | |||
| 53 | DllSetting(const DllSetting &rhs) // copy constructor | ||
| 54 | { | ||
| 55 | id = NULL; | ||
| 56 | label = NULL; | ||
| 57 | if (rhs.id) | ||
| 58 | { | ||
| 59 | id = new char[strlen(rhs.id)+1]; | ||
| 60 | strcpy(id, rhs.id); | ||
| 61 | } | ||
| 62 | if (rhs.label) | ||
| 63 | { | ||
| 64 | label = new char[strlen(rhs.label)+1]; | ||
| 65 | strcpy(label, rhs.label); | ||
| 66 | } | ||
| 67 | current = rhs.current; | ||
| 68 | type = rhs.type; | ||
| 69 | for (unsigned int i = 0; i < rhs.entry.size(); i++) | ||
| 70 | { | ||
| 71 | char *lab = new char[strlen(rhs.entry[i]) + 1]; | ||
| 72 | strcpy(lab, rhs.entry[i]); | ||
| 73 | entry.push_back(lab); | ||
| 74 | } | ||
| 75 | } | ||
| 76 | |||
| 77 | ~DllSetting() | ||
| 78 | { | ||
| 79 | delete[] id; | ||
| 80 | delete[] label; | ||
| 81 | for (unsigned int i=0; i < entry.size(); i++) | ||
| 82 | delete[] entry[i]; | ||
| 83 | } | ||
| 84 | |||
| 85 | void AddEntry(const char *label) | ||
| 86 | { | ||
| 87 | if (!label || type != SPIN) return; | ||
| 88 | char *lab = new char[strlen(label) + 1]; | ||
| 89 | strcpy(lab, label); | ||
| 90 | entry.push_back(lab); | ||
| 91 | } | ||
| 92 | |||
| 93 | // data members | ||
| 94 | SETTING_TYPE type; | ||
| 95 | char* id; | ||
| 96 | char* label; | ||
| 97 | int current; | ||
| 98 | std::vector<const char *> entry; | ||
| 99 | }; | ||
| 100 | |||
| 101 | class DllUtils | ||
| 102 | { | ||
| 103 | public: | ||
| 104 | |||
| 105 | static unsigned int VecToStruct(std::vector<DllSetting> &vecSet, ADDON_StructSetting*** sSet) | ||
| 106 | { | ||
| 107 | *sSet = NULL; | ||
| 108 | if(vecSet.size() == 0) | ||
| 109 | return 0; | ||
| 110 | |||
| 111 | unsigned int uiElements=0; | ||
| 112 | |||
| 113 | *sSet = (ADDON_StructSetting**)malloc(vecSet.size()*sizeof(ADDON_StructSetting*)); | ||
| 114 | for(unsigned int i=0;i<vecSet.size();i++) | ||
| 115 | { | ||
| 116 | (*sSet)[i] = NULL; | ||
| 117 | (*sSet)[i] = (ADDON_StructSetting*)malloc(sizeof(ADDON_StructSetting)); | ||
| 118 | (*sSet)[i]->id = NULL; | ||
| 119 | (*sSet)[i]->label = NULL; | ||
| 120 | uiElements++; | ||
| 121 | |||
| 122 | if (vecSet[i].id && vecSet[i].label) | ||
| 123 | { | ||
| 124 | (*sSet)[i]->id = strdup(vecSet[i].id); | ||
| 125 | (*sSet)[i]->label = strdup(vecSet[i].label); | ||
| 126 | (*sSet)[i]->type = vecSet[i].type; | ||
| 127 | (*sSet)[i]->current = vecSet[i].current; | ||
| 128 | (*sSet)[i]->entry_elements = 0; | ||
| 129 | (*sSet)[i]->entry = NULL; | ||
| 130 | if(vecSet[i].type == DllSetting::SPIN && vecSet[i].entry.size() > 0) | ||
| 131 | { | ||
| 132 | (*sSet)[i]->entry = (char**)malloc(vecSet[i].entry.size()*sizeof(char**)); | ||
| 133 | for(unsigned int j=0;j<vecSet[i].entry.size();j++) | ||
| 134 | { | ||
| 135 | if(strlen(vecSet[i].entry[j]) > 0) | ||
| 136 | { | ||
| 137 | (*sSet)[i]->entry[j] = strdup(vecSet[i].entry[j]); | ||
| 138 | (*sSet)[i]->entry_elements++; | ||
| 139 | } | ||
| 140 | } | ||
| 141 | } | ||
| 142 | } | ||
| 143 | } | ||
| 144 | return uiElements; | ||
| 145 | } | ||
| 146 | |||
| 147 | static void StructToVec(unsigned int iElements, ADDON_StructSetting*** sSet, std::vector<DllSetting> *vecSet) | ||
| 148 | { | ||
| 149 | if(iElements == 0) | ||
| 150 | return; | ||
| 151 | |||
| 152 | vecSet->clear(); | ||
| 153 | for(unsigned int i=0;i<iElements;i++) | ||
| 154 | { | ||
| 155 | DllSetting vSet((DllSetting::SETTING_TYPE)(*sSet)[i]->type, (*sSet)[i]->id, (*sSet)[i]->label); | ||
| 156 | if((*sSet)[i]->type == DllSetting::SPIN) | ||
| 157 | { | ||
| 158 | for(unsigned int j=0;j<(*sSet)[i]->entry_elements;j++) | ||
| 159 | { | ||
| 160 | vSet.AddEntry((*sSet)[i]->entry[j]); | ||
| 161 | } | ||
| 162 | } | ||
| 163 | vSet.current = (*sSet)[i]->current; | ||
| 164 | vecSet->push_back(vSet); | ||
| 165 | } | ||
| 166 | } | ||
| 167 | |||
| 168 | static void FreeStruct(unsigned int iElements, ADDON_StructSetting*** sSet) | ||
| 169 | { | ||
| 170 | if(iElements == 0) | ||
| 171 | return; | ||
| 172 | |||
| 173 | for(unsigned int i=0;i<iElements;i++) | ||
| 174 | { | ||
| 175 | if((*sSet)[i]->type == DllSetting::SPIN) | ||
| 176 | { | ||
| 177 | for(unsigned int j=0;j<(*sSet)[i]->entry_elements;j++) | ||
| 178 | { | ||
| 179 | free((*sSet)[i]->entry[j]); | ||
| 180 | } | ||
| 181 | free((*sSet)[i]->entry); | ||
| 182 | } | ||
| 183 | free((*sSet)[i]->id); | ||
| 184 | free((*sSet)[i]->label); | ||
| 185 | free((*sSet)[i]); | ||
| 186 | } | ||
| 187 | free(*sSet); | ||
| 188 | } | ||
| 189 | }; | ||
| 190 | |||
| 191 | #endif | ||
diff --git a/xbmc/addons/include/xbmc_addon_dll.h b/xbmc/addons/include/xbmc_addon_dll.h new file mode 100644 index 0000000..fa6415f --- /dev/null +++ b/xbmc/addons/include/xbmc_addon_dll.h | |||
| @@ -0,0 +1,55 @@ | |||
| 1 | #ifndef __XBMC_ADDON_DLL_H__ | ||
| 2 | #define __XBMC_ADDON_DLL_H__ | ||
| 3 | |||
| 4 | /* | ||
| 5 | * Copyright (C) 2005-2013 Team XBMC | ||
| 6 | * http://xbmc.org | ||
| 7 | * | ||
| 8 | * This Program is free software; you can redistribute it and/or modify | ||
| 9 | * it under the terms of the GNU General Public License as published by | ||
| 10 | * the Free Software Foundation; either version 2, or (at your option) | ||
| 11 | * any later version. | ||
| 12 | * | ||
| 13 | * This Program is distributed in the hope that it will be useful, | ||
| 14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| 15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
| 16 | * GNU General Public License for more details. | ||
| 17 | * | ||
| 18 | * You should have received a copy of the GNU General Public License | ||
| 19 | * along with XBMC; see the file COPYING. If not, see | ||
| 20 | * <http://www.gnu.org/licenses/>. | ||
| 21 | * | ||
| 22 | */ | ||
| 23 | |||
| 24 | #ifdef TARGET_WINDOWS | ||
| 25 | #include <windows.h> | ||
| 26 | #else | ||
| 27 | #ifndef __cdecl | ||
| 28 | #define __cdecl | ||
| 29 | #endif | ||
| 30 | #ifndef __declspec | ||
| 31 | #define __declspec(X) | ||
| 32 | #endif | ||
| 33 | #endif | ||
| 34 | |||
| 35 | #include "xbmc_addon_types.h" | ||
| 36 | |||
| 37 | #ifdef __cplusplus | ||
| 38 | extern "C" { | ||
| 39 | #endif | ||
| 40 | |||
| 41 | ADDON_STATUS __declspec(dllexport) ADDON_Create(void *callbacks, void* props); | ||
| 42 | void __declspec(dllexport) ADDON_Stop(); | ||
| 43 | void __declspec(dllexport) ADDON_Destroy(); | ||
| 44 | ADDON_STATUS __declspec(dllexport) ADDON_GetStatus(); | ||
| 45 | bool __declspec(dllexport) ADDON_HasSettings(); | ||
| 46 | unsigned int __declspec(dllexport) ADDON_GetSettings(ADDON_StructSetting ***sSet); | ||
| 47 | ADDON_STATUS __declspec(dllexport) ADDON_SetSetting(const char *settingName, const void *settingValue); | ||
| 48 | void __declspec(dllexport) ADDON_FreeSettings(); | ||
| 49 | void __declspec(dllexport) ADDON_Announce(const char *flag, const char *sender, const char *message, const void *data); | ||
| 50 | |||
| 51 | #ifdef __cplusplus | ||
| 52 | }; | ||
| 53 | #endif | ||
| 54 | |||
| 55 | #endif | ||
diff --git a/xbmc/addons/include/xbmc_addon_types.h b/xbmc/addons/include/xbmc_addon_types.h new file mode 100644 index 0000000..bd6cbe8 --- /dev/null +++ b/xbmc/addons/include/xbmc_addon_types.h | |||
| @@ -0,0 +1,64 @@ | |||
| 1 | #ifndef __XBMC_ADDON_TYPES_H__ | ||
| 2 | #define __XBMC_ADDON_TYPES_H__ | ||
| 3 | |||
| 4 | /* | ||
| 5 | * Copyright (C) 2005-2013 Team XBMC | ||
| 6 | * http://xbmc.org | ||
| 7 | * | ||
| 8 | * This Program is free software; you can redistribute it and/or modify | ||
| 9 | * it under the terms of the GNU General Public License as published by | ||
| 10 | * the Free Software Foundation; either version 2, or (at your option) | ||
| 11 | * any later version. | ||
| 12 | * | ||
| 13 | * This Program is distributed in the hope that it will be useful, | ||
| 14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| 15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
| 16 | * GNU General Public License for more details. | ||
| 17 | * | ||
| 18 | * You should have received a copy of the GNU General Public License | ||
| 19 | * along with XBMC; see the file COPYING. If not, see | ||
| 20 | * <http://www.gnu.org/licenses/>. | ||
| 21 | * | ||
| 22 | */ | ||
| 23 | |||
| 24 | #ifdef __cplusplus | ||
| 25 | extern "C" { | ||
| 26 | #endif | ||
| 27 | |||
| 28 | enum ADDON_STATUS | ||
| 29 | { | ||
| 30 | ADDON_STATUS_OK, | ||
| 31 | ADDON_STATUS_LOST_CONNECTION, | ||
| 32 | ADDON_STATUS_NEED_RESTART, | ||
| 33 | ADDON_STATUS_NEED_SETTINGS, | ||
| 34 | ADDON_STATUS_UNKNOWN, | ||
| 35 | ADDON_STATUS_NEED_SAVEDSETTINGS, | ||
| 36 | ADDON_STATUS_PERMANENT_FAILURE /**< permanent failure, like failing to resolve methods */ | ||
| 37 | }; | ||
| 38 | |||
| 39 | typedef struct | ||
| 40 | { | ||
| 41 | int type; | ||
| 42 | char* id; | ||
| 43 | char* label; | ||
| 44 | int current; | ||
| 45 | char** entry; | ||
| 46 | unsigned int entry_elements; | ||
| 47 | } ADDON_StructSetting; | ||
| 48 | |||
| 49 | /*! | ||
| 50 | * @brief Handle used to return data from the PVR add-on to CPVRClient | ||
| 51 | */ | ||
| 52 | struct ADDON_HANDLE_STRUCT | ||
| 53 | { | ||
| 54 | void *callerAddress; /*!< address of the caller */ | ||
| 55 | void *dataAddress; /*!< address to store data in */ | ||
| 56 | int dataIdentifier; /*!< parameter to pass back when calling the callback */ | ||
| 57 | }; | ||
| 58 | typedef ADDON_HANDLE_STRUCT *ADDON_HANDLE; | ||
| 59 | |||
| 60 | #ifdef __cplusplus | ||
| 61 | }; | ||
| 62 | #endif | ||
| 63 | |||
| 64 | #endif | ||
diff --git a/xbmc/addons/include/xbmc_audioenc_dll.h b/xbmc/addons/include/xbmc_audioenc_dll.h new file mode 100644 index 0000000..01e8d12 --- /dev/null +++ b/xbmc/addons/include/xbmc_audioenc_dll.h | |||
| @@ -0,0 +1,61 @@ | |||
| 1 | #pragma once | ||
| 2 | /* | ||
| 3 | * Copyright (C) 2005-2013 Team XBMC | ||
| 4 | * http://xbmc.org | ||
| 5 | * | ||
| 6 | * This Program is free software; you can redistribute it and/or modify | ||
| 7 | * it under the terms of the GNU General Public License as published by | ||
| 8 | * the Free Software Foundation; either version 2, or (at your option) | ||
| 9 | * any later version. | ||
| 10 | * | ||
| 11 | * This Program is distributed in the hope that it will be useful, | ||
| 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
| 14 | * GNU General Public License for more details. | ||
| 15 | * | ||
| 16 | * You should have received a copy of the GNU General Public License | ||
| 17 | * along with XBMC; see the file COPYING. If not, see | ||
| 18 | * <http://www.gnu.org/licenses/>. | ||
| 19 | * | ||
| 20 | */ | ||
| 21 | |||
| 22 | #ifndef __XBMC_AUDIOENC_H__ | ||
| 23 | #define __XBMC_AUDIOENC_H__ | ||
| 24 | |||
| 25 | #include <stdint.h> | ||
| 26 | #include "xbmc_addon_dll.h" | ||
| 27 | #include "xbmc_audioenc_types.h" | ||
| 28 | |||
| 29 | extern "C" | ||
| 30 | { | ||
| 31 | //! \copydoc AudioEncoder::Create | ||
| 32 | void* Create(audioenc_callbacks *callbacks); | ||
| 33 | |||
| 34 | //! \copydoc AudioEncoder::Start | ||
| 35 | bool Start(void* context, int iInChannels, int iInRate, int iInBits, | ||
| 36 | const char* title, const char* artist, | ||
| 37 | const char* albumartist, const char* album, | ||
| 38 | const char* year, const char* track, | ||
| 39 | const char* genre, const char* comment, int iTrackLength); | ||
| 40 | |||
| 41 | //! \copydoc AudioEncoder::Encode | ||
| 42 | int Encode(void* context, int nNumBytesRead, uint8_t* pbtStream); | ||
| 43 | |||
| 44 | //! \copydoc AudioEncoder::Finish | ||
| 45 | bool Finish(void* context); | ||
| 46 | |||
| 47 | //! \copydoc AudioEncoder::Free | ||
| 48 | void Free(void* context); | ||
| 49 | |||
| 50 | // function to export the above structure to XBMC | ||
| 51 | void __declspec(dllexport) get_addon(struct AudioEncoder* pScr) | ||
| 52 | { | ||
| 53 | pScr->Create = Create; | ||
| 54 | pScr->Start = Start; | ||
| 55 | pScr->Encode = Encode; | ||
| 56 | pScr->Finish = Finish; | ||
| 57 | pScr->Free = Free; | ||
| 58 | }; | ||
| 59 | }; | ||
| 60 | |||
| 61 | #endif | ||
diff --git a/xbmc/addons/include/xbmc_audioenc_types.h b/xbmc/addons/include/xbmc_audioenc_types.h new file mode 100644 index 0000000..aa527db --- /dev/null +++ b/xbmc/addons/include/xbmc_audioenc_types.h | |||
| @@ -0,0 +1,113 @@ | |||
| 1 | #pragma once | ||
| 2 | /* | ||
| 3 | * Copyright (C) 2005-2013 Team XBMC | ||
| 4 | * http://xbmc.org | ||
| 5 | * | ||
| 6 | * This Program is free software; you can redistribute it and/or modify | ||
| 7 | * it under the terms of the GNU General Public License as published by | ||
| 8 | * the Free Software Foundation; either version 2, or (at your option) | ||
| 9 | * any later version. | ||
| 10 | * | ||
| 11 | * This Program is distributed in the hope that it will be useful, | ||
| 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
| 14 | * GNU General Public License for more details. | ||
| 15 | * | ||
| 16 | * You should have received a copy of the GNU General Public License | ||
| 17 | * along with XBMC; see the file COPYING. If not, see | ||
| 18 | * <http://www.gnu.org/licenses/>. | ||
| 19 | * | ||
| 20 | */ | ||
| 21 | |||
| 22 | #ifndef __AUDIOENC_TYPES_H__ | ||
| 23 | #define __AUDIOENC_TYPES_H__ | ||
| 24 | |||
| 25 | #ifdef TARGET_WINDOWS | ||
| 26 | #include <windows.h> | ||
| 27 | #else | ||
| 28 | #ifndef __cdecl | ||
| 29 | #define __cdecl | ||
| 30 | #endif | ||
| 31 | #ifndef __declspec | ||
| 32 | #define __declspec(X) | ||
| 33 | #endif | ||
| 34 | #endif | ||
| 35 | |||
| 36 | #include <stdint.h> | ||
| 37 | |||
| 38 | extern "C" | ||
| 39 | { | ||
| 40 | struct AUDIOENC_INFO | ||
| 41 | { | ||
| 42 | int dummy; | ||
| 43 | }; | ||
| 44 | |||
| 45 | struct AUDIOENC_PROPS | ||
| 46 | { | ||
| 47 | int dummy; | ||
| 48 | }; | ||
| 49 | |||
| 50 | typedef int (*audioenc_write_callback)(void* opaque, uint8_t* data, int len); | ||
| 51 | typedef int64_t (*audioenc_seek_callback)(void* opaque, int64_t pos, int whence); | ||
| 52 | |||
| 53 | typedef struct | ||
| 54 | { | ||
| 55 | void* opaque; | ||
| 56 | audioenc_write_callback write; | ||
| 57 | audioenc_seek_callback seek; | ||
| 58 | } audioenc_callbacks; | ||
| 59 | |||
| 60 | struct AudioEncoder | ||
| 61 | { | ||
| 62 | /*! \brief Create encoder context | ||
| 63 | \param callbacks Pointer to audioenc_callbacks structure. | ||
| 64 | \return opaque pointer to encoder context, to be passed to other methods. | ||
| 65 | \sa IEncoder::Init | ||
| 66 | */ | ||
| 67 | void (*(__cdecl *Create) (audioenc_callbacks* callbacks)); | ||
| 68 | |||
| 69 | /*! \brief Start encoder | ||
| 70 | \param context Encoder context from Create. | ||
| 71 | \param iInChannels Number of channels | ||
| 72 | \param iInRate Sample rate of input data | ||
| 73 | \param iInBits Bits per sample in input data | ||
| 74 | \param title The title of the song | ||
| 75 | \param artist The artist of the song | ||
| 76 | \param albumartist The albumartist of the song | ||
| 77 | \param year The year of the song | ||
| 78 | \param track The track number of the song | ||
| 79 | \param genre The genre of the song | ||
| 80 | \param comment A comment to attach to the song | ||
| 81 | \param iTrackLength Total track length in seconds | ||
| 82 | \sa IEncoder::Init | ||
| 83 | */ | ||
| 84 | bool (__cdecl* Start) (void* context, int iInChannels, int iInRate, int iInBits, | ||
| 85 | const char* title, const char* artist, | ||
| 86 | const char* albumartist, const char* album, | ||
| 87 | const char* year, const char* track, | ||
| 88 | const char* genre, const char* comment, | ||
| 89 | int iTrackLength); | ||
| 90 | |||
| 91 | /*! \brief Encode a chunk of audio | ||
| 92 | \param context Encoder context from Create. | ||
| 93 | \param nNumBytesRead Number of bytes in input buffer | ||
| 94 | \param pbtStream the input buffer | ||
| 95 | \return Number of bytes consumed | ||
| 96 | \sa IEncoder::Encode | ||
| 97 | */ | ||
| 98 | int (__cdecl* Encode) (void* context, int nNumBytesRead, uint8_t* pbtStream); | ||
| 99 | |||
| 100 | /*! \brief Finalize encoding | ||
| 101 | \param context Encoder context from Create. | ||
| 102 | \return True on success, false on failure. | ||
| 103 | */ | ||
| 104 | bool (__cdecl* Finish) (void* context); | ||
| 105 | |||
| 106 | /*! \brief Free encoder context | ||
| 107 | \param context Encoder context to free. | ||
| 108 | */ | ||
| 109 | void (__cdecl* Free)(void* context); | ||
| 110 | }; | ||
| 111 | } | ||
| 112 | |||
| 113 | #endif | ||
diff --git a/xbmc/addons/include/xbmc_codec_types.h b/xbmc/addons/include/xbmc_codec_types.h new file mode 100644 index 0000000..98003e0 --- /dev/null +++ b/xbmc/addons/include/xbmc_codec_types.h | |||
| @@ -0,0 +1,55 @@ | |||
| 1 | #ifndef __XBMC_CODEC_TYPES_H__ | ||
| 2 | #define __XBMC_CODEC_TYPES_H__ | ||
| 3 | |||
| 4 | /* | ||
| 5 | * Copyright (C) 2005-2013 Team XBMC | ||
| 6 | * http://xbmc.org | ||
| 7 | * | ||
| 8 | * This Program is free software; you can redistribute it and/or modify | ||
| 9 | * it under the terms of the GNU General Public License as published by | ||
| 10 | * the Free Software Foundation; either version 2, or (at your option) | ||
| 11 | * any later version. | ||
| 12 | * | ||
| 13 | * This Program is distributed in the hope that it will be useful, | ||
| 14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| 15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
| 16 | * GNU General Public License for more details. | ||
| 17 | * | ||
| 18 | * You should have received a copy of the GNU General Public License | ||
| 19 | * along with XBMC; see the file COPYING. If not, see | ||
| 20 | * <http://www.gnu.org/licenses/>. | ||
| 21 | * | ||
| 22 | */ | ||
| 23 | |||
| 24 | #ifdef __cplusplus | ||
| 25 | extern "C" { | ||
| 26 | #endif | ||
| 27 | |||
| 28 | typedef unsigned int xbmc_codec_id_t; | ||
| 29 | |||
| 30 | typedef enum | ||
| 31 | { | ||
| 32 | XBMC_CODEC_TYPE_UNKNOWN = -1, | ||
| 33 | XBMC_CODEC_TYPE_VIDEO, | ||
| 34 | XBMC_CODEC_TYPE_AUDIO, | ||
| 35 | XBMC_CODEC_TYPE_DATA, | ||
| 36 | XBMC_CODEC_TYPE_SUBTITLE, | ||
| 37 | XBMC_CODEC_TYPE_RDS, | ||
| 38 | XBMC_CODEC_TYPE_NB | ||
| 39 | } xbmc_codec_type_t; | ||
| 40 | |||
| 41 | typedef struct | ||
| 42 | { | ||
| 43 | xbmc_codec_type_t codec_type; | ||
| 44 | xbmc_codec_id_t codec_id; | ||
| 45 | } xbmc_codec_t; | ||
| 46 | |||
| 47 | #define XBMC_INVALID_CODEC_ID 0 | ||
| 48 | #define XBMC_INVALID_CODEC { XBMC_CODEC_TYPE_UNKNOWN, XBMC_INVALID_CODEC_ID } | ||
| 49 | |||
| 50 | #ifdef __cplusplus | ||
| 51 | }; | ||
| 52 | #endif | ||
| 53 | |||
| 54 | #endif | ||
| 55 | |||
diff --git a/xbmc/addons/include/xbmc_epg_types.h b/xbmc/addons/include/xbmc_epg_types.h new file mode 100644 index 0000000..97cea40 --- /dev/null +++ b/xbmc/addons/include/xbmc_epg_types.h | |||
| @@ -0,0 +1,96 @@ | |||
| 1 | #pragma once | ||
| 2 | /* | ||
| 3 | * Copyright (C) 2005-2013 Team XBMC | ||
| 4 | * http://xbmc.org | ||
| 5 | * | ||
| 6 | * This Program is free software; you can redistribute it and/or modify | ||
| 7 | * it under the terms of the GNU General Public License as published by | ||
| 8 | * the Free Software Foundation; either version 2, or (at your option) | ||
| 9 | * any later version. | ||
| 10 | * | ||
| 11 | * This Program is distributed in the hope that it will be useful, | ||
| 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
| 14 | * GNU General Public License for more details. | ||
| 15 | * | ||
| 16 | * You should have received a copy of the GNU General Public License | ||
| 17 | * along with XBMC; see the file COPYING. If not, see | ||
| 18 | * <http://www.gnu.org/licenses/>. | ||
| 19 | * | ||
| 20 | */ | ||
| 21 | |||
| 22 | #include <string.h> | ||
| 23 | #include <time.h> | ||
| 24 | |||
| 25 | #undef ATTRIBUTE_PACKED | ||
| 26 | #undef PRAGMA_PACK_BEGIN | ||
| 27 | #undef PRAGMA_PACK_END | ||
| 28 | |||
| 29 | #if defined(__GNUC__) | ||
| 30 | #if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 95) | ||
| 31 | #define ATTRIBUTE_PACKED __attribute__ ((packed)) | ||
| 32 | #define PRAGMA_PACK 0 | ||
| 33 | #endif | ||
| 34 | #endif | ||
| 35 | |||
| 36 | #if !defined(ATTRIBUTE_PACKED) | ||
| 37 | #define ATTRIBUTE_PACKED | ||
| 38 | #define PRAGMA_PACK 1 | ||
| 39 | #endif | ||
| 40 | |||
| 41 | /*! @name EPG entry content event types */ | ||
| 42 | //@{ | ||
| 43 | /* These IDs come from the DVB-SI EIT table "content descriptor" | ||
| 44 | * Also known under the name "E-book genre assignments" | ||
| 45 | */ | ||
| 46 | #define EPG_EVENT_CONTENTMASK_UNDEFINED 0x00 | ||
| 47 | #define EPG_EVENT_CONTENTMASK_MOVIEDRAMA 0x10 | ||
| 48 | #define EPG_EVENT_CONTENTMASK_NEWSCURRENTAFFAIRS 0x20 | ||
| 49 | #define EPG_EVENT_CONTENTMASK_SHOW 0x30 | ||
| 50 | #define EPG_EVENT_CONTENTMASK_SPORTS 0x40 | ||
| 51 | #define EPG_EVENT_CONTENTMASK_CHILDRENYOUTH 0x50 | ||
| 52 | #define EPG_EVENT_CONTENTMASK_MUSICBALLETDANCE 0x60 | ||
| 53 | #define EPG_EVENT_CONTENTMASK_ARTSCULTURE 0x70 | ||
| 54 | #define EPG_EVENT_CONTENTMASK_SOCIALPOLITICALECONOMICS 0x80 | ||
| 55 | #define EPG_EVENT_CONTENTMASK_EDUCATIONALSCIENCE 0x90 | ||
| 56 | #define EPG_EVENT_CONTENTMASK_LEISUREHOBBIES 0xA0 | ||
| 57 | #define EPG_EVENT_CONTENTMASK_SPECIAL 0xB0 | ||
| 58 | #define EPG_EVENT_CONTENTMASK_USERDEFINED 0xF0 | ||
| 59 | //@} | ||
| 60 | |||
| 61 | /* Set EPGTAG.iGenreType to EPG_GENRE_USE_STRING to transfer genre strings to XBMC */ | ||
| 62 | #define EPG_GENRE_USE_STRING 0x100 | ||
| 63 | |||
| 64 | #ifdef __cplusplus | ||
| 65 | extern "C" { | ||
| 66 | #endif | ||
| 67 | |||
| 68 | /*! | ||
| 69 | * @brief Representation of an EPG event. | ||
| 70 | */ | ||
| 71 | typedef struct EPG_TAG { | ||
| 72 | unsigned int iUniqueBroadcastId; /*!< @brief (required) identifier for this event */ | ||
| 73 | const char * strTitle; /*!< @brief (required) this event's title */ | ||
| 74 | unsigned int iChannelNumber; /*!< @brief (required) the number of the channel this event occurs on */ | ||
| 75 | time_t startTime; /*!< @brief (required) start time in UTC */ | ||
| 76 | time_t endTime; /*!< @brief (required) end time in UTC */ | ||
| 77 | const char * strPlotOutline; /*!< @brief (optional) plot outline */ | ||
| 78 | const char * strPlot; /*!< @brief (optional) plot */ | ||
| 79 | const char * strIconPath; /*!< @brief (optional) icon path */ | ||
| 80 | int iGenreType; /*!< @brief (optional) genre type */ | ||
| 81 | int iGenreSubType; /*!< @brief (optional) genre sub type */ | ||
| 82 | const char * strGenreDescription; /*!< @brief (optional) genre. Will be used only when iGenreType = EPG_GENRE_USE_STRING */ | ||
| 83 | time_t firstAired; /*!< @brief (optional) first aired in UTC */ | ||
| 84 | int iParentalRating; /*!< @brief (optional) parental rating */ | ||
| 85 | int iStarRating; /*!< @brief (optional) star rating */ | ||
| 86 | bool bNotify; /*!< @brief (optional) notify the user when this event starts */ | ||
| 87 | int iSeriesNumber; /*!< @brief (optional) series number */ | ||
| 88 | int iEpisodeNumber; /*!< @brief (optional) episode number */ | ||
| 89 | int iEpisodePartNumber; /*!< @brief (optional) episode part number */ | ||
| 90 | const char * strEpisodeName; /*!< @brief (optional) episode name */ | ||
| 91 | const char * strRecordingId; /*!< @brief (optional) unique id of the recording on the client which represents this event */ | ||
| 92 | } ATTRIBUTE_PACKED EPG_TAG; | ||
| 93 | |||
| 94 | #ifdef __cplusplus | ||
| 95 | } | ||
| 96 | #endif | ||
diff --git a/xbmc/addons/include/xbmc_pvr_dll.h b/xbmc/addons/include/xbmc_pvr_dll.h new file mode 100644 index 0000000..3ad46fc --- /dev/null +++ b/xbmc/addons/include/xbmc_pvr_dll.h | |||
| @@ -0,0 +1,710 @@ | |||
| 1 | /* | ||
| 2 | * Copyright (C) 2005-2013 Team XBMC | ||
| 3 | * http://xbmc.org | ||
| 4 | * | ||
| 5 | * This Program is free software; you can redistribute it and/or modify | ||
| 6 | * it under the terms of the GNU General Public License as published by | ||
| 7 | * the Free Software Foundation; either version 2, or (at your option) | ||
| 8 | * any later version. | ||
| 9 | * | ||
| 10 | * This Program is distributed in the hope that it will be useful, | ||
| 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
| 13 | * GNU General Public License for more details. | ||
| 14 | * | ||
| 15 | * You should have received a copy of the GNU General Public License | ||
| 16 | * along with XBMC; see the file COPYING. If not, see | ||
| 17 | * <http://www.gnu.org/licenses/>. | ||
| 18 | * | ||
| 19 | */ | ||
| 20 | |||
| 21 | #ifndef __XBMC_PVR_H__ | ||
| 22 | #define __XBMC_PVR_H__ | ||
| 23 | |||
| 24 | #include "xbmc_addon_dll.h" | ||
| 25 | #include "xbmc_pvr_types.h" | ||
| 26 | |||
| 27 | /*! | ||
| 28 | * Functions that the PVR client add-on must implement, but some can be empty. | ||
| 29 | * | ||
| 30 | * The 'remarks' field indicates which methods should be implemented, and which ones are optional. | ||
| 31 | */ | ||
| 32 | |||
| 33 | extern "C" | ||
| 34 | { | ||
| 35 | /*! @name PVR add-on methods */ | ||
| 36 | //@{ | ||
| 37 | /*! | ||
| 38 | * Get the XBMC_PVR_API_VERSION that was used to compile this add-on. | ||
| 39 | * Used to check if this add-on is compatible with XBMC. | ||
| 40 | * @return The XBMC_PVR_API_VERSION that was used to compile this add-on. | ||
| 41 | * @remarks Valid implementation required. | ||
| 42 | */ | ||
| 43 | const char* GetPVRAPIVersion(void); | ||
| 44 | |||
| 45 | /*! | ||
| 46 | * Get the XBMC_PVR_MIN_API_VERSION that was used to compile this add-on. | ||
| 47 | * Used to check if this add-on is compatible with XBMC. | ||
| 48 | * @return The XBMC_PVR_MIN_API_VERSION that was used to compile this add-on. | ||
| 49 | * @remarks Valid implementation required. | ||
| 50 | */ | ||
| 51 | const char* GetMininumPVRAPIVersion(void); | ||
| 52 | |||
| 53 | /*! | ||
| 54 | * Get the XBMC_GUI_API_VERSION that was used to compile this add-on. | ||
| 55 | * Used to check if this add-on is compatible with XBMC. | ||
| 56 | * @return The XBMC_GUI_API_VERSION that was used to compile this add-on. | ||
| 57 | * @remarks Valid implementation required. | ||
| 58 | */ | ||
| 59 | const char* GetGUIAPIVersion(void); | ||
| 60 | |||
| 61 | /*! | ||
| 62 | * Get the XBMC_GUI_MIN_API_VERSION that was used to compile this add-on. | ||
| 63 | * Used to check if this add-on is compatible with XBMC. | ||
| 64 | * @return The XBMC_GUI_MIN_API_VERSION that was used to compile this add-on. | ||
| 65 | * @remarks Valid implementation required. | ||
| 66 | */ | ||
| 67 | const char* GetMininumGUIAPIVersion(void); | ||
| 68 | |||
| 69 | /*! | ||
| 70 | * Get the list of features that this add-on provides. | ||
| 71 | * Called by XBMC to query the add-on's capabilities. | ||
| 72 | * Used to check which options should be presented in the UI, which methods to call, etc. | ||
| 73 | * All capabilities that the add-on supports should be set to true. | ||
| 74 | * @param pCapabilities The add-on's capabilities. | ||
| 75 | * @return PVR_ERROR_NO_ERROR if the properties were fetched successfully. | ||
| 76 | * @remarks Valid implementation required. | ||
| 77 | */ | ||
| 78 | PVR_ERROR GetAddonCapabilities(PVR_ADDON_CAPABILITIES *pCapabilities); | ||
| 79 | |||
| 80 | /*! | ||
| 81 | * @return The name reported by the backend that will be displayed in the UI. | ||
| 82 | * @remarks Valid implementation required. | ||
| 83 | */ | ||
| 84 | const char* GetBackendName(void); | ||
| 85 | |||
| 86 | /*! | ||
| 87 | * @return The version string reported by the backend that will be displayed in the UI. | ||
| 88 | * @remarks Valid implementation required. | ||
| 89 | */ | ||
| 90 | const char* GetBackendVersion(void); | ||
| 91 | |||
| 92 | /*! | ||
| 93 | * @return The connection string reported by the backend that will be displayed in the UI. | ||
| 94 | * @remarks Valid implementation required. | ||
| 95 | */ | ||
| 96 | const char* GetConnectionString(void); | ||
| 97 | |||
| 98 | /*! | ||
| 99 | * Get the disk space reported by the backend (if supported). | ||
| 100 | * @param iTotal The total disk space in bytes. | ||
| 101 | * @param iUsed The used disk space in bytes. | ||
| 102 | * @return PVR_ERROR_NO_ERROR if the drive space has been fetched successfully. | ||
| 103 | * @remarks Optional. Return PVR_ERROR_NOT_IMPLEMENTED if this add-on won't provide this function. | ||
| 104 | */ | ||
| 105 | PVR_ERROR GetDriveSpace(long long* iTotal, long long* iUsed); | ||
| 106 | |||
| 107 | /*! | ||
| 108 | * Call one of the menu hooks (if supported). | ||
| 109 | * Supported PVR_MENUHOOK instances have to be added in ADDON_Create(), by calling AddMenuHook() on the callback. | ||
| 110 | * @param menuhook The hook to call. | ||
| 111 | * @param item The selected item for which the hook was called. | ||
| 112 | * @return PVR_ERROR_NO_ERROR if the hook was called successfully. | ||
| 113 | * @remarks Optional. Return PVR_ERROR_NOT_IMPLEMENTED if this add-on won't provide this function. | ||
| 114 | */ | ||
| 115 | PVR_ERROR CallMenuHook(const PVR_MENUHOOK& menuhook, const PVR_MENUHOOK_DATA &item); | ||
| 116 | //@} | ||
| 117 | |||
| 118 | /*! @name PVR EPG methods | ||
| 119 | * @remarks Only used by XBMC if bSupportsEPG is set to true. | ||
| 120 | */ | ||
| 121 | //@{ | ||
| 122 | /*! | ||
| 123 | * Request the EPG for a channel from the backend. | ||
| 124 | * EPG entries are added to XBMC by calling TransferEpgEntry() on the callback. | ||
| 125 | * @param handle Handle to pass to the callback method. | ||
| 126 | * @param channel The channel to get the EPG table for. | ||
| 127 | * @param iStart Get events after this time (UTC). | ||
| 128 | * @param iEnd Get events before this time (UTC). | ||
| 129 | * @return PVR_ERROR_NO_ERROR if the table has been fetched successfully. | ||
| 130 | * @remarks Required if bSupportsEPG is set to true. Return PVR_ERROR_NOT_IMPLEMENTED if this add-on won't provide this function. | ||
| 131 | */ | ||
| 132 | PVR_ERROR GetEPGForChannel(ADDON_HANDLE handle, const PVR_CHANNEL& channel, time_t iStart, time_t iEnd); | ||
| 133 | //@} | ||
| 134 | |||
| 135 | /*! @name PVR channel group methods | ||
| 136 | * @remarks Only used by XBMC is bSupportsChannelGroups is set to true. | ||
| 137 | * If a group or one of the group members changes after the initial import, or if a new one was added, then the add-on | ||
| 138 | * should call TriggerChannelGroupsUpdate() | ||
| 139 | */ | ||
| 140 | //@{ | ||
| 141 | /*! | ||
| 142 | * Get the total amount of channel groups on the backend if it supports channel groups. | ||
| 143 | * @return The amount of channels, or -1 on error. | ||
| 144 | * @remarks Required if bSupportsChannelGroups is set to true. Return -1 if this add-on won't provide this function. | ||
| 145 | */ | ||
| 146 | int GetChannelGroupsAmount(void); | ||
| 147 | |||
| 148 | /*! | ||
| 149 | * Request the list of all channel groups from the backend if it supports channel groups. | ||
| 150 | * Channel group entries are added to XBMC by calling TransferChannelGroup() on the callback. | ||
| 151 | * @param handle Handle to pass to the callback method. | ||
| 152 | * @param bRadio True to get the radio channel groups, false to get the TV channel groups. | ||
| 153 | * @return PVR_ERROR_NO_ERROR if the list has been fetched successfully. | ||
| 154 | * @remarks Required if bSupportsChannelGroups is set to true. Return PVR_ERROR_NOT_IMPLEMENTED if this add-on won't provide this function. | ||
| 155 | */ | ||
| 156 | PVR_ERROR GetChannelGroups(ADDON_HANDLE handle, bool bRadio); | ||
| 157 | |||
| 158 | /*! | ||
| 159 | * Request the list of all group members of a group from the backend if it supports channel groups. | ||
| 160 | * Member entries are added to XBMC by calling TransferChannelGroupMember() on the callback. | ||
| 161 | * @param handle Handle to pass to the callback method. | ||
| 162 | * @param group The group to get the members for. | ||
| 163 | * @return PVR_ERROR_NO_ERROR if the list has been fetched successfully. | ||
| 164 | * @remarks Required if bSupportsChannelGroups is set to true. Return PVR_ERROR_NOT_IMPLEMENTED if this add-on won't provide this function. | ||
| 165 | */ | ||
| 166 | PVR_ERROR GetChannelGroupMembers(ADDON_HANDLE handle, const PVR_CHANNEL_GROUP& group); | ||
| 167 | //@} | ||
| 168 | |||
| 169 | /** @name PVR channel methods | ||
| 170 | * @remarks Either bSupportsTV or bSupportsRadio is required to be set to true. | ||
| 171 | * If a channel changes after the initial import, or if a new one was added, then the add-on | ||
| 172 | * should call TriggerChannelUpdate() | ||
| 173 | */ | ||
| 174 | //@{ | ||
| 175 | /*! | ||
| 176 | * Show the channel scan dialog if this backend supports it. | ||
| 177 | * @return PVR_ERROR_NO_ERROR if the dialog was displayed successfully. | ||
| 178 | * @remarks Required if bSupportsChannelScan is set to true. Return PVR_ERROR_NOT_IMPLEMENTED if this add-on won't provide this function. | ||
| 179 | * @note see libXBMC_gui.h about related parts | ||
| 180 | */ | ||
| 181 | PVR_ERROR OpenDialogChannelScan(void); | ||
| 182 | |||
| 183 | /*! | ||
| 184 | * @return The total amount of channels on the backend, or -1 on error. | ||
| 185 | * @remarks Valid implementation required. | ||
| 186 | */ | ||
| 187 | int GetChannelsAmount(void); | ||
| 188 | |||
| 189 | /*! | ||
| 190 | * Request the list of all channels from the backend. | ||
| 191 | * Channel entries are added to XBMC by calling TransferChannelEntry() on the callback. | ||
| 192 | * @param handle Handle to pass to the callback method. | ||
| 193 | * @param bRadio True to get the radio channels, false to get the TV channels. | ||
| 194 | * @return PVR_ERROR_NO_ERROR if the list has been fetched successfully. | ||
| 195 | * @remarks If bSupportsTV is set to true, a valid result set needs to be provided for bRadio = false. | ||
| 196 | * If bSupportsRadio is set to true, a valid result set needs to be provided for bRadio = true. | ||
| 197 | * At least one of these two must provide a valid result set. | ||
| 198 | */ | ||
| 199 | PVR_ERROR GetChannels(ADDON_HANDLE handle, bool bRadio); | ||
| 200 | |||
| 201 | /*! | ||
| 202 | * Delete a channel from the backend. | ||
| 203 | * @param channel The channel to delete. | ||
| 204 | * @return PVR_ERROR_NO_ERROR if the channel has been deleted successfully. | ||
| 205 | * @remarks Required if bSupportsChannelSettings is set to true. | ||
| 206 | */ | ||
| 207 | PVR_ERROR DeleteChannel(const PVR_CHANNEL& channel); | ||
| 208 | |||
| 209 | /*! | ||
| 210 | * Rename a channel on the backend. | ||
| 211 | * @param channel The channel to rename, containing the new channel name. | ||
| 212 | * @return PVR_ERROR_NO_ERROR if the channel has been renamed successfully. | ||
| 213 | * @remarks Optional, and only used if bSupportsChannelSettings is set to true. Return PVR_ERROR_NOT_IMPLEMENTED if this add-on won't provide this function. | ||
| 214 | */ | ||
| 215 | PVR_ERROR RenameChannel(const PVR_CHANNEL& channel); | ||
| 216 | |||
| 217 | /*! | ||
| 218 | * Move a channel to another channel number on the backend. | ||
| 219 | * @param channel The channel to move, containing the new channel number. | ||
| 220 | * @return PVR_ERROR_NO_ERROR if the channel has been moved successfully. | ||
| 221 | * @remarks Optional, and only used if bSupportsChannelSettings is set to true. Return PVR_ERROR_NOT_IMPLEMENTED if this add-on won't provide this function. | ||
| 222 | */ | ||
| 223 | PVR_ERROR MoveChannel(const PVR_CHANNEL& channel); | ||
| 224 | |||
| 225 | /*! | ||
| 226 | * Show the channel settings dialog, if supported by the backend. | ||
| 227 | * @param channel The channel to show the dialog for. | ||
| 228 | * @return PVR_ERROR_NO_ERROR if the dialog has been displayed successfully. | ||
| 229 | * @remarks Required if bSupportsChannelSettings is set to true. | ||
| 230 | * @note see libXBMC_gui.h about related parts | ||
| 231 | */ | ||
| 232 | PVR_ERROR OpenDialogChannelSettings(const PVR_CHANNEL& channel); | ||
| 233 | |||
| 234 | /*! | ||
| 235 | * Show the dialog to add a channel on the backend, if supported by the backend. | ||
| 236 | * @param channel The channel to add. | ||
| 237 | * @return PVR_ERROR_NO_ERROR if the channel has been added successfully. | ||
| 238 | * @remarks Required if bSupportsChannelSettings is set to true. | ||
| 239 | * @note see libXBMC_gui.h about related parts | ||
| 240 | */ | ||
| 241 | PVR_ERROR OpenDialogChannelAdd(const PVR_CHANNEL& channel); | ||
| 242 | //@} | ||
| 243 | |||
| 244 | /** @name PVR recording methods | ||
| 245 | * @remarks Only used by XBMC is bSupportsRecordings is set to true. | ||
| 246 | * If a recording changes after the initial import, or if a new one was added, | ||
| 247 | * then the add-on should call TriggerRecordingUpdate() | ||
| 248 | */ | ||
| 249 | //@{ | ||
| 250 | /*! | ||
| 251 | * @return The total amount of recordings on the backend or -1 on error. | ||
| 252 | * @param deleted if set return deleted recording (called if bSupportsRecordingsUndelete set to true) | ||
| 253 | * @remarks Required if bSupportsRecordings is set to true. Return PVR_ERROR_NOT_IMPLEMENTED if this add-on won't provide this function. | ||
| 254 | */ | ||
| 255 | int GetRecordingsAmount(bool deleted); | ||
| 256 | |||
| 257 | /*! | ||
| 258 | * Request the list of all recordings from the backend, if supported. | ||
| 259 | * Recording entries are added to XBMC by calling TransferRecordingEntry() on the callback. | ||
| 260 | * @param handle Handle to pass to the callback method. | ||
| 261 | * @param deleted if set return deleted recording (called if bSupportsRecordingsUndelete set to true) | ||
| 262 | * @return PVR_ERROR_NO_ERROR if the recordings have been fetched successfully. | ||
| 263 | * @remarks Required if bSupportsRecordings is set to true. Return PVR_ERROR_NOT_IMPLEMENTED if this add-on won't provide this function. | ||
| 264 | */ | ||
| 265 | PVR_ERROR GetRecordings(ADDON_HANDLE handle, bool deleted); | ||
| 266 | |||
| 267 | /*! | ||
| 268 | * Delete a recording on the backend. | ||
| 269 | * @param recording The recording to delete. | ||
| 270 | * @return PVR_ERROR_NO_ERROR if the recording has been deleted successfully. | ||
| 271 | * @remarks Optional, and only used if bSupportsRecordings is set to true. Return PVR_ERROR_NOT_IMPLEMENTED if this add-on won't provide this function. | ||
| 272 | */ | ||
| 273 | PVR_ERROR DeleteRecording(const PVR_RECORDING& recording); | ||
| 274 | |||
| 275 | /*! | ||
| 276 | * Undelete a recording on the backend. | ||
| 277 | * @param recording The recording to undelete. | ||
| 278 | * @return PVR_ERROR_NO_ERROR if the recording has been undeleted successfully. | ||
| 279 | * @remarks Optional, and only used if bSupportsRecordingsUndelete is set to true. Return PVR_ERROR_NOT_IMPLEMENTED if this add-on won't provide this function. | ||
| 280 | */ | ||
| 281 | PVR_ERROR UndeleteRecording(const PVR_RECORDING& recording); | ||
| 282 | |||
| 283 | /*! | ||
| 284 | * @brief Delete all recordings permanent which in the deleted folder on the backend. | ||
| 285 | * @return PVR_ERROR_NO_ERROR if the recordings has been deleted successfully. | ||
| 286 | */ | ||
| 287 | PVR_ERROR DeleteAllRecordingsFromTrash(); | ||
| 288 | |||
| 289 | /*! | ||
| 290 | * Rename a recording on the backend. | ||
| 291 | * @param recording The recording to rename, containing the new name. | ||
| 292 | * @return PVR_ERROR_NO_ERROR if the recording has been renamed successfully. | ||
| 293 | * @remarks Optional, and only used if bSupportsRecordings is set to true. Return PVR_ERROR_NOT_IMPLEMENTED if this add-on won't provide this function. | ||
| 294 | */ | ||
| 295 | PVR_ERROR RenameRecording(const PVR_RECORDING& recording); | ||
| 296 | |||
| 297 | /*! | ||
| 298 | * Set the play count of a recording on the backend. | ||
| 299 | * @param recording The recording to change the play count. | ||
| 300 | * @param count Play count. | ||
| 301 | * @return PVR_ERROR_NO_ERROR if the recording's play count has been set successfully. | ||
| 302 | * @remarks Required if bSupportsRecordingPlayCount is set to true. Return PVR_ERROR_NOT_IMPLEMENTED if this add-on won't provide this function. | ||
| 303 | */ | ||
| 304 | PVR_ERROR SetRecordingPlayCount(const PVR_RECORDING& recording, int count); | ||
| 305 | |||
| 306 | /*! | ||
| 307 | * Set the last watched position of a recording on the backend. | ||
| 308 | * @param recording The recording. | ||
| 309 | * @param position The last watched position in seconds | ||
| 310 | * @return PVR_ERROR_NO_ERROR if the position has been stored successfully. | ||
| 311 | * @remarks Required if bSupportsLastPlayedPosition is set to true. Return PVR_ERROR_NOT_IMPLEMENTED if this add-on won't provide this function. | ||
| 312 | */ | ||
| 313 | PVR_ERROR SetRecordingLastPlayedPosition(const PVR_RECORDING& recording, int lastplayedposition); | ||
| 314 | |||
| 315 | /*! | ||
| 316 | * Retrieve the last watched position of a recording on the backend. | ||
| 317 | * @param recording The recording. | ||
| 318 | * @return The last watched position in seconds or -1 on error | ||
| 319 | * @remarks Required if bSupportsRecordingPlayCount is set to true. Return -1 if this add-on won't provide this function. | ||
| 320 | */ | ||
| 321 | int GetRecordingLastPlayedPosition(const PVR_RECORDING& recording); | ||
| 322 | |||
| 323 | /*! | ||
| 324 | * Retrieve the edit decision list (EDL) of a recording on the backend. | ||
| 325 | * @param recording The recording. | ||
| 326 | * @param edl out: The function has to write the EDL list into this array. | ||
| 327 | * @param size in: The maximum size of the EDL, out: the actual size of the EDL. | ||
| 328 | * @return PVR_ERROR_NO_ERROR if the EDL was successfully read. | ||
| 329 | * @remarks Required if bSupportsRecordingEdl is set to true. Return PVR_ERROR_NOT_IMPLEMENTED if this add-on won't provide this function. | ||
| 330 | */ | ||
| 331 | PVR_ERROR GetRecordingEdl(const PVR_RECORDING&, PVR_EDL_ENTRY edl[], int *size); | ||
| 332 | |||
| 333 | //@} | ||
| 334 | /** @name PVR timer methods | ||
| 335 | * @remarks Only used by XBMC is bSupportsTimers is set to true. | ||
| 336 | * If a timer changes after the initial import, or if a new one was added, | ||
| 337 | * then the add-on should call TriggerTimerUpdate() | ||
| 338 | */ | ||
| 339 | //@{ | ||
| 340 | /*! | ||
| 341 | * @return The total amount of timers on the backend or -1 on error. | ||
| 342 | * @remarks Required if bSupportsTimers is set to true. Return -1 if this add-on won't provide this function. | ||
| 343 | */ | ||
| 344 | int GetTimersAmount(void); | ||
| 345 | |||
| 346 | /*! | ||
| 347 | * Request the list of all timers from the backend if supported. | ||
| 348 | * Timer entries are added to XBMC by calling TransferTimerEntry() on the callback. | ||
| 349 | * @param handle Handle to pass to the callback method. | ||
| 350 | * @return PVR_ERROR_NO_ERROR if the list has been fetched successfully. | ||
| 351 | * @remarks Required if bSupportsTimers is set to true. Return PVR_ERROR_NOT_IMPLEMENTED if this add-on won't provide this function. | ||
| 352 | */ | ||
| 353 | PVR_ERROR GetTimers(ADDON_HANDLE handle); | ||
| 354 | |||
| 355 | /*! | ||
| 356 | * Add a timer on the backend. | ||
| 357 | * @param timer The timer to add. | ||
| 358 | * @return PVR_ERROR_NO_ERROR if the timer has been added successfully. | ||
| 359 | * @remarks Required if bSupportsTimers is set to true. Return PVR_ERROR_NOT_IMPLEMENTED if this add-on won't provide this function. | ||
| 360 | */ | ||
| 361 | PVR_ERROR AddTimer(const PVR_TIMER& timer); | ||
| 362 | |||
| 363 | /*! | ||
| 364 | * Delete a timer on the backend. | ||
| 365 | * @param timer The timer to delete. | ||
| 366 | * @param bForceDelete Set to true to delete a timer that is currently recording a program. | ||
| 367 | * @return PVR_ERROR_NO_ERROR if the timer has been deleted successfully. | ||
| 368 | * @remarks Required if bSupportsTimers is set to true. Return PVR_ERROR_NOT_IMPLEMENTED if this add-on won't provide this function. | ||
| 369 | */ | ||
| 370 | PVR_ERROR DeleteTimer(const PVR_TIMER& timer, bool bForceDelete); | ||
| 371 | |||
| 372 | /*! | ||
| 373 | * Update the timer information on the backend. | ||
| 374 | * @param timer The timer to update. | ||
| 375 | * @return PVR_ERROR_NO_ERROR if the timer has been updated successfully. | ||
| 376 | * @remarks Required if bSupportsTimers is set to true. Return PVR_ERROR_NOT_IMPLEMENTED if this add-on won't provide this function. | ||
| 377 | */ | ||
| 378 | PVR_ERROR UpdateTimer(const PVR_TIMER& timer); | ||
| 379 | |||
| 380 | //@} | ||
| 381 | |||
| 382 | /** @name PVR live stream methods, used to open and close a stream to a channel, and optionally perform read operations on the stream */ | ||
| 383 | //@{ | ||
| 384 | /*! | ||
| 385 | * Open a live stream on the backend. | ||
| 386 | * @param channel The channel to stream. | ||
| 387 | * @return True if the stream has been opened successfully, false otherwise. | ||
| 388 | * @remarks Required if bHandlesInputStream or bHandlesDemuxing is set to true. Return false if this add-on won't provide this function. | ||
| 389 | */ | ||
| 390 | bool OpenLiveStream(const PVR_CHANNEL& channel); | ||
| 391 | |||
| 392 | /*! | ||
| 393 | * Close an open live stream. | ||
| 394 | * @remarks Required if bHandlesInputStream or bHandlesDemuxing is set to true. | ||
| 395 | */ | ||
| 396 | void CloseLiveStream(void); | ||
| 397 | |||
| 398 | /*! | ||
| 399 | * Read from an open live stream. | ||
| 400 | * @param pBuffer The buffer to store the data in. | ||
| 401 | * @param iBufferSize The amount of bytes to read. | ||
| 402 | * @return The amount of bytes that were actually read from the stream. | ||
| 403 | * @remarks Required if bHandlesInputStream is set to true. Return -1 if this add-on won't provide this function. | ||
| 404 | */ | ||
| 405 | int ReadLiveStream(unsigned char* pBuffer, unsigned int iBufferSize); | ||
| 406 | |||
| 407 | /*! | ||
| 408 | * Seek in a live stream on a backend that supports timeshifting. | ||
| 409 | * @param iPosition The position to seek to. | ||
| 410 | * @param iWhence ? | ||
| 411 | * @return The new position. | ||
| 412 | * @remarks Optional, and only used if bHandlesInputStream is set to true. Return -1 if this add-on won't provide this function. | ||
| 413 | */ | ||
| 414 | long long SeekLiveStream(long long iPosition, int iWhence = SEEK_SET); | ||
| 415 | |||
| 416 | /*! | ||
| 417 | * @return The position in the stream that's currently being read. | ||
| 418 | * @remarks Optional, and only used if bHandlesInputStream is set to true. Return -1 if this add-on won't provide this function. | ||
| 419 | */ | ||
| 420 | long long PositionLiveStream(void); | ||
| 421 | |||
| 422 | /*! | ||
| 423 | * @return The total length of the stream that's currently being read. | ||
| 424 | * @remarks Optional, and only used if bHandlesInputStream is set to true. Return -1 if this add-on won't provide this function. | ||
| 425 | */ | ||
| 426 | long long LengthLiveStream(void); | ||
| 427 | |||
| 428 | /*! | ||
| 429 | * @return The channel number on the backend of the live stream that's currently being read. | ||
| 430 | * @remarks Required if bHandlesInputStream or bHandlesDemuxing is set to true. Return -1 if this add-on won't provide this function. | ||
| 431 | */ | ||
| 432 | int GetCurrentClientChannel(void); | ||
| 433 | |||
| 434 | /*! | ||
| 435 | * Switch to another channel. Only to be called when a live stream has already been opened. | ||
| 436 | * @param channel The channel to switch to. | ||
| 437 | * @return True if the switch was successful, false otherwise. | ||
| 438 | * @remarks Required if bHandlesInputStream or bHandlesDemuxing is set to true. Return false if this add-on won't provide this function. | ||
| 439 | */ | ||
| 440 | bool SwitchChannel(const PVR_CHANNEL& channel); | ||
| 441 | |||
| 442 | /*! | ||
| 443 | * Get the signal status of the stream that's currently open. | ||
| 444 | * @param signalStatus The signal status. | ||
| 445 | * @return True if the signal status has been read successfully, false otherwise. | ||
| 446 | * @remarks Optional, and only used if bHandlesInputStream or bHandlesDemuxing is set to true. Return PVR_ERROR_NOT_IMPLEMENTED if this add-on won't provide this function. | ||
| 447 | */ | ||
| 448 | PVR_ERROR SignalStatus(PVR_SIGNAL_STATUS& signalStatus); | ||
| 449 | |||
| 450 | /*! | ||
| 451 | * Get the stream URL for a channel from the backend. Used by the MediaPortal add-on. | ||
| 452 | * @param channel The channel to get the stream URL for. | ||
| 453 | * @return The requested URL. | ||
| 454 | * @remarks Optional, and only used if bHandlesInputStream is set to true. Return NULL if this add-on won't provide this function. | ||
| 455 | */ | ||
| 456 | const char* GetLiveStreamURL(const PVR_CHANNEL& channel); | ||
| 457 | |||
| 458 | /*! | ||
| 459 | * Get the stream properties of the stream that's currently being read. | ||
| 460 | * @param pProperties The properties of the currently playing stream. | ||
| 461 | * @return PVR_ERROR_NO_ERROR if the properties have been fetched successfully. | ||
| 462 | * @remarks Required if bHandlesInputStream or bHandlesDemuxing is set to true. Return PVR_ERROR_NOT_IMPLEMENTED if this add-on won't provide this function. | ||
| 463 | */ | ||
| 464 | PVR_ERROR GetStreamProperties(PVR_STREAM_PROPERTIES* pProperties); | ||
| 465 | //@} | ||
| 466 | |||
| 467 | /** @name PVR recording stream methods, used to open and close a stream to a recording, and perform read operations on the stream. | ||
| 468 | * @remarks This will only be used if the backend doesn't provide a direct URL in the recording tag. | ||
| 469 | */ | ||
| 470 | //@{ | ||
| 471 | /*! | ||
| 472 | * Open a stream to a recording on the backend. | ||
| 473 | * @param recording The recording to open. | ||
| 474 | * @return True if the stream has been opened successfully, false otherwise. | ||
| 475 | * @remarks Optional, and only used if bSupportsRecordings is set to true. Return false if this add-on won't provide this function. | ||
| 476 | */ | ||
| 477 | bool OpenRecordedStream(const PVR_RECORDING& recording); | ||
| 478 | |||
| 479 | /*! | ||
| 480 | * Close an open stream from a recording. | ||
| 481 | * @remarks Optional, and only used if bSupportsRecordings is set to true. | ||
| 482 | */ | ||
| 483 | void CloseRecordedStream(void); | ||
| 484 | |||
| 485 | /*! | ||
| 486 | * Read from a recording. | ||
| 487 | * @param pBuffer The buffer to store the data in. | ||
| 488 | * @param iBufferSize The amount of bytes to read. | ||
| 489 | * @return The amount of bytes that were actually read from the stream. | ||
| 490 | * @remarks Optional, and only used if bSupportsRecordings is set to true, but required if OpenRecordedStream() is implemented. Return -1 if this add-on won't provide this function. | ||
| 491 | */ | ||
| 492 | int ReadRecordedStream(unsigned char* pBuffer, unsigned int iBufferSize); | ||
| 493 | |||
| 494 | /*! | ||
| 495 | * Seek in a recorded stream. | ||
| 496 | * @param iPosition The position to seek to. | ||
| 497 | * @param iWhence ? | ||
| 498 | * @return The new position. | ||
| 499 | * @remarks Optional, and only used if bSupportsRecordings is set to true. Return -1 if this add-on won't provide this function. | ||
| 500 | */ | ||
| 501 | long long SeekRecordedStream(long long iPosition, int iWhence = SEEK_SET); | ||
| 502 | |||
| 503 | /*! | ||
| 504 | * @return The position in the stream that's currently being read. | ||
| 505 | * @remarks Optional, and only used if bSupportsRecordings is set to true. Return -1 if this add-on won't provide this function. | ||
| 506 | */ | ||
| 507 | long long PositionRecordedStream(void); | ||
| 508 | |||
| 509 | /*! | ||
| 510 | * @return The total length of the stream that's currently being read. | ||
| 511 | * @remarks Optional, and only used if bSupportsRecordings is set to true. Return -1 if this add-on won't provide this function. | ||
| 512 | */ | ||
| 513 | long long LengthRecordedStream(void); | ||
| 514 | //@} | ||
| 515 | |||
| 516 | /** @name PVR demultiplexer methods | ||
| 517 | * @remarks Only used by XBMC is bHandlesDemuxing is set to true. | ||
| 518 | */ | ||
| 519 | //@{ | ||
| 520 | /*! | ||
| 521 | * Reset the demultiplexer in the add-on. | ||
| 522 | * @remarks Required if bHandlesDemuxing is set to true. | ||
| 523 | */ | ||
| 524 | void DemuxReset(void); | ||
| 525 | |||
| 526 | /*! | ||
| 527 | * Abort the demultiplexer thread in the add-on. | ||
| 528 | * @remarks Required if bHandlesDemuxing is set to true. | ||
| 529 | */ | ||
| 530 | void DemuxAbort(void); | ||
| 531 | |||
| 532 | /*! | ||
| 533 | * Flush all data that's currently in the demultiplexer buffer in the add-on. | ||
| 534 | * @remarks Required if bHandlesDemuxing is set to true. | ||
| 535 | */ | ||
| 536 | void DemuxFlush(void); | ||
| 537 | |||
| 538 | /*! | ||
| 539 | * Read the next packet from the demultiplexer, if there is one. | ||
| 540 | * @return The next packet. | ||
| 541 | * If there is no next packet, then the add-on should return the | ||
| 542 | * packet created by calling AllocateDemuxPacket(0) on the callback. | ||
| 543 | * If the stream changed and XBMC's player needs to be reinitialised, | ||
| 544 | * then, the add-on should call AllocateDemuxPacket(0) on the | ||
| 545 | * callback, and set the streamid to DMX_SPECIALID_STREAMCHANGE and | ||
| 546 | * return the value. | ||
| 547 | * The add-on should return NULL if an error occured. | ||
| 548 | * @remarks Required if bHandlesDemuxing is set to true. Return NULL if this add-on won't provide this function. | ||
| 549 | */ | ||
| 550 | DemuxPacket* DemuxRead(void); | ||
| 551 | //@} | ||
| 552 | |||
| 553 | /*! | ||
| 554 | * Delay to use when using switching channels for add-ons not providing an input stream. | ||
| 555 | * If the add-on does provide an input stream, then this method will not be called. | ||
| 556 | * Those add-ons can do that in OpenLiveStream() if needed. | ||
| 557 | * @return The delay in milliseconds. | ||
| 558 | */ | ||
| 559 | unsigned int GetChannelSwitchDelay(void); | ||
| 560 | |||
| 561 | /*! | ||
| 562 | * Check if the backend support pausing the currently playing stream | ||
| 563 | * This will enable/disable the pause button in XBMC based on the return value | ||
| 564 | * @return false if the PVR addon/backend does not support pausing, true if possible | ||
| 565 | */ | ||
| 566 | bool CanPauseStream(); | ||
| 567 | |||
| 568 | /*! | ||
| 569 | * Check if the backend supports seeking for the currently playing stream | ||
| 570 | * This will enable/disable the rewind/forward buttons in XBMC based on the return value | ||
| 571 | * @return false if the PVR addon/backend does not support seeking, true if possible | ||
| 572 | */ | ||
| 573 | bool CanSeekStream(); | ||
| 574 | |||
| 575 | /*! | ||
| 576 | * @brief Notify the pvr addon that XBMC (un)paused the currently playing stream | ||
| 577 | */ | ||
| 578 | void PauseStream(bool bPaused); | ||
| 579 | |||
| 580 | /*! | ||
| 581 | * Notify the pvr addon/demuxer that XBMC wishes to seek the stream by time | ||
| 582 | * @param time The absolute time since stream start | ||
| 583 | * @param backwards True to seek to keyframe BEFORE time, else AFTER | ||
| 584 | * @param startpts can be updated to point to where display should start | ||
| 585 | * @return True if the seek operation was possible | ||
| 586 | * @remarks Optional, and only used if addon has its own demuxer. Return False if this add-on won't provide this function. | ||
| 587 | */ | ||
| 588 | bool SeekTime(int time, bool backwards, double *startpts); | ||
| 589 | |||
| 590 | /*! | ||
| 591 | * Notify the pvr addon/demuxer that XBMC wishes to change playback speed | ||
| 592 | * @param speed The requested playback speed | ||
| 593 | * @remarks Optional, and only used if addon has its own demuxer. | ||
| 594 | */ | ||
| 595 | void SetSpeed(int speed); | ||
| 596 | |||
| 597 | /*! | ||
| 598 | * Get actual playing time from addon. With timeshift enabled this is | ||
| 599 | * different to live. | ||
| 600 | * @return time as UTC | ||
| 601 | */ | ||
| 602 | time_t GetPlayingTime(); | ||
| 603 | |||
| 604 | /*! | ||
| 605 | * Get time of oldest packet in timeshift buffer | ||
| 606 | * @return time as UTC | ||
| 607 | */ | ||
| 608 | time_t GetBufferTimeStart(); | ||
| 609 | |||
| 610 | /*! | ||
| 611 | * Get time of latest packet in timeshift buffer | ||
| 612 | * @return time as UTC | ||
| 613 | */ | ||
| 614 | time_t GetBufferTimeEnd(); | ||
| 615 | |||
| 616 | /*! | ||
| 617 | * Get the hostname of the pvr backend server | ||
| 618 | * @return hostname as ip address or alias. If backend does not | ||
| 619 | * utilize a server, return empty string. | ||
| 620 | */ | ||
| 621 | const char* GetBackendHostname(); | ||
| 622 | |||
| 623 | /*! | ||
| 624 | * Called by XBMC to assign the function pointers of this add-on to pClient. | ||
| 625 | * @param pClient The struct to assign the function pointers to. | ||
| 626 | */ | ||
| 627 | void __declspec(dllexport) get_addon(struct PVRClient* pClient) | ||
| 628 | { | ||
| 629 | pClient->GetPVRAPIVersion = GetPVRAPIVersion; | ||
| 630 | pClient->GetMininumPVRAPIVersion = GetMininumPVRAPIVersion; | ||
| 631 | pClient->GetGUIAPIVersion = GetGUIAPIVersion; | ||
| 632 | pClient->GetMininumGUIAPIVersion = GetMininumGUIAPIVersion; | ||
| 633 | pClient->GetAddonCapabilities = GetAddonCapabilities; | ||
| 634 | pClient->GetStreamProperties = GetStreamProperties; | ||
| 635 | pClient->GetConnectionString = GetConnectionString; | ||
| 636 | pClient->GetBackendName = GetBackendName; | ||
| 637 | pClient->GetBackendVersion = GetBackendVersion; | ||
| 638 | pClient->GetDriveSpace = GetDriveSpace; | ||
| 639 | pClient->OpenDialogChannelScan = OpenDialogChannelScan; | ||
| 640 | pClient->MenuHook = CallMenuHook; | ||
| 641 | |||
| 642 | pClient->GetEpg = GetEPGForChannel; | ||
| 643 | |||
| 644 | pClient->GetChannelGroupsAmount = GetChannelGroupsAmount; | ||
| 645 | pClient->GetChannelGroups = GetChannelGroups; | ||
| 646 | pClient->GetChannelGroupMembers = GetChannelGroupMembers; | ||
| 647 | |||
| 648 | pClient->GetChannelsAmount = GetChannelsAmount; | ||
| 649 | pClient->GetChannels = GetChannels; | ||
| 650 | pClient->DeleteChannel = DeleteChannel; | ||
| 651 | pClient->RenameChannel = RenameChannel; | ||
| 652 | pClient->MoveChannel = MoveChannel; | ||
| 653 | pClient->OpenDialogChannelSettings = OpenDialogChannelSettings; | ||
| 654 | pClient->OpenDialogChannelAdd = OpenDialogChannelAdd; | ||
| 655 | |||
| 656 | pClient->GetRecordingsAmount = GetRecordingsAmount; | ||
| 657 | pClient->GetRecordings = GetRecordings; | ||
| 658 | pClient->DeleteRecording = DeleteRecording; | ||
| 659 | pClient->UndeleteRecording = UndeleteRecording; | ||
| 660 | pClient->DeleteAllRecordingsFromTrash = DeleteAllRecordingsFromTrash; | ||
| 661 | pClient->RenameRecording = RenameRecording; | ||
| 662 | pClient->SetRecordingPlayCount = SetRecordingPlayCount; | ||
| 663 | pClient->SetRecordingLastPlayedPosition = SetRecordingLastPlayedPosition; | ||
| 664 | pClient->GetRecordingLastPlayedPosition = GetRecordingLastPlayedPosition; | ||
| 665 | pClient->GetRecordingEdl = GetRecordingEdl; | ||
| 666 | |||
| 667 | pClient->GetTimersAmount = GetTimersAmount; | ||
| 668 | pClient->GetTimers = GetTimers; | ||
| 669 | pClient->AddTimer = AddTimer; | ||
| 670 | pClient->DeleteTimer = DeleteTimer; | ||
| 671 | pClient->UpdateTimer = UpdateTimer; | ||
| 672 | |||
| 673 | pClient->OpenLiveStream = OpenLiveStream; | ||
| 674 | pClient->CloseLiveStream = CloseLiveStream; | ||
| 675 | pClient->ReadLiveStream = ReadLiveStream; | ||
| 676 | pClient->SeekLiveStream = SeekLiveStream; | ||
| 677 | pClient->PositionLiveStream = PositionLiveStream; | ||
| 678 | pClient->LengthLiveStream = LengthLiveStream; | ||
| 679 | pClient->GetCurrentClientChannel = GetCurrentClientChannel; | ||
| 680 | pClient->SwitchChannel = SwitchChannel; | ||
| 681 | pClient->SignalStatus = SignalStatus; | ||
| 682 | pClient->GetLiveStreamURL = GetLiveStreamURL; | ||
| 683 | pClient->GetChannelSwitchDelay = GetChannelSwitchDelay; | ||
| 684 | pClient->CanPauseStream = CanPauseStream; | ||
| 685 | pClient->PauseStream = PauseStream; | ||
| 686 | pClient->CanSeekStream = CanSeekStream; | ||
| 687 | pClient->SeekTime = SeekTime; | ||
| 688 | pClient->SetSpeed = SetSpeed; | ||
| 689 | |||
| 690 | pClient->OpenRecordedStream = OpenRecordedStream; | ||
| 691 | pClient->CloseRecordedStream = CloseRecordedStream; | ||
| 692 | pClient->ReadRecordedStream = ReadRecordedStream; | ||
| 693 | pClient->SeekRecordedStream = SeekRecordedStream; | ||
| 694 | pClient->PositionRecordedStream = PositionRecordedStream; | ||
| 695 | pClient->LengthRecordedStream = LengthRecordedStream; | ||
| 696 | |||
| 697 | pClient->DemuxReset = DemuxReset; | ||
| 698 | pClient->DemuxAbort = DemuxAbort; | ||
| 699 | pClient->DemuxFlush = DemuxFlush; | ||
| 700 | pClient->DemuxRead = DemuxRead; | ||
| 701 | |||
| 702 | pClient->GetPlayingTime = GetPlayingTime; | ||
| 703 | pClient->GetBufferTimeStart = GetBufferTimeStart; | ||
| 704 | pClient->GetBufferTimeEnd = GetBufferTimeEnd; | ||
| 705 | |||
| 706 | pClient->GetBackendHostname = GetBackendHostname; | ||
| 707 | }; | ||
| 708 | }; | ||
| 709 | |||
| 710 | #endif | ||
diff --git a/xbmc/addons/include/xbmc_pvr_types.h b/xbmc/addons/include/xbmc_pvr_types.h new file mode 100644 index 0000000..5285bd1 --- /dev/null +++ b/xbmc/addons/include/xbmc_pvr_types.h | |||
| @@ -0,0 +1,415 @@ | |||
| 1 | #pragma once | ||
| 2 | /* | ||
| 3 | * Copyright (C) 2005-2013 Team XBMC | ||
| 4 | * http://xbmc.org | ||
| 5 | * | ||
| 6 | * This Program is free software; you can redistribute it and/or modify | ||
| 7 | * it under the terms of the GNU General Public License as published by | ||
| 8 | * the Free Software Foundation; either version 2, or (at your option) | ||
| 9 | * any later version. | ||
| 10 | * | ||
| 11 | * This Program is distributed in the hope that it will be useful, | ||
| 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
| 14 | * GNU General Public License for more details. | ||
| 15 | * | ||
| 16 | * You should have received a copy of the GNU General Public License | ||
| 17 | * along with XBMC; see the file COPYING. If not, see | ||
| 18 | * <http://www.gnu.org/licenses/>. | ||
| 19 | * | ||
| 20 | */ | ||
| 21 | |||
| 22 | #ifndef __PVRCLIENT_TYPES_H__ | ||
| 23 | #define __PVRCLIENT_TYPES_H__ | ||
| 24 | |||
| 25 | #ifdef TARGET_WINDOWS | ||
| 26 | #include <windows.h> | ||
| 27 | #else | ||
| 28 | #ifndef __cdecl | ||
| 29 | #define __cdecl | ||
| 30 | #endif | ||
| 31 | #ifndef __declspec | ||
| 32 | #define __declspec(X) | ||
| 33 | #endif | ||
| 34 | #endif | ||
| 35 | #include <string.h> | ||
| 36 | #include <stdint.h> | ||
| 37 | |||
| 38 | #include "xbmc_addon_types.h" | ||
| 39 | #include "xbmc_epg_types.h" | ||
| 40 | #include "xbmc_codec_types.h" | ||
| 41 | |||
| 42 | /*! @note Define "USE_DEMUX" at compile time if demuxing in the PVR add-on is used. | ||
| 43 | * Also XBMC's "DVDDemuxPacket.h" file must be in the include path of the add-on, | ||
| 44 | * and the add-on should set bHandlesDemuxing to true. | ||
| 45 | */ | ||
| 46 | #ifdef USE_DEMUX | ||
| 47 | #include "DVDDemuxPacket.h" | ||
| 48 | #else | ||
| 49 | struct DemuxPacket; | ||
| 50 | #endif | ||
| 51 | |||
| 52 | #undef ATTRIBUTE_PACKED | ||
| 53 | #undef PRAGMA_PACK_BEGIN | ||
| 54 | #undef PRAGMA_PACK_END | ||
| 55 | |||
| 56 | #if defined(__GNUC__) | ||
| 57 | #if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 95) | ||
| 58 | #define ATTRIBUTE_PACKED __attribute__ ((packed)) | ||
| 59 | #define PRAGMA_PACK 0 | ||
| 60 | #endif | ||
| 61 | #endif | ||
| 62 | |||
| 63 | #if !defined(ATTRIBUTE_PACKED) | ||
| 64 | #define ATTRIBUTE_PACKED | ||
| 65 | #define PRAGMA_PACK 1 | ||
| 66 | #endif | ||
| 67 | |||
| 68 | #define PVR_ADDON_NAME_STRING_LENGTH 1024 | ||
| 69 | #define PVR_ADDON_URL_STRING_LENGTH 1024 | ||
| 70 | #define PVR_ADDON_DESC_STRING_LENGTH 1024 | ||
| 71 | #define PVR_ADDON_INPUT_FORMAT_STRING_LENGTH 32 | ||
| 72 | #define PVR_ADDON_EDL_LENGTH 32 | ||
| 73 | |||
| 74 | /* using the default avformat's MAX_STREAMS value to be safe */ | ||
| 75 | #define PVR_STREAM_MAX_STREAMS 20 | ||
| 76 | |||
| 77 | /* current PVR API version */ | ||
| 78 | #define XBMC_PVR_API_VERSION "1.9.4" | ||
| 79 | |||
| 80 | /* min. PVR API version */ | ||
| 81 | #define XBMC_PVR_MIN_API_VERSION "1.9.4" | ||
| 82 | |||
| 83 | #ifdef __cplusplus | ||
| 84 | extern "C" { | ||
| 85 | #endif | ||
| 86 | |||
| 87 | /*! | ||
| 88 | * @brief PVR add-on error codes | ||
| 89 | */ | ||
| 90 | typedef enum | ||
| 91 | { | ||
| 92 | PVR_ERROR_NO_ERROR = 0, /*!< @brief no error occurred */ | ||
| 93 | PVR_ERROR_UNKNOWN = -1, /*!< @brief an unknown error occurred */ | ||
| 94 | PVR_ERROR_NOT_IMPLEMENTED = -2, /*!< @brief the method that XBMC called is not implemented by the add-on */ | ||
| 95 | PVR_ERROR_SERVER_ERROR = -3, /*!< @brief the backend reported an error, or the add-on isn't connected */ | ||
| 96 | PVR_ERROR_SERVER_TIMEOUT = -4, /*!< @brief the command was sent to the backend, but the response timed out */ | ||
| 97 | PVR_ERROR_REJECTED = -5, /*!< @brief the command was rejected by the backend */ | ||
| 98 | PVR_ERROR_ALREADY_PRESENT = -6, /*!< @brief the requested item can not be added, because it's already present */ | ||
| 99 | PVR_ERROR_INVALID_PARAMETERS = -7, /*!< @brief the parameters of the method that was called are invalid for this operation */ | ||
| 100 | PVR_ERROR_RECORDING_RUNNING = -8, /*!< @brief a recording is running, so the timer can't be deleted without doing a forced delete */ | ||
| 101 | PVR_ERROR_FAILED = -9, /*!< @brief the command failed */ | ||
| 102 | } PVR_ERROR; | ||
| 103 | |||
| 104 | /*! | ||
| 105 | * @brief PVR timer states | ||
| 106 | */ | ||
| 107 | typedef enum | ||
| 108 | { | ||
| 109 | PVR_TIMER_STATE_NEW = 0, /*!< @brief a new, unsaved timer */ | ||
| 110 | PVR_TIMER_STATE_SCHEDULED = 1, /*!< @brief the timer is scheduled for recording */ | ||
| 111 | PVR_TIMER_STATE_RECORDING = 2, /*!< @brief the timer is currently recordings */ | ||
| 112 | PVR_TIMER_STATE_COMPLETED = 3, /*!< @brief the recording completed successfully */ | ||
| 113 | PVR_TIMER_STATE_ABORTED = 4, /*!< @brief recording started, but was aborted */ | ||
| 114 | PVR_TIMER_STATE_CANCELLED = 5, /*!< @brief the timer was scheduled, but was canceled */ | ||
| 115 | PVR_TIMER_STATE_CONFLICT_OK = 6, /*!< @brief the scheduled timer conflicts with another one, but will be recorded */ | ||
| 116 | PVR_TIMER_STATE_CONFLICT_NOK = 7, /*!< @brief the scheduled timer conflicts with another one and won't be recorded */ | ||
| 117 | PVR_TIMER_STATE_ERROR = 8 /*!< @brief the timer is scheduled, but can't be recorded for some reason */ | ||
| 118 | } PVR_TIMER_STATE; | ||
| 119 | |||
| 120 | /*! | ||
| 121 | * @brief PVR menu hook categories | ||
| 122 | */ | ||
| 123 | typedef enum | ||
| 124 | { | ||
| 125 | PVR_MENUHOOK_UNKNOWN =-1, /*!< @brief unknown menu hook */ | ||
| 126 | PVR_MENUHOOK_ALL = 0, /*!< @brief all categories */ | ||
| 127 | PVR_MENUHOOK_CHANNEL = 1, /*!< @brief for channels */ | ||
| 128 | PVR_MENUHOOK_TIMER = 2, /*!< @brief for timers */ | ||
| 129 | PVR_MENUHOOK_EPG = 3, /*!< @brief for EPG */ | ||
| 130 | PVR_MENUHOOK_RECORDING = 4, /*!< @brief for recordings */ | ||
| 131 | PVR_MENUHOOK_DELETED_RECORDING = 5, /*!< @brief for deleted recordings */ | ||
| 132 | PVR_MENUHOOK_SETTING = 6, /*!< @brief for settings */ | ||
| 133 | } PVR_MENUHOOK_CAT; | ||
| 134 | |||
| 135 | /*! | ||
| 136 | * @brief Properties passed to the Create() method of an add-on. | ||
| 137 | */ | ||
| 138 | typedef struct PVR_PROPERTIES | ||
| 139 | { | ||
| 140 | const char* strUserPath; /*!< @brief path to the user profile */ | ||
| 141 | const char* strClientPath; /*!< @brief path to this add-on */ | ||
| 142 | } PVR_PROPERTIES; | ||
| 143 | |||
| 144 | /*! | ||
| 145 | * @brief PVR add-on capabilities. All capabilities are set to "false" as default. | ||
| 146 | * If a capabilty is set to true, then the corresponding methods from xbmc_pvr_dll.h need to be implemented. | ||
| 147 | */ | ||
| 148 | typedef struct PVR_ADDON_CAPABILITIES | ||
| 149 | { | ||
| 150 | bool bSupportsEPG; /*!< @brief true if the add-on provides EPG information */ | ||
| 151 | bool bSupportsTV; /*!< @brief true if this add-on provides TV channels */ | ||
| 152 | bool bSupportsRadio; /*!< @brief true if this add-on supports radio channels */ | ||
| 153 | bool bSupportsRecordings; /*!< @brief true if this add-on supports playback of recordings stored on the backend */ | ||
| 154 | bool bSupportsRecordingsUndelete; /*!< @brief true if this add-on supports undelete of recordings stored on the backend */ | ||
| 155 | bool bSupportsTimers; /*!< @brief true if this add-on supports the creation and editing of timers */ | ||
| 156 | bool bSupportsChannelGroups; /*!< @brief true if this add-on supports channel groups */ | ||
| 157 | bool bSupportsChannelScan; /*!< @brief true if this add-on support scanning for new channels on the backend */ | ||
| 158 | bool bSupportsChannelSettings; /*!< @brief true if this add-on supports the following functions: DeleteChannel, RenameChannel, MoveChannel, DialogChannelSettings and DialogAddChannel */ | ||
| 159 | bool bHandlesInputStream; /*!< @brief true if this add-on provides an input stream. false if XBMC handles the stream. */ | ||
| 160 | bool bHandlesDemuxing; /*!< @brief true if this add-on demultiplexes packets. */ | ||
| 161 | bool bSupportsRecordingFolders; /*!< @brief true if the backend supports timers / recordings in folders. */ | ||
| 162 | bool bSupportsRecordingPlayCount; /*!< @brief true if the backend supports play count for recordings. */ | ||
| 163 | bool bSupportsLastPlayedPosition; /*!< @brief true if the backend supports store/retrieve of last played position for recordings. */ | ||
| 164 | bool bSupportsRecordingEdl; /*!< @brief true if the backend supports retrieving an edit decision list for recordings. */ | ||
| 165 | } ATTRIBUTE_PACKED PVR_ADDON_CAPABILITIES; | ||
| 166 | |||
| 167 | /*! | ||
| 168 | * @brief PVR stream properties | ||
| 169 | */ | ||
| 170 | typedef struct PVR_STREAM_PROPERTIES | ||
| 171 | { | ||
| 172 | unsigned int iStreamCount; | ||
| 173 | struct PVR_STREAM | ||
| 174 | { | ||
| 175 | unsigned int iPhysicalId; /*!< @brief (required) physical index */ | ||
| 176 | xbmc_codec_type_t iCodecType; /*!< @brief (required) codec type this stream */ | ||
| 177 | xbmc_codec_id_t iCodecId; /*!< @brief (required) codec id of this stream */ | ||
| 178 | char strLanguage[4]; /*!< @brief (required) language id */ | ||
| 179 | int iIdentifier; /*!< @brief (required) stream id */ | ||
| 180 | int iFPSScale; /*!< @brief (required) scale of 1000 and a rate of 29970 will result in 29.97 fps */ | ||
| 181 | int iFPSRate; /*!< @brief (required) FPS rate */ | ||
| 182 | int iHeight; /*!< @brief (required) height of the stream reported by the demuxer */ | ||
| 183 | int iWidth; /*!< @brief (required) width of the stream reported by the demuxer */ | ||
| 184 | float fAspect; /*!< @brief (required) display aspect ratio of the stream */ | ||
| 185 | int iChannels; /*!< @brief (required) amount of channels */ | ||
| 186 | int iSampleRate; /*!< @brief (required) sample rate */ | ||
| 187 | int iBlockAlign; /*!< @brief (required) block alignment */ | ||
| 188 | int iBitRate; /*!< @brief (required) bit rate */ | ||
| 189 | int iBitsPerSample; /*!< @brief (required) bits per sample */ | ||
| 190 | } stream[PVR_STREAM_MAX_STREAMS]; /*!< @brief (required) the streams */ | ||
| 191 | } ATTRIBUTE_PACKED PVR_STREAM_PROPERTIES; | ||
| 192 | |||
| 193 | /*! | ||
| 194 | * @brief Signal status information | ||
| 195 | */ | ||
| 196 | typedef struct PVR_SIGNAL_STATUS | ||
| 197 | { | ||
| 198 | char strAdapterName[PVR_ADDON_NAME_STRING_LENGTH]; /*!< @brief (optional) name of the adapter that's being used */ | ||
| 199 | char strAdapterStatus[PVR_ADDON_NAME_STRING_LENGTH]; /*!< @brief (optional) status of the adapter that's being used */ | ||
| 200 | char strServiceName[PVR_ADDON_NAME_STRING_LENGTH]; /*!< @brief (optional) name of the current service */ | ||
| 201 | char strProviderName[PVR_ADDON_NAME_STRING_LENGTH]; /*!< @brief (optional) name of the current service's provider */ | ||
| 202 | char strMuxName[PVR_ADDON_NAME_STRING_LENGTH]; /*!< @brief (optional) name of the current mux */ | ||
| 203 | int iSNR; /*!< @brief (optional) signal/noise ratio */ | ||
| 204 | int iSignal; /*!< @brief (optional) signal strength */ | ||
| 205 | long iBER; /*!< @brief (optional) bit error rate */ | ||
| 206 | long iUNC; /*!< @brief (optional) uncorrected blocks */ | ||
| 207 | double dVideoBitrate; /*!< @brief (optional) video bitrate */ | ||
| 208 | double dAudioBitrate; /*!< @brief (optional) audio bitrate */ | ||
| 209 | double dDolbyBitrate; /*!< @brief (optional) dolby bitrate */ | ||
| 210 | } ATTRIBUTE_PACKED PVR_SIGNAL_STATUS; | ||
| 211 | |||
| 212 | /*! | ||
| 213 | * @brief Menu hooks that are available in the context menus while playing a stream via this add-on. | ||
| 214 | * And in the Live TV settings dialog | ||
| 215 | */ | ||
| 216 | typedef struct PVR_MENUHOOK | ||
| 217 | { | ||
| 218 | unsigned int iHookId; /*!< @brief (required) this hook's identifier */ | ||
| 219 | unsigned int iLocalizedStringId; /*!< @brief (required) the id of the label for this hook in g_localizeStrings */ | ||
| 220 | PVR_MENUHOOK_CAT category; /*!< @brief (required) category of menu hook */ | ||
| 221 | } ATTRIBUTE_PACKED PVR_MENUHOOK; | ||
| 222 | |||
| 223 | /*! | ||
| 224 | * @brief Representation of a TV or radio channel. | ||
| 225 | */ | ||
| 226 | typedef struct PVR_CHANNEL | ||
| 227 | { | ||
| 228 | unsigned int iUniqueId; /*!< @brief (required) unique identifier for this channel */ | ||
| 229 | bool bIsRadio; /*!< @brief (required) true if this is a radio channel, false if it's a TV channel */ | ||
| 230 | unsigned int iChannelNumber; /*!< @brief (optional) channel number of this channel on the backend */ | ||
| 231 | unsigned int iSubChannelNumber; /*!< @brief (optional) sub channel number of this channel on the backend (ATSC) */ | ||
| 232 | char strChannelName[PVR_ADDON_NAME_STRING_LENGTH]; /*!< @brief (optional) channel name given to this channel */ | ||
| 233 | char strInputFormat[PVR_ADDON_INPUT_FORMAT_STRING_LENGTH]; /*!< @brief (optional) input format type. types can be found in ffmpeg/libavformat/allformats.c | ||
| 234 | leave empty if unknown */ | ||
| 235 | char strStreamURL[PVR_ADDON_URL_STRING_LENGTH]; /*!< @brief (optional) the URL to use to access this channel. | ||
| 236 | leave empty to use this add-on to access the stream. | ||
| 237 | set to a path that's supported by XBMC otherwise. */ | ||
| 238 | unsigned int iEncryptionSystem; /*!< @brief (optional) the encryption ID or CaID of this channel */ | ||
| 239 | char strIconPath[PVR_ADDON_URL_STRING_LENGTH]; /*!< @brief (optional) path to the channel icon (if present) */ | ||
| 240 | bool bIsHidden; /*!< @brief (optional) true if this channel is marked as hidden */ | ||
| 241 | } ATTRIBUTE_PACKED PVR_CHANNEL; | ||
| 242 | |||
| 243 | typedef struct PVR_CHANNEL_GROUP | ||
| 244 | { | ||
| 245 | char strGroupName[PVR_ADDON_NAME_STRING_LENGTH]; /*!< @brief (required) name of this channel group */ | ||
| 246 | bool bIsRadio; /*!< @brief (required) true if this is a radio channel group, false otherwise. */ | ||
| 247 | } ATTRIBUTE_PACKED PVR_CHANNEL_GROUP; | ||
| 248 | |||
| 249 | typedef struct PVR_CHANNEL_GROUP_MEMBER | ||
| 250 | { | ||
| 251 | char strGroupName[PVR_ADDON_NAME_STRING_LENGTH]; /*!< @brief (required) name of the channel group to add the channel to */ | ||
| 252 | unsigned int iChannelUniqueId; /*!< @brief (required) unique id of the member */ | ||
| 253 | unsigned int iChannelNumber; /*!< @brief (optional) channel number within the group */ | ||
| 254 | } ATTRIBUTE_PACKED PVR_CHANNEL_GROUP_MEMBER; | ||
| 255 | |||
| 256 | /*! | ||
| 257 | * @brief Representation of a timer event. | ||
| 258 | */ | ||
| 259 | typedef struct PVR_TIMER { | ||
| 260 | unsigned int iClientIndex; /*!< @brief (required) the index of this timer given by the client */ | ||
| 261 | int iClientChannelUid; /*!< @brief (required) unique identifier of the channel to record on */ | ||
| 262 | time_t startTime; /*!< @brief (required) start time of the recording in UTC. instant timers that are sent to the add-on by xbmc will have this value set to 0 */ | ||
| 263 | time_t endTime; /*!< @brief (required) end time of the recording in UTC */ | ||
| 264 | PVR_TIMER_STATE state; /*!< @brief (required) the state of this timer */ | ||
| 265 | char strTitle[PVR_ADDON_NAME_STRING_LENGTH]; /*!< @brief (optional) title of this timer */ | ||
| 266 | char strDirectory[PVR_ADDON_URL_STRING_LENGTH]; /*!< @brief (optional) the directory where the recording will be stored in */ | ||
| 267 | char strSummary[PVR_ADDON_DESC_STRING_LENGTH]; /*!< @brief (optional) the summary for this timer */ | ||
| 268 | int iPriority; /*!< @brief (optional) the priority of this timer */ | ||
| 269 | int iLifetime; /*!< @brief (optional) lifetimer of this timer in days */ | ||
| 270 | bool bIsRepeating; /*!< @brief (optional) true if this is a recurring timer */ | ||
| 271 | time_t firstDay; /*!< @brief (optional) the first day this recording is active in case of a repeating event */ | ||
| 272 | int iWeekdays; /*!< @brief (optional) weekday mask */ | ||
| 273 | int iEpgUid; /*!< @brief (optional) epg event id */ | ||
| 274 | unsigned int iMarginStart; /*!< @brief (optional) if set, the backend starts the recording iMarginStart minutes before startTime. */ | ||
| 275 | unsigned int iMarginEnd; /*!< @brief (optional) if set, the backend ends the recording iMarginEnd minutes after endTime. */ | ||
| 276 | int iGenreType; /*!< @brief (optional) genre type */ | ||
| 277 | int iGenreSubType; /*!< @brief (optional) genre sub type */ | ||
| 278 | } ATTRIBUTE_PACKED PVR_TIMER; | ||
| 279 | /*! | ||
| 280 | * @brief Representation of a recording. | ||
| 281 | */ | ||
| 282 | typedef struct PVR_RECORDING { | ||
| 283 | char strRecordingId[PVR_ADDON_NAME_STRING_LENGTH]; /*!< @brief (required) unique id of the recording on the client. */ | ||
| 284 | char strTitle[PVR_ADDON_NAME_STRING_LENGTH]; /*!< @brief (required) the title of this recording */ | ||
| 285 | char strStreamURL[PVR_ADDON_URL_STRING_LENGTH]; /*!< @brief (required) stream URL to access this recording */ | ||
| 286 | char strDirectory[PVR_ADDON_URL_STRING_LENGTH]; /*!< @brief (optional) directory of this recording on the client */ | ||
| 287 | char strPlotOutline[PVR_ADDON_DESC_STRING_LENGTH]; /*!< @brief (optional) plot outline */ | ||
| 288 | char strPlot[PVR_ADDON_DESC_STRING_LENGTH]; /*!< @brief (optional) plot */ | ||
| 289 | char strChannelName[PVR_ADDON_NAME_STRING_LENGTH]; /*!< @brief (optional) channel name */ | ||
| 290 | char strIconPath[PVR_ADDON_URL_STRING_LENGTH]; /*!< @brief (optional) icon path */ | ||
| 291 | char strThumbnailPath[PVR_ADDON_URL_STRING_LENGTH]; /*!< @brief (optional) thumbnail path */ | ||
| 292 | char strFanartPath[PVR_ADDON_URL_STRING_LENGTH]; /*!< @brief (optional) fanart path */ | ||
| 293 | time_t recordingTime; /*!< @brief (optional) start time of the recording */ | ||
| 294 | int iDuration; /*!< @brief (optional) duration of the recording in seconds */ | ||
| 295 | int iPriority; /*!< @brief (optional) priority of this recording (from 0 - 100) */ | ||
| 296 | int iLifetime; /*!< @brief (optional) life time in days of this recording */ | ||
| 297 | int iGenreType; /*!< @brief (optional) genre type */ | ||
| 298 | int iGenreSubType; /*!< @brief (optional) genre sub type */ | ||
| 299 | int iPlayCount; /*!< @brief (optional) play count of this recording on the client */ | ||
| 300 | int iLastPlayedPosition; /*!< @brief (optional) last played position of this recording on the client */ | ||
| 301 | bool bIsDeleted; /*!< @brief (optional) shows this recording is deleted and can be undelete */ | ||
| 302 | } ATTRIBUTE_PACKED PVR_RECORDING; | ||
| 303 | |||
| 304 | /*! | ||
| 305 | * @brief Edit definition list (EDL) | ||
| 306 | */ | ||
| 307 | typedef enum | ||
| 308 | { | ||
| 309 | PVR_EDL_TYPE_CUT = 0, /*!< @brief cut (completly remove content) */ | ||
| 310 | PVR_EDL_TYPE_MUTE = 1, /*!< @brief mute audio */ | ||
| 311 | PVR_EDL_TYPE_SCENE = 2, /*!< @brief scene markers (chapter seeking) */ | ||
| 312 | PVR_EDL_TYPE_COMBREAK = 3 /*!< @brief commercial breaks */ | ||
| 313 | } PVR_EDL_TYPE; | ||
| 314 | |||
| 315 | typedef struct PVR_EDL_ENTRY | ||
| 316 | { | ||
| 317 | int64_t start; // ms | ||
| 318 | int64_t end; // ms | ||
| 319 | PVR_EDL_TYPE type; | ||
| 320 | } ATTRIBUTE_PACKED PVR_EDL_ENTRY; | ||
| 321 | |||
| 322 | /*! | ||
| 323 | * @brief PVR menu hook data | ||
| 324 | */ | ||
| 325 | typedef struct PVR_MENUHOOK_DATA | ||
| 326 | { | ||
| 327 | PVR_MENUHOOK_CAT cat; | ||
| 328 | union data { | ||
| 329 | int iEpgUid; | ||
| 330 | PVR_CHANNEL channel; | ||
| 331 | PVR_TIMER timer; | ||
| 332 | PVR_RECORDING recording; | ||
| 333 | } data; | ||
| 334 | } ATTRIBUTE_PACKED PVR_MENUHOOK_DATA; | ||
| 335 | |||
| 336 | /*! | ||
| 337 | * @brief Structure to transfer the methods from xbmc_pvr_dll.h to XBMC | ||
| 338 | */ | ||
| 339 | typedef struct PVRClient | ||
| 340 | { | ||
| 341 | const char* (__cdecl* GetPVRAPIVersion)(void); | ||
| 342 | const char* (__cdecl* GetMininumPVRAPIVersion)(void); | ||
| 343 | const char* (__cdecl* GetGUIAPIVersion)(void); | ||
| 344 | const char* (__cdecl* GetMininumGUIAPIVersion)(void); | ||
| 345 | PVR_ERROR (__cdecl* GetAddonCapabilities)(PVR_ADDON_CAPABILITIES*); | ||
| 346 | PVR_ERROR (__cdecl* GetStreamProperties)(PVR_STREAM_PROPERTIES*); | ||
| 347 | const char* (__cdecl* GetBackendName)(void); | ||
| 348 | const char* (__cdecl* GetBackendVersion)(void); | ||
| 349 | const char* (__cdecl* GetConnectionString)(void); | ||
| 350 | PVR_ERROR (__cdecl* GetDriveSpace)(long long*, long long*); | ||
| 351 | PVR_ERROR (__cdecl* MenuHook)(const PVR_MENUHOOK&, const PVR_MENUHOOK_DATA&); | ||
| 352 | PVR_ERROR (__cdecl* GetEpg)(ADDON_HANDLE, const PVR_CHANNEL&, time_t, time_t); | ||
| 353 | int (__cdecl* GetChannelGroupsAmount)(void); | ||
| 354 | PVR_ERROR (__cdecl* GetChannelGroups)(ADDON_HANDLE, bool); | ||
| 355 | PVR_ERROR (__cdecl* GetChannelGroupMembers)(ADDON_HANDLE, const PVR_CHANNEL_GROUP&); | ||
| 356 | PVR_ERROR (__cdecl* OpenDialogChannelScan)(void); | ||
| 357 | int (__cdecl* GetChannelsAmount)(void); | ||
| 358 | PVR_ERROR (__cdecl* GetChannels)(ADDON_HANDLE, bool); | ||
| 359 | PVR_ERROR (__cdecl* DeleteChannel)(const PVR_CHANNEL&); | ||
| 360 | PVR_ERROR (__cdecl* RenameChannel)(const PVR_CHANNEL&); | ||
| 361 | PVR_ERROR (__cdecl* MoveChannel)(const PVR_CHANNEL&); | ||
| 362 | PVR_ERROR (__cdecl* OpenDialogChannelSettings)(const PVR_CHANNEL&); | ||
| 363 | PVR_ERROR (__cdecl* OpenDialogChannelAdd)(const PVR_CHANNEL&); | ||
| 364 | int (__cdecl* GetRecordingsAmount)(bool); | ||
| 365 | PVR_ERROR (__cdecl* GetRecordings)(ADDON_HANDLE, bool); | ||
| 366 | PVR_ERROR (__cdecl* DeleteRecording)(const PVR_RECORDING&); | ||
| 367 | PVR_ERROR (__cdecl* UndeleteRecording)(const PVR_RECORDING&); | ||
| 368 | PVR_ERROR (__cdecl* DeleteAllRecordingsFromTrash)(void); | ||
| 369 | PVR_ERROR (__cdecl* RenameRecording)(const PVR_RECORDING&); | ||
| 370 | PVR_ERROR (__cdecl* SetRecordingPlayCount)(const PVR_RECORDING&, int); | ||
| 371 | PVR_ERROR (__cdecl* SetRecordingLastPlayedPosition)(const PVR_RECORDING&, int); | ||
| 372 | int (__cdecl* GetRecordingLastPlayedPosition)(const PVR_RECORDING&); | ||
| 373 | PVR_ERROR (__cdecl* GetRecordingEdl)(const PVR_RECORDING&, PVR_EDL_ENTRY[], int*); | ||
| 374 | int (__cdecl* GetTimersAmount)(void); | ||
| 375 | PVR_ERROR (__cdecl* GetTimers)(ADDON_HANDLE); | ||
| 376 | PVR_ERROR (__cdecl* AddTimer)(const PVR_TIMER&); | ||
| 377 | PVR_ERROR (__cdecl* DeleteTimer)(const PVR_TIMER&, bool); | ||
| 378 | PVR_ERROR (__cdecl* UpdateTimer)(const PVR_TIMER&); | ||
| 379 | bool (__cdecl* OpenLiveStream)(const PVR_CHANNEL&); | ||
| 380 | void (__cdecl* CloseLiveStream)(void); | ||
| 381 | int (__cdecl* ReadLiveStream)(unsigned char*, unsigned int); | ||
| 382 | long long (__cdecl* SeekLiveStream)(long long, int); | ||
| 383 | long long (__cdecl* PositionLiveStream)(void); | ||
| 384 | long long (__cdecl* LengthLiveStream)(void); | ||
| 385 | int (__cdecl* GetCurrentClientChannel)(void); | ||
| 386 | bool (__cdecl* SwitchChannel)(const PVR_CHANNEL&); | ||
| 387 | PVR_ERROR (__cdecl* SignalStatus)(PVR_SIGNAL_STATUS&); | ||
| 388 | const char* (__cdecl* GetLiveStreamURL)(const PVR_CHANNEL&); | ||
| 389 | bool (__cdecl* OpenRecordedStream)(const PVR_RECORDING&); | ||
| 390 | void (__cdecl* CloseRecordedStream)(void); | ||
| 391 | int (__cdecl* ReadRecordedStream)(unsigned char*, unsigned int); | ||
| 392 | long long (__cdecl* SeekRecordedStream)(long long, int); | ||
| 393 | long long (__cdecl* PositionRecordedStream)(void); | ||
| 394 | long long (__cdecl* LengthRecordedStream)(void); | ||
| 395 | void (__cdecl* DemuxReset)(void); | ||
| 396 | void (__cdecl* DemuxAbort)(void); | ||
| 397 | void (__cdecl* DemuxFlush)(void); | ||
| 398 | DemuxPacket* (__cdecl* DemuxRead)(void); | ||
| 399 | unsigned int (__cdecl* GetChannelSwitchDelay)(void); | ||
| 400 | bool (__cdecl* CanPauseStream)(void); | ||
| 401 | void (__cdecl* PauseStream)(bool); | ||
| 402 | bool (__cdecl* CanSeekStream)(void); | ||
| 403 | bool (__cdecl* SeekTime)(int, bool, double*); | ||
| 404 | void (__cdecl* SetSpeed)(int); | ||
| 405 | time_t (__cdecl* GetPlayingTime)(void); | ||
| 406 | time_t (__cdecl* GetBufferTimeStart)(void); | ||
| 407 | time_t (__cdecl* GetBufferTimeEnd)(void); | ||
| 408 | const char* (__cdecl* GetBackendHostname)(void); | ||
| 409 | } PVRClient; | ||
| 410 | |||
| 411 | #ifdef __cplusplus | ||
| 412 | } | ||
| 413 | #endif | ||
| 414 | |||
| 415 | #endif //__PVRCLIENT_TYPES_H__ | ||
diff --git a/xbmc/addons/include/xbmc_scr_dll.h b/xbmc/addons/include/xbmc_scr_dll.h new file mode 100644 index 0000000..c4257b4 --- /dev/null +++ b/xbmc/addons/include/xbmc_scr_dll.h | |||
| @@ -0,0 +1,45 @@ | |||
| 1 | #pragma once | ||
| 2 | /* | ||
| 3 | * Copyright (C) 2005-2013 Team XBMC | ||
| 4 | * http://xbmc.org | ||
| 5 | * | ||
| 6 | * This Program is free software; you can redistribute it and/or modify | ||
| 7 | * it under the terms of the GNU General Public License as published by | ||
| 8 | * the Free Software Foundation; either version 2, or (at your option) | ||
| 9 | * any later version. | ||
| 10 | * | ||
| 11 | * This Program is distributed in the hope that it will be useful, | ||
| 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
| 14 | * GNU General Public License for more details. | ||
| 15 | * | ||
| 16 | * You should have received a copy of the GNU General Public License | ||
| 17 | * along with XBMC; see the file COPYING. If not, see | ||
| 18 | * <http://www.gnu.org/licenses/>. | ||
| 19 | * | ||
| 20 | */ | ||
| 21 | |||
| 22 | #ifndef __XBMC_SCR_H__ | ||
| 23 | #define __XBMC_SCR_H__ | ||
| 24 | |||
| 25 | #include "xbmc_addon_dll.h" | ||
| 26 | #include "xbmc_scr_types.h" | ||
| 27 | |||
| 28 | extern "C" | ||
| 29 | { | ||
| 30 | |||
| 31 | // Functions that your visualisation must implement | ||
| 32 | void Start(); | ||
| 33 | void Render(); | ||
| 34 | void GetInfo(SCR_INFO* pInfo); | ||
| 35 | |||
| 36 | // function to export the above structure to XBMC | ||
| 37 | void __declspec(dllexport) get_addon(struct ScreenSaver* pScr) | ||
| 38 | { | ||
| 39 | pScr->Start = Start; | ||
| 40 | pScr->Render = Render; | ||
| 41 | pScr->GetInfo = GetInfo; | ||
| 42 | }; | ||
| 43 | }; | ||
| 44 | |||
| 45 | #endif | ||
diff --git a/xbmc/addons/include/xbmc_scr_types.h b/xbmc/addons/include/xbmc_scr_types.h new file mode 100644 index 0000000..fec3040 --- /dev/null +++ b/xbmc/addons/include/xbmc_scr_types.h | |||
| @@ -0,0 +1,53 @@ | |||
| 1 | #pragma once | ||
| 2 | /* | ||
| 3 | * Copyright (C) 2005-2013 Team XBMC | ||
| 4 | * http://xbmc.org | ||
| 5 | * | ||
| 6 | * This Program is free software; you can redistribute it and/or modify | ||
| 7 | * it under the terms of the GNU General Public License as published by | ||
| 8 | * the Free Software Foundation; either version 2, or (at your option) | ||
| 9 | * any later version. | ||
| 10 | * | ||
| 11 | * This Program is distributed in the hope that it will be useful, | ||
| 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
| 14 | * GNU General Public License for more details. | ||
| 15 | * | ||
| 16 | * You should have received a copy of the GNU General Public License | ||
| 17 | * along with XBMC; see the file COPYING. If not, see | ||
| 18 | * <http://www.gnu.org/licenses/>. | ||
| 19 | * | ||
| 20 | */ | ||
| 21 | |||
| 22 | #ifndef __SCREENSAVER_TYPES_H__ | ||
| 23 | #define __SCREENSAVER_TYPES_H__ | ||
| 24 | |||
| 25 | extern "C" | ||
| 26 | { | ||
| 27 | struct SCR_INFO | ||
| 28 | { | ||
| 29 | int dummy; | ||
| 30 | }; | ||
| 31 | |||
| 32 | struct SCR_PROPS | ||
| 33 | { | ||
| 34 | void *device; | ||
| 35 | int x; | ||
| 36 | int y; | ||
| 37 | int width; | ||
| 38 | int height; | ||
| 39 | float pixelRatio; | ||
| 40 | const char *name; | ||
| 41 | const char *presets; | ||
| 42 | const char *profile; | ||
| 43 | }; | ||
| 44 | |||
| 45 | struct ScreenSaver | ||
| 46 | { | ||
| 47 | void (__cdecl* Start) (); | ||
| 48 | void (__cdecl* Render) (); | ||
| 49 | void (__cdecl* GetInfo)(SCR_INFO *info); | ||
| 50 | }; | ||
| 51 | } | ||
| 52 | |||
| 53 | #endif // __SCREENSAVER_TYPES_H__ | ||
diff --git a/xbmc/addons/include/xbmc_stream_utils.hpp b/xbmc/addons/include/xbmc_stream_utils.hpp new file mode 100644 index 0000000..927fe33 --- /dev/null +++ b/xbmc/addons/include/xbmc_stream_utils.hpp | |||
| @@ -0,0 +1,264 @@ | |||
| 1 | #pragma once | ||
| 2 | /* | ||
| 3 | * Copyright (C) 2005-2013 Team XBMC | ||
| 4 | * http://xbmc.org | ||
| 5 | * | ||
| 6 | * This Program is free software; you can redistribute it and/or modify | ||
| 7 | * it under the terms of the GNU General Public License as published by | ||
| 8 | * the Free Software Foundation; either version 2, or (at your option) | ||
| 9 | * any later version. | ||
| 10 | * | ||
| 11 | * This Program is distributed in the hope that it will be useful, | ||
| 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
| 14 | * GNU General Public License for more details. | ||
| 15 | * | ||
| 16 | * You should have received a copy of the GNU General Public License | ||
| 17 | * along with XBMC; see the file COPYING. If not, see | ||
| 18 | * <http://www.gnu.org/licenses/>. | ||
| 19 | * | ||
| 20 | */ | ||
| 21 | |||
| 22 | #include "xbmc_pvr_types.h" | ||
| 23 | #include <algorithm> | ||
| 24 | #include <map> | ||
| 25 | |||
| 26 | namespace ADDON | ||
| 27 | { | ||
| 28 | /** | ||
| 29 | * Represents a single stream. It extends the PODS to provide some operators | ||
| 30 | * overloads. | ||
| 31 | */ | ||
| 32 | class XbmcPvrStream : public PVR_STREAM_PROPERTIES::PVR_STREAM | ||
| 33 | { | ||
| 34 | public: | ||
| 35 | XbmcPvrStream() | ||
| 36 | { | ||
| 37 | Clear(); | ||
| 38 | } | ||
| 39 | |||
| 40 | XbmcPvrStream(const XbmcPvrStream &other) | ||
| 41 | { | ||
| 42 | memcpy(this, &other, sizeof(PVR_STREAM_PROPERTIES::PVR_STREAM)); | ||
| 43 | } | ||
| 44 | |||
| 45 | XbmcPvrStream& operator=(const XbmcPvrStream &other) | ||
| 46 | { | ||
| 47 | memcpy(this, &other, sizeof(PVR_STREAM_PROPERTIES::PVR_STREAM)); | ||
| 48 | return *this; | ||
| 49 | } | ||
| 50 | |||
| 51 | /** | ||
| 52 | * Compares this stream based on another stream | ||
| 53 | * @param other | ||
| 54 | * @return | ||
| 55 | */ | ||
| 56 | inline bool operator==(const XbmcPvrStream &other) const | ||
| 57 | { | ||
| 58 | return iPhysicalId == other.iPhysicalId && iCodecId == other.iCodecId; | ||
| 59 | } | ||
| 60 | |||
| 61 | /** | ||
| 62 | * Compares this stream with another one so that video streams are sorted | ||
| 63 | * before any other streams and the others are sorted by the physical ID | ||
| 64 | * @param other | ||
| 65 | * @return | ||
| 66 | */ | ||
| 67 | bool operator<(const XbmcPvrStream &other) const | ||
| 68 | { | ||
| 69 | if (iCodecType == XBMC_CODEC_TYPE_VIDEO) | ||
| 70 | return true; | ||
| 71 | else if (other.iCodecType != XBMC_CODEC_TYPE_VIDEO) | ||
| 72 | return iPhysicalId < other.iPhysicalId; | ||
| 73 | else | ||
| 74 | return false; | ||
| 75 | } | ||
| 76 | |||
| 77 | /** | ||
| 78 | * Clears the stream | ||
| 79 | */ | ||
| 80 | void Clear() | ||
| 81 | { | ||
| 82 | memset(this, 0, sizeof(PVR_STREAM_PROPERTIES::PVR_STREAM)); | ||
| 83 | iCodecId = XBMC_INVALID_CODEC_ID; | ||
| 84 | iCodecType = XBMC_CODEC_TYPE_UNKNOWN; | ||
| 85 | } | ||
| 86 | |||
| 87 | /** | ||
| 88 | * Checks whether the stream has been cleared | ||
| 89 | * @return | ||
| 90 | */ | ||
| 91 | inline bool IsCleared() const | ||
| 92 | { | ||
| 93 | return iCodecId == XBMC_INVALID_CODEC_ID && | ||
| 94 | iCodecType == XBMC_CODEC_TYPE_UNKNOWN; | ||
| 95 | } | ||
| 96 | }; | ||
| 97 | |||
| 98 | class XbmcStreamProperties | ||
| 99 | { | ||
| 100 | public: | ||
| 101 | typedef std::vector<XbmcPvrStream> stream_vector; | ||
| 102 | |||
| 103 | XbmcStreamProperties(void) | ||
| 104 | { | ||
| 105 | // make sure the vector won't have to resize itself later | ||
| 106 | m_streamVector = new stream_vector(); | ||
| 107 | m_streamVector->reserve(PVR_STREAM_MAX_STREAMS); | ||
| 108 | } | ||
| 109 | |||
| 110 | virtual ~XbmcStreamProperties(void) | ||
| 111 | { | ||
| 112 | delete m_streamVector; | ||
| 113 | } | ||
| 114 | |||
| 115 | /** | ||
| 116 | * Resets the streams | ||
| 117 | */ | ||
| 118 | void Clear(void) | ||
| 119 | { | ||
| 120 | m_streamVector->clear(); | ||
| 121 | m_streamIndex.clear(); | ||
| 122 | } | ||
| 123 | |||
| 124 | /** | ||
| 125 | * Returns the index of the stream with the specified physical ID, or -1 if | ||
| 126 | * there no stream is found. This method is called very often which is why | ||
| 127 | * we keep a separate map for this. | ||
| 128 | * @param iPhysicalId | ||
| 129 | * @return | ||
| 130 | */ | ||
| 131 | int GetStreamId(unsigned int iPhysicalId) const | ||
| 132 | { | ||
| 133 | std::map<unsigned int, int>::const_iterator it = m_streamIndex.find(iPhysicalId); | ||
| 134 | if (it != m_streamIndex.end()) | ||
| 135 | return it->second; | ||
| 136 | |||
| 137 | return -1; | ||
| 138 | } | ||
| 139 | |||
| 140 | /** | ||
| 141 | * Returns the stream with the specified physical ID, or null if no such | ||
| 142 | * stream exists | ||
| 143 | * @param iPhysicalId | ||
| 144 | * @return | ||
| 145 | */ | ||
| 146 | XbmcPvrStream* GetStreamById(unsigned int iPhysicalId) const | ||
| 147 | { | ||
| 148 | int position = GetStreamId(iPhysicalId); | ||
| 149 | return position != -1 ? &m_streamVector->at(position) : NULL; | ||
| 150 | } | ||
| 151 | |||
| 152 | /** | ||
| 153 | * Populates the specified stream with the stream having the specified | ||
| 154 | * physical ID. If the stream is not found only target stream's physical ID | ||
| 155 | * will be populated. | ||
| 156 | * @param iPhysicalId | ||
| 157 | * @param stream | ||
| 158 | */ | ||
| 159 | void GetStreamData(unsigned int iPhysicalId, XbmcPvrStream* stream) | ||
| 160 | { | ||
| 161 | XbmcPvrStream *foundStream = GetStreamById(iPhysicalId); | ||
| 162 | if (foundStream) | ||
| 163 | stream = foundStream; | ||
| 164 | else | ||
| 165 | { | ||
| 166 | stream->iIdentifier = -1; | ||
| 167 | stream->iPhysicalId = iPhysicalId; | ||
| 168 | } | ||
| 169 | } | ||
| 170 | |||
| 171 | /** | ||
| 172 | * Populates props with the current streams and returns whether there are | ||
| 173 | * any streams at the moment or not. | ||
| 174 | * @param props | ||
| 175 | * @return | ||
| 176 | */ | ||
| 177 | bool GetProperties(PVR_STREAM_PROPERTIES* props) | ||
| 178 | { | ||
| 179 | unsigned int i = 0; | ||
| 180 | for (stream_vector::const_iterator it = m_streamVector->begin(); | ||
| 181 | it != m_streamVector->end(); ++it, ++i) | ||
| 182 | { | ||
| 183 | memcpy(&props->stream[i], &(*it), sizeof(PVR_STREAM_PROPERTIES::PVR_STREAM)); | ||
| 184 | } | ||
| 185 | |||
| 186 | props->iStreamCount = m_streamVector->size(); | ||
| 187 | return (props->iStreamCount > 0); | ||
| 188 | } | ||
| 189 | |||
| 190 | /** | ||
| 191 | * Merges new streams into the current list of streams. Identical streams | ||
| 192 | * will retain their respective indexes and new streams will replace unused | ||
| 193 | * indexes or be appended. | ||
| 194 | * @param newStreams | ||
| 195 | */ | ||
| 196 | void UpdateStreams(stream_vector &newStreams) | ||
| 197 | { | ||
| 198 | // sort the new streams | ||
| 199 | std::sort(newStreams.begin(), newStreams.end()); | ||
| 200 | |||
| 201 | // ensure we never have more than PVR_STREAMS_MAX_STREAMS streams | ||
| 202 | if (newStreams.size() > PVR_STREAM_MAX_STREAMS) | ||
| 203 | { | ||
| 204 | while (newStreams.size() > PVR_STREAM_MAX_STREAMS) | ||
| 205 | newStreams.pop_back(); | ||
| 206 | |||
| 207 | XBMC->Log(LOG_ERROR, "%s - max amount of streams reached", __FUNCTION__); | ||
| 208 | } | ||
| 209 | |||
| 210 | stream_vector::iterator newStreamPosition; | ||
| 211 | for (stream_vector::iterator it = m_streamVector->begin(); it != m_streamVector->end(); ++it) | ||
| 212 | { | ||
| 213 | newStreamPosition = std::find(newStreams.begin(), newStreams.end(), *it); | ||
| 214 | |||
| 215 | // if the current stream no longer exists we clear it, otherwise we | ||
| 216 | // copy it and remove it from newStreams | ||
| 217 | if (newStreamPosition == newStreams.end()) | ||
| 218 | it->Clear(); | ||
| 219 | else | ||
| 220 | { | ||
| 221 | *it = *newStreamPosition; | ||
| 222 | newStreams.erase(newStreamPosition); | ||
| 223 | } | ||
| 224 | } | ||
| 225 | |||
| 226 | // replace cleared streams with new streams | ||
| 227 | for (stream_vector::iterator it = m_streamVector->begin(); | ||
| 228 | it != m_streamVector->end() && !newStreams.empty(); ++it) | ||
| 229 | { | ||
| 230 | if (it->IsCleared()) | ||
| 231 | { | ||
| 232 | *it = newStreams.front(); | ||
| 233 | newStreams.erase(newStreams.begin()); | ||
| 234 | } | ||
| 235 | } | ||
| 236 | |||
| 237 | // append any remaining new streams | ||
| 238 | m_streamVector->insert(m_streamVector->end(), newStreams.begin(), newStreams.end()); | ||
| 239 | |||
| 240 | // remove trailing cleared streams | ||
| 241 | while (m_streamVector->back().IsCleared()) | ||
| 242 | m_streamVector->pop_back(); | ||
| 243 | |||
| 244 | // update the index | ||
| 245 | UpdateIndex(); | ||
| 246 | } | ||
| 247 | |||
| 248 | private: | ||
| 249 | stream_vector *m_streamVector; | ||
| 250 | std::map<unsigned int, int> m_streamIndex; | ||
| 251 | |||
| 252 | /** | ||
| 253 | * Updates the stream index | ||
| 254 | */ | ||
| 255 | void UpdateIndex() | ||
| 256 | { | ||
| 257 | m_streamIndex.clear(); | ||
| 258 | |||
| 259 | int i = 0; | ||
| 260 | for (stream_vector::const_iterator it = m_streamVector->begin(); it != m_streamVector->end(); ++it, ++i) | ||
| 261 | m_streamIndex[it->iPhysicalId] = i; | ||
| 262 | } | ||
| 263 | }; | ||
| 264 | } | ||
diff --git a/xbmc/addons/include/xbmc_vis_dll.h b/xbmc/addons/include/xbmc_vis_dll.h new file mode 100644 index 0000000..c65f844 --- /dev/null +++ b/xbmc/addons/include/xbmc_vis_dll.h | |||
| @@ -0,0 +1,55 @@ | |||
| 1 | #ifndef __XBMC_VIS_H__ | ||
| 2 | #define __XBMC_VIS_H__ | ||
| 3 | |||
| 4 | /* | ||
| 5 | * Copyright (C) 2005-2013 Team XBMC | ||
| 6 | * http://xbmc.org | ||
| 7 | * | ||
| 8 | * This Program is free software; you can redistribute it and/or modify | ||
| 9 | * it under the terms of the GNU General Public License as published by | ||
| 10 | * the Free Software Foundation; either version 2, or (at your option) | ||
| 11 | * any later version. | ||
| 12 | * | ||
| 13 | * This Program is distributed in the hope that it will be useful, | ||
| 14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| 15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
| 16 | * GNU General Public License for more details. | ||
| 17 | * | ||
| 18 | * You should have received a copy of the GNU General Public License | ||
| 19 | * along with XBMC; see the file COPYING. If not, see | ||
| 20 | * <http://www.gnu.org/licenses/>. | ||
| 21 | * | ||
| 22 | */ | ||
| 23 | |||
| 24 | #include "xbmc_addon_dll.h" | ||
| 25 | #include "xbmc_vis_types.h" | ||
| 26 | |||
| 27 | extern "C" | ||
| 28 | { | ||
| 29 | // Functions that your visualisation must implement | ||
| 30 | void Start(int iChannels, int iSamplesPerSec, int iBitsPerSample, const char* szSongName); | ||
| 31 | void AudioData(const float* pAudioData, int iAudioDataLength, float *pFreqData, int iFreqDataLength); | ||
| 32 | void Render(); | ||
| 33 | bool OnAction(long action, const void *param); | ||
| 34 | void GetInfo(VIS_INFO* pInfo); | ||
| 35 | unsigned int GetPresets(char ***presets); | ||
| 36 | unsigned GetPreset(); | ||
| 37 | unsigned int GetSubModules(char ***presets); | ||
| 38 | bool IsLocked(); | ||
| 39 | |||
| 40 | // function to export the above structure to XBMC | ||
| 41 | void __declspec(dllexport) get_addon(struct Visualisation* pVisz) | ||
| 42 | { | ||
| 43 | pVisz->Start = Start; | ||
| 44 | pVisz->AudioData = AudioData; | ||
| 45 | pVisz->Render = Render; | ||
| 46 | pVisz->OnAction = OnAction; | ||
| 47 | pVisz->GetInfo = GetInfo; | ||
| 48 | pVisz->GetPresets = GetPresets; | ||
| 49 | pVisz->GetPreset = GetPreset; | ||
| 50 | pVisz->GetSubModules = GetSubModules; | ||
| 51 | pVisz->IsLocked = IsLocked; | ||
| 52 | }; | ||
| 53 | }; | ||
| 54 | |||
| 55 | #endif | ||
diff --git a/xbmc/addons/include/xbmc_vis_types.h b/xbmc/addons/include/xbmc_vis_types.h new file mode 100644 index 0000000..e6b0ccd --- /dev/null +++ b/xbmc/addons/include/xbmc_vis_types.h | |||
| @@ -0,0 +1,111 @@ | |||
| 1 | /* | ||
| 2 | * Copyright (C) 2005-2013 Team XBMC | ||
| 3 | * http://xbmc.org | ||
| 4 | * | ||
| 5 | * This Program is free software; you can redistribute it and/or modify | ||
| 6 | * it under the terms of the GNU General Public License as published by | ||
| 7 | * the Free Software Foundation; either version 2, or (at your option) | ||
| 8 | * any later version. | ||
| 9 | * | ||
| 10 | * This Program is distributed in the hope that it will be useful, | ||
| 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
| 13 | * GNU General Public License for more details. | ||
| 14 | * | ||
| 15 | * You should have received a copy of the GNU General Public License | ||
| 16 | * along with XBMC; see the file COPYING. If not, see | ||
| 17 | * <http://www.gnu.org/licenses/>. | ||
| 18 | * | ||
| 19 | */ | ||
| 20 | |||
| 21 | /* | ||
| 22 | Common data structures shared between XBMC and XBMC's visualisations | ||
| 23 | */ | ||
| 24 | |||
| 25 | #ifndef __VISUALISATION_TYPES_H__ | ||
| 26 | #define __VISUALISATION_TYPES_H__ | ||
| 27 | #include <cstddef> | ||
| 28 | |||
| 29 | extern "C" | ||
| 30 | { | ||
| 31 | struct VIS_INFO | ||
| 32 | { | ||
| 33 | int bWantsFreq; | ||
| 34 | int iSyncDelay; | ||
| 35 | }; | ||
| 36 | |||
| 37 | struct VIS_PROPS | ||
| 38 | { | ||
| 39 | void *device; | ||
| 40 | int x; | ||
| 41 | int y; | ||
| 42 | int width; | ||
| 43 | int height; | ||
| 44 | float pixelRatio; | ||
| 45 | const char *name; | ||
| 46 | const char *presets; | ||
| 47 | const char *profile; | ||
| 48 | const char *submodule; | ||
| 49 | }; | ||
| 50 | |||
| 51 | enum VIS_ACTION | ||
| 52 | { | ||
| 53 | VIS_ACTION_NONE = 0, | ||
| 54 | VIS_ACTION_NEXT_PRESET, | ||
| 55 | VIS_ACTION_PREV_PRESET, | ||
| 56 | VIS_ACTION_LOAD_PRESET, | ||
| 57 | VIS_ACTION_RANDOM_PRESET, | ||
| 58 | VIS_ACTION_LOCK_PRESET, | ||
| 59 | VIS_ACTION_RATE_PRESET_PLUS, | ||
| 60 | VIS_ACTION_RATE_PRESET_MINUS, | ||
| 61 | VIS_ACTION_UPDATE_ALBUMART, | ||
| 62 | VIS_ACTION_UPDATE_TRACK | ||
| 63 | }; | ||
| 64 | |||
| 65 | class VisTrack | ||
| 66 | { | ||
| 67 | public: | ||
| 68 | VisTrack() | ||
| 69 | { | ||
| 70 | title = artist = album = albumArtist = NULL; | ||
| 71 | genre = comment = lyrics = reserved1 = reserved2 = NULL; | ||
| 72 | trackNumber = discNumber = duration = year = 0; | ||
| 73 | rating = 0; | ||
| 74 | reserved3 = reserved4 = 0; | ||
| 75 | } | ||
| 76 | |||
| 77 | const char *title; | ||
| 78 | const char *artist; | ||
| 79 | const char *album; | ||
| 80 | const char *albumArtist; | ||
| 81 | const char *genre; | ||
| 82 | const char *comment; | ||
| 83 | const char *lyrics; | ||
| 84 | const char *reserved1; | ||
| 85 | const char *reserved2; | ||
| 86 | |||
| 87 | int trackNumber; | ||
| 88 | int discNumber; | ||
| 89 | int duration; | ||
| 90 | int year; | ||
| 91 | char rating; | ||
| 92 | int reserved3; | ||
| 93 | int reserved4; | ||
| 94 | }; | ||
| 95 | |||
| 96 | struct Visualisation | ||
| 97 | { | ||
| 98 | void (__cdecl* Start)(int iChannels, int iSamplesPerSec, int iBitsPerSample, const char* szSongName); | ||
| 99 | void (__cdecl* AudioData)(const float* pAudioData, int iAudioDataLength, float *pFreqData, int iFreqDataLength); | ||
| 100 | void (__cdecl* Render) (); | ||
| 101 | void (__cdecl* GetInfo)(VIS_INFO *info); | ||
| 102 | bool (__cdecl* OnAction)(long flags, const void *param); | ||
| 103 | int (__cdecl* HasPresets)(); | ||
| 104 | unsigned int (__cdecl *GetPresets)(char ***presets); | ||
| 105 | unsigned int (__cdecl *GetPreset)(); | ||
| 106 | unsigned int (__cdecl *GetSubModules)(char ***modules); | ||
| 107 | bool (__cdecl* IsLocked)(); | ||
| 108 | }; | ||
| 109 | } | ||
| 110 | |||
| 111 | #endif //__VISUALISATION_TYPES_H__ | ||
