diff options
| author | manuel <manuel@mausz.at> | 2016-12-13 13:45:04 +0100 |
|---|---|---|
| committer | manuel <manuel@mausz.at> | 2016-12-13 13:45:04 +0100 |
| commit | 1e5bdca69f7676b2dbcd64f0f44f31b12b337b7c (patch) | |
| tree | de36b55c5b49c0b266ebf8a5276815d2ac1a8ae5 /xbmc/addons/kodi-addon-dev-kit/include/kodi/kodi_game_callbacks.h | |
| parent | 8cdf8dec703d882b46ca50a769fabb95ffc48e2c (diff) | |
| download | kodi-pvr-build-1e5bdca69f7676b2dbcd64f0f44f31b12b337b7c.tar.gz kodi-pvr-build-1e5bdca69f7676b2dbcd64f0f44f31b12b337b7c.tar.bz2 kodi-pvr-build-1e5bdca69f7676b2dbcd64f0f44f31b12b337b7c.zip | |
sync with upstream
Diffstat (limited to 'xbmc/addons/kodi-addon-dev-kit/include/kodi/kodi_game_callbacks.h')
| -rw-r--r-- | xbmc/addons/kodi-addon-dev-kit/include/kodi/kodi_game_callbacks.h | 161 |
1 files changed, 161 insertions, 0 deletions
diff --git a/xbmc/addons/kodi-addon-dev-kit/include/kodi/kodi_game_callbacks.h b/xbmc/addons/kodi-addon-dev-kit/include/kodi/kodi_game_callbacks.h new file mode 100644 index 0000000..6057f46 --- /dev/null +++ b/xbmc/addons/kodi-addon-dev-kit/include/kodi/kodi_game_callbacks.h | |||
| @@ -0,0 +1,161 @@ | |||
| 1 | /* | ||
| 2 | * Copyright (C) 2014-2016 Team Kodi | ||
| 3 | * http://kodi.tv | ||
| 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 this Program; see the file COPYING. If not, see | ||
| 17 | * <http://www.gnu.org/licenses/>. | ||
| 18 | * | ||
| 19 | */ | ||
| 20 | #ifndef KODI_GAME_CALLBACKS_H_ | ||
| 21 | #define KODI_GAME_CALLBACKS_H_ | ||
| 22 | |||
| 23 | #include "kodi_game_types.h" | ||
| 24 | |||
| 25 | #ifdef __cplusplus | ||
| 26 | extern "C" { | ||
| 27 | #endif | ||
| 28 | |||
| 29 | typedef struct CB_GameLib | ||
| 30 | { | ||
| 31 | // --- Game callbacks -------------------------------------------------------- | ||
| 32 | |||
| 33 | /*! | ||
| 34 | * \brief Requests the frontend to stop the current game | ||
| 35 | */ | ||
| 36 | void (*CloseGame)(void* addonData); | ||
| 37 | |||
| 38 | /*! | ||
| 39 | * \brief Create a video stream for pixel data | ||
| 40 | * | ||
| 41 | * \param format The type of pixel data accepted by this stream | ||
| 42 | * \param width The frame width | ||
| 43 | * \param height The frame height | ||
| 44 | * \param rotation The rotation (counter-clockwise) of the video frames | ||
| 45 | * | ||
| 46 | * \return 0 on success or -1 if a video stream is already created | ||
| 47 | */ | ||
| 48 | int (*OpenPixelStream)(void* addonData, GAME_PIXEL_FORMAT format, unsigned int width, unsigned int height, GAME_VIDEO_ROTATION rotation); | ||
| 49 | |||
| 50 | /*! | ||
| 51 | * \brief Create a video stream for encoded video data | ||
| 52 | * | ||
| 53 | * \param codec The video format accepted by this stream | ||
| 54 | * | ||
| 55 | * \return 0 on success or -1 if a video stream is already created | ||
| 56 | */ | ||
| 57 | int (*OpenVideoStream)(void* addonData, GAME_VIDEO_CODEC codec); | ||
| 58 | |||
| 59 | /*! | ||
| 60 | * \brief Create an audio stream for PCM audio data | ||
| 61 | * | ||
| 62 | * \param format The type of audio data accepted by this stream | ||
| 63 | * \param channel_map The channel layout terminated by GAME_CH_NULL | ||
| 64 | * | ||
| 65 | * \return 0 on success or -1 if an audio stream is already created | ||
| 66 | */ | ||
| 67 | int (*OpenPCMStream)(void* addonData, GAME_PCM_FORMAT format, const GAME_AUDIO_CHANNEL* channel_map); | ||
| 68 | |||
| 69 | /*! | ||
| 70 | * \brief Create an audio stream for encoded audio data | ||
| 71 | * | ||
| 72 | * \param codec The audio format accepted by this stream | ||
| 73 | * \param channel_map The channel layout terminated by GAME_CH_NULL | ||
| 74 | * | ||
| 75 | * \return 0 on success or -1 if an audio stream is already created | ||
| 76 | */ | ||
| 77 | int(*OpenAudioStream)(void* addonData, GAME_AUDIO_CODEC codec, const GAME_AUDIO_CHANNEL* channel_map); | ||
| 78 | |||
| 79 | /*! | ||
| 80 | * \brief Add a data packet to an audio or video stream | ||
| 81 | * | ||
| 82 | * \param stream The target stream | ||
| 83 | * \param data The data packet | ||
| 84 | * \param size The size of the data | ||
| 85 | */ | ||
| 86 | void (*AddStreamData)(void* addonData, GAME_STREAM_TYPE stream, const uint8_t* data, unsigned int size); | ||
| 87 | |||
| 88 | /*! | ||
| 89 | * \brief Free the specified stream | ||
| 90 | * | ||
| 91 | * \param stream The stream to close | ||
| 92 | */ | ||
| 93 | void (*CloseStream)(void* addonData, GAME_STREAM_TYPE stream); | ||
| 94 | |||
| 95 | // -- Hardware rendering callbacks ------------------------------------------- | ||
| 96 | |||
| 97 | /*! | ||
| 98 | * \brief Enable hardware rendering | ||
| 99 | * | ||
| 100 | * \param hw_info A struct of properties for the hardware rendering system | ||
| 101 | */ | ||
| 102 | void (*EnableHardwareRendering)(void* addonData, const game_hw_info* hw_info); | ||
| 103 | |||
| 104 | /*! | ||
| 105 | * \brief Get the framebuffer for rendering | ||
| 106 | * | ||
| 107 | * \return The framebuffer | ||
| 108 | */ | ||
| 109 | uintptr_t (*HwGetCurrentFramebuffer)(void* addonData); | ||
| 110 | |||
| 111 | /*! | ||
| 112 | * \brief Get a symbol from the hardware context | ||
| 113 | * | ||
| 114 | * \param symbol The symbol's name | ||
| 115 | * | ||
| 116 | * \return A function pointer for the specified symbol | ||
| 117 | */ | ||
| 118 | game_proc_address_t (*HwGetProcAddress)(void* addonData, const char* symbol); | ||
| 119 | |||
| 120 | /*! | ||
| 121 | * \brief Called when a frame is being rendered | ||
| 122 | */ | ||
| 123 | void (*RenderFrame)(void* addonData); | ||
| 124 | |||
| 125 | // --- Input callbacks ------------------------------------------------------- | ||
| 126 | |||
| 127 | /*! | ||
| 128 | * \brief Begin reporting events for the specified joystick port | ||
| 129 | * | ||
| 130 | * \param port The zero-indexed port number | ||
| 131 | * | ||
| 132 | * \return true if the port was opened, false otherwise | ||
| 133 | */ | ||
| 134 | bool (*OpenPort)(void* addonData, unsigned int port); | ||
| 135 | |||
| 136 | /*! | ||
| 137 | * \brief End reporting events for the specified port | ||
| 138 | * | ||
| 139 | * \param port The port number passed to OpenPort() | ||
| 140 | */ | ||
| 141 | void (*ClosePort)(void* addonData, unsigned int port); | ||
| 142 | |||
| 143 | /*! | ||
| 144 | * \brief Notify the port of an input event | ||
| 145 | * | ||
| 146 | * \param event The input event | ||
| 147 | * | ||
| 148 | * Input events can arrive for the following sources: | ||
| 149 | * - GAME_INPUT_EVENT_MOTOR | ||
| 150 | * | ||
| 151 | * \return true if the event was handled, false otherwise | ||
| 152 | */ | ||
| 153 | bool (*InputEvent)(void* addonData, const game_input_event* event); | ||
| 154 | |||
| 155 | } CB_GameLib; | ||
| 156 | |||
| 157 | #ifdef __cplusplus | ||
| 158 | } | ||
| 159 | #endif | ||
| 160 | |||
| 161 | #endif // KODI_GAME_CALLBACKS_H_ | ||
