From 2577b55681a97f3eec3fb0e3b5a4fb7f2cb18b8a Mon Sep 17 00:00:00 2001 From: manuel Date: Thu, 30 Aug 2018 00:42:04 +0200 Subject: sync with upstream --- .../kodi-addon-dev-kit/include/kodi/libKODI_game.h | 117 ++++++--------------- 1 file changed, 32 insertions(+), 85 deletions(-) (limited to 'xbmc/addons/kodi-addon-dev-kit/include/kodi/libKODI_game.h') 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 @@ /* - * Copyright (C) 2014-2017 Team Kodi - * http://kodi.tv - * - * This Program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2, or (at your option) - * any later version. - * - * This Program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this Program; see the file COPYING. If not, see - * . + * Copyright (C) 2014-2018 Team Kodi + * This file is part of Kodi - https://kodi.tv * + * SPDX-License-Identifier: GPL-2.0-or-later + * See LICENSES/README.md for more information. */ + #pragma once #include "libXBMC_addon.h" @@ -65,72 +54,58 @@ public: */ void CloseGame(void) { - return m_callbacks->toKodi.CloseGame(m_callbacks->toKodi.kodiInstance); + m_callbacks->toKodi.CloseGame(m_callbacks->toKodi.kodiInstance); } /*! - * \brief Create a video stream for pixel data + * \brief Create a stream for gameplay data * - * \param format The type of pixel data accepted by this stream - * \param width The frame width - * \param height The frame height - * \param rotation The rotation (counter-clockwise) of the video frames + * \param properties The stream properties * - * \return 0 on success or -1 if a video stream is already created + * \return A stream handle, or NULL on failure */ - bool OpenPixelStream(GAME_PIXEL_FORMAT format, unsigned int width, unsigned int height, GAME_VIDEO_ROTATION rotation) + void* OpenStream(const game_stream_properties &properties) { - return m_callbacks->toKodi.OpenPixelStream(m_callbacks->toKodi.kodiInstance, format, width, height, rotation) == 0; + return m_callbacks->toKodi.OpenStream(m_callbacks->toKodi.kodiInstance, &properties); } /*! - * \brief Create a video stream for encoded video data + * \brief Get a buffer for zero-copy stream data * - * \param codec The video format accepted by this stream + * \param stream The stream handle + * \param width The framebuffer width, or 0 for no width specified + * \param height The framebuffer height, or 0 for no height specified + * \param[out] buffer The buffer, or unmodified if false is returned * - * \return 0 on success or -1 if a video stream is already created + * If this returns true, buffer must be freed using ReleaseStreamBuffer(). + * + * \return True if buffer was set, false otherwise */ - bool OpenVideoStream(GAME_VIDEO_CODEC codec) + bool GetStreamBuffer(void *stream, unsigned int width, unsigned int height, game_stream_buffer &buffer) { - return m_callbacks->toKodi.OpenVideoStream(m_callbacks->toKodi.kodiInstance, codec) == 0; + return m_callbacks->toKodi.GetStreamBuffer(m_callbacks->toKodi.kodiInstance, stream, width, height, &buffer); } /*! - * \brief Create an audio stream for PCM audio data - * - * \param format The type of audio data accepted by this stream - * \param channel_map The channel layout terminated by GAME_CH_NULL + * \brief Add a data packet to a stream * - * \return 0 on success or -1 if an audio stream is already created + * \param stream The target stream + * \param packet The data packet */ - bool OpenPCMStream(GAME_PCM_FORMAT format, const GAME_AUDIO_CHANNEL* channel_map) - { - return m_callbacks->toKodi.OpenPCMStream(m_callbacks->toKodi.kodiInstance, format, channel_map) == 0; - } - - /*! - * \brief Create an audio stream for encoded audio data - * - * \param codec The audio format accepted by this stream - * \param channel_map The channel layout terminated by GAME_CH_NULL - * - * \return 0 on success or -1 if an audio stream is already created - */ - bool OpenAudioStream(GAME_AUDIO_CODEC codec, const GAME_AUDIO_CHANNEL* channel_map) + void AddStreamData(void *stream, const game_stream_packet &packet) { - return m_callbacks->toKodi.OpenAudioStream(m_callbacks->toKodi.kodiInstance, codec, channel_map) == 0; + m_callbacks->toKodi.AddStreamData(m_callbacks->toKodi.kodiInstance, stream, &packet); } /*! - * \brief Add a data packet to an audio or video stream + * \brief Free an allocated buffer * - * \param stream The target stream - * \param data The data packet - * \param size The size of the data + * \param stream The stream handle + * \param buffer The buffer returned from GetStreamBuffer() */ - void AddStreamData(GAME_STREAM_TYPE stream, const uint8_t* data, unsigned int size) + void ReleaseStreamBuffer(void *stream, game_stream_buffer &buffer) { - m_callbacks->toKodi.AddStreamData(m_callbacks->toKodi.kodiInstance, stream, data, size); + m_callbacks->toKodi.ReleaseStreamBuffer(m_callbacks->toKodi.kodiInstance, stream, &buffer); } /*! @@ -138,33 +113,13 @@ public: * * \param stream The stream to close */ - void CloseStream(GAME_STREAM_TYPE stream) + void CloseStream(void *stream) { m_callbacks->toKodi.CloseStream(m_callbacks->toKodi.kodiInstance, stream); } // -- Hardware rendering callbacks ------------------------------------------- - /*! - * \brief Enable hardware rendering - * - * \param hw_info A struct of properties for the hardware rendering system - */ - void EnableHardwareRendering(const struct game_hw_info* hw_info) - { - return m_callbacks->toKodi.EnableHardwareRendering(m_callbacks->toKodi.kodiInstance, hw_info); - } - - /*! - * \brief Get the framebuffer for rendering - * - * \return The framebuffer - */ - uintptr_t HwGetCurrentFramebuffer(void) - { - return m_callbacks->toKodi.HwGetCurrentFramebuffer(m_callbacks->toKodi.kodiInstance); - } - /*! * \brief Get a symbol from the hardware context * @@ -177,14 +132,6 @@ public: return m_callbacks->toKodi.HwGetProcAddress(m_callbacks->toKodi.kodiInstance, sym); } - /*! - * \brief Called when a frame is being rendered - */ - void RenderFrame() - { - return m_callbacks->toKodi.RenderFrame(m_callbacks->toKodi.kodiInstance); - } - // --- Input callbacks ------------------------------------------------------- /*! -- cgit v1.2.3