diff options
Diffstat (limited to 'xbmc/addons/kodi-addon-dev-kit/include/kodi/kodi_inputstream_dll.h')
| -rw-r--r-- | xbmc/addons/kodi-addon-dev-kit/include/kodi/kodi_inputstream_dll.h | 257 |
1 files changed, 257 insertions, 0 deletions
diff --git a/xbmc/addons/kodi-addon-dev-kit/include/kodi/kodi_inputstream_dll.h b/xbmc/addons/kodi-addon-dev-kit/include/kodi/kodi_inputstream_dll.h new file mode 100644 index 0000000..6ecf566 --- /dev/null +++ b/xbmc/addons/kodi-addon-dev-kit/include/kodi/kodi_inputstream_dll.h | |||
| @@ -0,0 +1,257 @@ | |||
| 1 | #pragma once | ||
| 2 | |||
| 3 | /* | ||
| 4 | * Copyright (C) 2005-2016 Team Kodi | ||
| 5 | * http://kodi.tv | ||
| 6 | * | ||
| 7 | * This Program is free software; you can redistribute it and/or modify | ||
| 8 | * it under the terms of the GNU General Public License as published by | ||
| 9 | * the Free Software Foundation; either version 2, or (at your option) | ||
| 10 | * any later version. | ||
| 11 | * | ||
| 12 | * This Program is distributed in the hope that it will be useful, | ||
| 13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
| 15 | * GNU General Public License for more details. | ||
| 16 | * | ||
| 17 | * You should have received a copy of the GNU General Public License | ||
| 18 | * along with Kodi; see the file COPYING. If not, see | ||
| 19 | * <http://www.gnu.org/licenses/>. | ||
| 20 | * | ||
| 21 | */ | ||
| 22 | |||
| 23 | #include "kodi_inputstream_types.h" | ||
| 24 | #include "xbmc_addon_dll.h" | ||
| 25 | |||
| 26 | /*! | ||
| 27 | * Functions that the InputStream client add-on must implement, but some can be empty. | ||
| 28 | * | ||
| 29 | * The 'remarks' field indicates which methods should be implemented, and which ones are optional. | ||
| 30 | */ | ||
| 31 | |||
| 32 | extern "C" | ||
| 33 | { | ||
| 34 | /*! | ||
| 35 | * Open a stream. | ||
| 36 | * @param props | ||
| 37 | * @return True if the stream has been opened successfully, false otherwise. | ||
| 38 | * @remarks | ||
| 39 | */ | ||
| 40 | bool Open(INPUTSTREAM& props); | ||
| 41 | |||
| 42 | /*! | ||
| 43 | * Close an open stream. | ||
| 44 | * @remarks | ||
| 45 | */ | ||
| 46 | void Close(void); | ||
| 47 | |||
| 48 | /*! | ||
| 49 | * Get path/url for this addon. | ||
| 50 | * @remarks | ||
| 51 | */ | ||
| 52 | const char* GetPathList(void); | ||
| 53 | |||
| 54 | /*! | ||
| 55 | * Get Capabilities of this addon. | ||
| 56 | * @remarks | ||
| 57 | */ | ||
| 58 | struct INPUTSTREAM_CAPABILITIES GetCapabilities(); | ||
| 59 | |||
| 60 | |||
| 61 | /*! | ||
| 62 | * Get IDs of available streams | ||
| 63 | * @remarks | ||
| 64 | */ | ||
| 65 | INPUTSTREAM_IDS GetStreamIds(); | ||
| 66 | |||
| 67 | /*! | ||
| 68 | * Get stream properties of a stream. | ||
| 69 | * @param streamId unique id of stream | ||
| 70 | * @return struc of stream properties | ||
| 71 | * @remarks | ||
| 72 | */ | ||
| 73 | INPUTSTREAM_INFO GetStream(int streamid); | ||
| 74 | |||
| 75 | /*! | ||
| 76 | * Enable or disable a stream. | ||
| 77 | * A disabled stream does not send demux packets | ||
| 78 | * @param streamId unique id of stream | ||
| 79 | * @param enable true for enable, false for disable | ||
| 80 | * @remarks | ||
| 81 | */ | ||
| 82 | void EnableStream(int streamid, bool enable); | ||
| 83 | |||
| 84 | /*! | ||
| 85 | * Enables a stream at the given PTS. | ||
| 86 | * @param streamId unique id of stream | ||
| 87 | * @param pts position in stream in microseconds | ||
| 88 | * @remarks will only be called if CAPABILITIES::m_supportsEnableAtPTS is set to true | ||
| 89 | */ | ||
| 90 | void EnableStreamAtPTS(int streamid, uint64_t pts); | ||
| 91 | |||
| 92 | /*! | ||
| 93 | * Reset the demultiplexer in the add-on. | ||
| 94 | * @remarks Required if bHandlesDemuxing is set to true. | ||
| 95 | */ | ||
| 96 | void DemuxReset(void); | ||
| 97 | |||
| 98 | /*! | ||
| 99 | * Abort the demultiplexer thread in the add-on. | ||
| 100 | * @remarks Required if bHandlesDemuxing is set to true. | ||
| 101 | */ | ||
| 102 | void DemuxAbort(void); | ||
| 103 | |||
| 104 | /*! | ||
| 105 | * Flush all data that's currently in the demultiplexer buffer in the add-on. | ||
| 106 | * @remarks Required if bHandlesDemuxing is set to true. | ||
| 107 | */ | ||
| 108 | void DemuxFlush(void); | ||
| 109 | |||
| 110 | /*! | ||
| 111 | * Read the next packet from the demultiplexer, if there is one. | ||
| 112 | * @return The next packet. | ||
| 113 | * If there is no next packet, then the add-on should return the | ||
| 114 | * packet created by calling AllocateDemuxPacket(0) on the callback. | ||
| 115 | * If the stream changed and XBMC's player needs to be reinitialised, | ||
| 116 | * then, the add-on should call AllocateDemuxPacket(0) on the | ||
| 117 | * callback, and set the streamid to DMX_SPECIALID_STREAMCHANGE and | ||
| 118 | * return the value. | ||
| 119 | * The add-on should return NULL if an error occured. | ||
| 120 | * @remarks Return NULL if this add-on won't provide this function. | ||
| 121 | */ | ||
| 122 | DemuxPacket* DemuxRead(void); | ||
| 123 | |||
| 124 | /*! | ||
| 125 | * Notify the InputStream addon/demuxer that XBMC wishes to seek the stream by time | ||
| 126 | * Demuxer is required to set stream to an IDR frame | ||
| 127 | * @param time The absolute time since stream start | ||
| 128 | * @param backwards True to seek to keyframe BEFORE time, else AFTER | ||
| 129 | * @param startpts can be updated to point to where display should start | ||
| 130 | * @return True if the seek operation was possible | ||
| 131 | * @remarks Optional, and only used if addon has its own demuxer. | ||
| 132 | */ | ||
| 133 | bool DemuxSeekTime(int time, bool backwards, double *startpts); | ||
| 134 | |||
| 135 | /*! | ||
| 136 | * Notify the InputStream addon/demuxer that XBMC wishes to change playback speed | ||
| 137 | * @param speed The requested playback speed | ||
| 138 | * @remarks Optional, and only used if addon has its own demuxer. | ||
| 139 | */ | ||
| 140 | void DemuxSetSpeed(int speed); | ||
| 141 | |||
| 142 | |||
| 143 | /*! | ||
| 144 | * Totel time in ms | ||
| 145 | * @remarks | ||
| 146 | */ | ||
| 147 | int GetTotalTime(); | ||
| 148 | |||
| 149 | /*! | ||
| 150 | * Playing time in ms | ||
| 151 | * @remarks | ||
| 152 | */ | ||
| 153 | int GetTime(); | ||
| 154 | |||
| 155 | /*! | ||
| 156 | * Positions inputstream to playing time given in ms | ||
| 157 | * @remarks | ||
| 158 | */ | ||
| 159 | bool PosTime(int ms); | ||
| 160 | |||
| 161 | |||
| 162 | /*! | ||
| 163 | * Check if the backend support pausing the currently playing stream | ||
| 164 | * This will enable/disable the pause button in XBMC based on the return value | ||
| 165 | * @return false if the InputStream addon/backend does not support pausing, true if possible | ||
| 166 | */ | ||
| 167 | bool CanPauseStream(); | ||
| 168 | |||
| 169 | /*! | ||
| 170 | * Check if the backend supports seeking for the currently playing stream | ||
| 171 | * This will enable/disable the rewind/forward buttons in XBMC based on the return value | ||
| 172 | * @return false if the InputStream addon/backend does not support seeking, true if possible | ||
| 173 | */ | ||
| 174 | bool CanSeekStream(); | ||
| 175 | |||
| 176 | |||
| 177 | /*! | ||
| 178 | * Read from an open stream. | ||
| 179 | * @param pBuffer The buffer to store the data in. | ||
| 180 | * @param iBufferSize The amount of bytes to read. | ||
| 181 | * @return The amount of bytes that were actually read from the stream. | ||
| 182 | * @remarks Return -1 if this add-on won't provide this function. | ||
| 183 | */ | ||
| 184 | int ReadStream(uint8_t* pBuffer, unsigned int iBufferSize); | ||
| 185 | |||
| 186 | /*! | ||
| 187 | * Seek in a stream. | ||
| 188 | * @param iPosition The position to seek to. | ||
| 189 | * @param iWhence ? | ||
| 190 | * @return The new position. | ||
| 191 | * @remarks Return -1 if this add-on won't provide this function. | ||
| 192 | */ | ||
| 193 | int64_t SeekStream(int64_t iPosition, int iWhence = SEEK_SET); | ||
| 194 | |||
| 195 | /*! | ||
| 196 | * @return The position in the stream that's currently being read. | ||
| 197 | * @remarks Return -1 if this add-on won't provide this function. | ||
| 198 | */ | ||
| 199 | int64_t PositionStream(void); | ||
| 200 | |||
| 201 | /*! | ||
| 202 | * @return The total length of the stream that's currently being read. | ||
| 203 | * @remarks Return -1 if this add-on won't provide this function. | ||
| 204 | */ | ||
| 205 | int64_t LengthStream(void); | ||
| 206 | |||
| 207 | |||
| 208 | /*! | ||
| 209 | * @brief Notify the InputStream addon that XBMC (un)paused the currently playing stream | ||
| 210 | */ | ||
| 211 | void PauseStream(double time); | ||
| 212 | |||
| 213 | |||
| 214 | /*! | ||
| 215 | * Check for real-time streaming | ||
| 216 | * @return true if current stream is real-time | ||
| 217 | */ | ||
| 218 | bool IsRealTimeStream(); | ||
| 219 | |||
| 220 | /*! | ||
| 221 | * Called by XBMC to assign the function pointers of this add-on to pClient. | ||
| 222 | * @param pClient The struct to assign the function pointers to. | ||
| 223 | */ | ||
| 224 | void __declspec(dllexport) get_addon(struct InputStreamAddonFunctions* pClient) | ||
| 225 | { | ||
| 226 | pClient->Open = Open; | ||
| 227 | pClient->Close = Close; | ||
| 228 | pClient->GetPathList = GetPathList; | ||
| 229 | pClient->GetCapabilities = GetCapabilities; | ||
| 230 | |||
| 231 | pClient->GetStreamIds = GetStreamIds; | ||
| 232 | pClient->GetStream = GetStream; | ||
| 233 | pClient->EnableStream = EnableStream; | ||
| 234 | pClient->EnableStreamAtPTS = EnableStreamAtPTS; | ||
| 235 | pClient->DemuxReset = DemuxReset; | ||
| 236 | pClient->DemuxAbort = DemuxAbort; | ||
| 237 | pClient->DemuxFlush = DemuxFlush; | ||
| 238 | pClient->DemuxRead = DemuxRead; | ||
| 239 | pClient->DemuxSeekTime = DemuxSeekTime; | ||
| 240 | pClient->DemuxSetSpeed = DemuxSetSpeed; | ||
| 241 | |||
| 242 | pClient->GetTotalTime = GetTotalTime; | ||
| 243 | pClient->GetTime = GetTime; | ||
| 244 | |||
| 245 | pClient->PosTime = PosTime; | ||
| 246 | |||
| 247 | pClient->CanPauseStream = CanPauseStream; | ||
| 248 | pClient->CanSeekStream = CanSeekStream; | ||
| 249 | |||
| 250 | pClient->ReadStream = ReadStream; | ||
| 251 | pClient->SeekStream = SeekStream; | ||
| 252 | pClient->PositionStream = PositionStream; | ||
| 253 | pClient->LengthStream = LengthStream; | ||
| 254 | pClient->PauseStream = PauseStream; | ||
| 255 | pClient->IsRealTimeStream = IsRealTimeStream; | ||
| 256 | }; | ||
| 257 | }; | ||
