diff options
| author | manuel <manuel@mausz.at> | 2018-08-30 00:42:04 +0200 |
|---|---|---|
| committer | manuel <manuel@mausz.at> | 2018-08-30 00:42:04 +0200 |
| commit | 2577b55681a97f3eec3fb0e3b5a4fb7f2cb18b8a (patch) | |
| tree | cc9e1f8ea69eebca8416677b2470a5b3f11a850e /xbmc/addons/kodi-addon-dev-kit/include/kodi/libKODI_game.h | |
| parent | b3d195f0188758a14875a5a2f270e4fd190a679f (diff) | |
| download | kodi-pvr-build-2577b55681a97f3eec3fb0e3b5a4fb7f2cb18b8a.tar.gz kodi-pvr-build-2577b55681a97f3eec3fb0e3b5a4fb7f2cb18b8a.tar.bz2 kodi-pvr-build-2577b55681a97f3eec3fb0e3b5a4fb7f2cb18b8a.zip | |
sync with upstream
Diffstat (limited to 'xbmc/addons/kodi-addon-dev-kit/include/kodi/libKODI_game.h')
| -rw-r--r-- | xbmc/addons/kodi-addon-dev-kit/include/kodi/libKODI_game.h | 117 |
1 files changed, 32 insertions, 85 deletions
diff --git a/xbmc/addons/kodi-addon-dev-kit/include/kodi/libKODI_game.h b/xbmc/addons/kodi-addon-dev-kit/include/kodi/libKODI_game.h index 2774afd..ca8cba9 100644 --- a/xbmc/addons/kodi-addon-dev-kit/include/kodi/libKODI_game.h +++ b/xbmc/addons/kodi-addon-dev-kit/include/kodi/libKODI_game.h | |||
| @@ -1,22 +1,11 @@ | |||
| 1 | /* | 1 | /* |
| 2 | * Copyright (C) 2014-2017 Team Kodi | 2 | * Copyright (C) 2014-2018 Team Kodi |
| 3 | * http://kodi.tv | 3 | * This file is part of Kodi - https://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 | * | 4 | * |
| 5 | * SPDX-License-Identifier: GPL-2.0-or-later | ||
| 6 | * See LICENSES/README.md for more information. | ||
| 19 | */ | 7 | */ |
| 8 | |||
| 20 | #pragma once | 9 | #pragma once |
| 21 | 10 | ||
| 22 | #include "libXBMC_addon.h" | 11 | #include "libXBMC_addon.h" |
| @@ -65,72 +54,58 @@ public: | |||
| 65 | */ | 54 | */ |
| 66 | void CloseGame(void) | 55 | void CloseGame(void) |
| 67 | { | 56 | { |
| 68 | return m_callbacks->toKodi.CloseGame(m_callbacks->toKodi.kodiInstance); | 57 | m_callbacks->toKodi.CloseGame(m_callbacks->toKodi.kodiInstance); |
| 69 | } | 58 | } |
| 70 | 59 | ||
| 71 | /*! | 60 | /*! |
| 72 | * \brief Create a video stream for pixel data | 61 | * \brief Create a stream for gameplay data |
| 73 | * | 62 | * |
| 74 | * \param format The type of pixel data accepted by this stream | 63 | * \param properties The stream properties |
| 75 | * \param width The frame width | ||
| 76 | * \param height The frame height | ||
| 77 | * \param rotation The rotation (counter-clockwise) of the video frames | ||
| 78 | * | 64 | * |
| 79 | * \return 0 on success or -1 if a video stream is already created | 65 | * \return A stream handle, or NULL on failure |
| 80 | */ | 66 | */ |
| 81 | bool OpenPixelStream(GAME_PIXEL_FORMAT format, unsigned int width, unsigned int height, GAME_VIDEO_ROTATION rotation) | 67 | void* OpenStream(const game_stream_properties &properties) |
| 82 | { | 68 | { |
| 83 | return m_callbacks->toKodi.OpenPixelStream(m_callbacks->toKodi.kodiInstance, format, width, height, rotation) == 0; | 69 | return m_callbacks->toKodi.OpenStream(m_callbacks->toKodi.kodiInstance, &properties); |
| 84 | } | 70 | } |
| 85 | 71 | ||
| 86 | /*! | 72 | /*! |
| 87 | * \brief Create a video stream for encoded video data | 73 | * \brief Get a buffer for zero-copy stream data |
| 88 | * | 74 | * |
| 89 | * \param codec The video format accepted by this stream | 75 | * \param stream The stream handle |
| 76 | * \param width The framebuffer width, or 0 for no width specified | ||
| 77 | * \param height The framebuffer height, or 0 for no height specified | ||
| 78 | * \param[out] buffer The buffer, or unmodified if false is returned | ||
| 90 | * | 79 | * |
| 91 | * \return 0 on success or -1 if a video stream is already created | 80 | * If this returns true, buffer must be freed using ReleaseStreamBuffer(). |
| 81 | * | ||
| 82 | * \return True if buffer was set, false otherwise | ||
| 92 | */ | 83 | */ |
| 93 | bool OpenVideoStream(GAME_VIDEO_CODEC codec) | 84 | bool GetStreamBuffer(void *stream, unsigned int width, unsigned int height, game_stream_buffer &buffer) |
| 94 | { | 85 | { |
| 95 | return m_callbacks->toKodi.OpenVideoStream(m_callbacks->toKodi.kodiInstance, codec) == 0; | 86 | return m_callbacks->toKodi.GetStreamBuffer(m_callbacks->toKodi.kodiInstance, stream, width, height, &buffer); |
| 96 | } | 87 | } |
| 97 | 88 | ||
| 98 | /*! | 89 | /*! |
| 99 | * \brief Create an audio stream for PCM audio data | 90 | * \brief Add a data packet to a stream |
| 100 | * | ||
| 101 | * \param format The type of audio data accepted by this stream | ||
| 102 | * \param channel_map The channel layout terminated by GAME_CH_NULL | ||
| 103 | * | 91 | * |
| 104 | * \return 0 on success or -1 if an audio stream is already created | 92 | * \param stream The target stream |
| 93 | * \param packet The data packet | ||
| 105 | */ | 94 | */ |
| 106 | bool OpenPCMStream(GAME_PCM_FORMAT format, const GAME_AUDIO_CHANNEL* channel_map) | 95 | void AddStreamData(void *stream, const game_stream_packet &packet) |
| 107 | { | ||
| 108 | return m_callbacks->toKodi.OpenPCMStream(m_callbacks->toKodi.kodiInstance, format, channel_map) == 0; | ||
| 109 | } | ||
| 110 | |||
| 111 | /*! | ||
| 112 | * \brief Create an audio stream for encoded audio data | ||
| 113 | * | ||
| 114 | * \param codec The audio format accepted by this stream | ||
| 115 | * \param channel_map The channel layout terminated by GAME_CH_NULL | ||
| 116 | * | ||
| 117 | * \return 0 on success or -1 if an audio stream is already created | ||
| 118 | */ | ||
| 119 | bool OpenAudioStream(GAME_AUDIO_CODEC codec, const GAME_AUDIO_CHANNEL* channel_map) | ||
| 120 | { | 96 | { |
| 121 | return m_callbacks->toKodi.OpenAudioStream(m_callbacks->toKodi.kodiInstance, codec, channel_map) == 0; | 97 | m_callbacks->toKodi.AddStreamData(m_callbacks->toKodi.kodiInstance, stream, &packet); |
| 122 | } | 98 | } |
| 123 | 99 | ||
| 124 | /*! | 100 | /*! |
| 125 | * \brief Add a data packet to an audio or video stream | 101 | * \brief Free an allocated buffer |
| 126 | * | 102 | * |
| 127 | * \param stream The target stream | 103 | * \param stream The stream handle |
| 128 | * \param data The data packet | 104 | * \param buffer The buffer returned from GetStreamBuffer() |
| 129 | * \param size The size of the data | ||
| 130 | */ | 105 | */ |
| 131 | void AddStreamData(GAME_STREAM_TYPE stream, const uint8_t* data, unsigned int size) | 106 | void ReleaseStreamBuffer(void *stream, game_stream_buffer &buffer) |
| 132 | { | 107 | { |
| 133 | m_callbacks->toKodi.AddStreamData(m_callbacks->toKodi.kodiInstance, stream, data, size); | 108 | m_callbacks->toKodi.ReleaseStreamBuffer(m_callbacks->toKodi.kodiInstance, stream, &buffer); |
| 134 | } | 109 | } |
| 135 | 110 | ||
| 136 | /*! | 111 | /*! |
| @@ -138,7 +113,7 @@ public: | |||
| 138 | * | 113 | * |
| 139 | * \param stream The stream to close | 114 | * \param stream The stream to close |
| 140 | */ | 115 | */ |
| 141 | void CloseStream(GAME_STREAM_TYPE stream) | 116 | void CloseStream(void *stream) |
| 142 | { | 117 | { |
| 143 | m_callbacks->toKodi.CloseStream(m_callbacks->toKodi.kodiInstance, stream); | 118 | m_callbacks->toKodi.CloseStream(m_callbacks->toKodi.kodiInstance, stream); |
| 144 | } | 119 | } |
| @@ -146,26 +121,6 @@ public: | |||
| 146 | // -- Hardware rendering callbacks ------------------------------------------- | 121 | // -- Hardware rendering callbacks ------------------------------------------- |
| 147 | 122 | ||
| 148 | /*! | 123 | /*! |
| 149 | * \brief Enable hardware rendering | ||
| 150 | * | ||
| 151 | * \param hw_info A struct of properties for the hardware rendering system | ||
| 152 | */ | ||
| 153 | void EnableHardwareRendering(const struct game_hw_info* hw_info) | ||
| 154 | { | ||
| 155 | return m_callbacks->toKodi.EnableHardwareRendering(m_callbacks->toKodi.kodiInstance, hw_info); | ||
| 156 | } | ||
| 157 | |||
| 158 | /*! | ||
| 159 | * \brief Get the framebuffer for rendering | ||
| 160 | * | ||
| 161 | * \return The framebuffer | ||
| 162 | */ | ||
| 163 | uintptr_t HwGetCurrentFramebuffer(void) | ||
| 164 | { | ||
| 165 | return m_callbacks->toKodi.HwGetCurrentFramebuffer(m_callbacks->toKodi.kodiInstance); | ||
| 166 | } | ||
| 167 | |||
| 168 | /*! | ||
| 169 | * \brief Get a symbol from the hardware context | 124 | * \brief Get a symbol from the hardware context |
| 170 | * | 125 | * |
| 171 | * \param symbol The symbol's name | 126 | * \param symbol The symbol's name |
| @@ -177,14 +132,6 @@ public: | |||
| 177 | return m_callbacks->toKodi.HwGetProcAddress(m_callbacks->toKodi.kodiInstance, sym); | 132 | return m_callbacks->toKodi.HwGetProcAddress(m_callbacks->toKodi.kodiInstance, sym); |
| 178 | } | 133 | } |
| 179 | 134 | ||
| 180 | /*! | ||
| 181 | * \brief Called when a frame is being rendered | ||
| 182 | */ | ||
| 183 | void RenderFrame() | ||
| 184 | { | ||
| 185 | return m_callbacks->toKodi.RenderFrame(m_callbacks->toKodi.kodiInstance); | ||
| 186 | } | ||
| 187 | |||
| 188 | // --- Input callbacks ------------------------------------------------------- | 135 | // --- Input callbacks ------------------------------------------------------- |
| 189 | 136 | ||
| 190 | /*! | 137 | /*! |
