Debian Codegraph @

xbmc/games/addons/streams/IGameClientStream.h

raw
1 /*
2 * Copyright (C) 2018 Team Kodi
3 * This file is part of Kodi - https://kodi.tv
4 *
5 * SPDX-License-Identifier: GPL-2.0-or-later
6 * See LICENSES/README.md for more information.
7 */
8
9 #pragma once
10
11 struct game_stream_buffer;
12 struct game_stream_packet;
13 struct game_stream_properties;
14
15 namespace KODI
16 {
17 namespace RETRO
18 {
19 class IRetroPlayerStream;
20 }
21
22 namespace GAME
23 {
24
25 /*!
26 * \ingroup games
27 */
28 class IGameClientStream
29 {
30 public:
31 virtual ~IGameClientStream() = default;
32
33 /*!
34 * \brief Open the stream
35 *
36 * \param stream The RetroPlayer resource to take ownership of
37 *
38 * \return True if the stream was opened, false otherwise
39 */
40 virtual bool OpenStream(RETRO::IRetroPlayerStream* stream,
41 const game_stream_properties& properties) = 0;
42
43 /*!
44 * \brief Release the RetroPlayer stream resource
45 */
46 virtual void CloseStream() = 0;
47
48 /*!
49 * \brief Get a buffer for zero-copy stream data
50 *
51 * \param width The framebuffer width, or 0 for no width specified
52 * \param height The framebuffer height, or 0 for no height specified
53 * \param[out] buffer The buffer, or unmodified if false is returned
54 *
55 * If this returns true, buffer must be freed using ReleaseBuffer().
56 *
57 * \return True if buffer was set, false otherwise
58 */
59 virtual bool GetBuffer(unsigned int width, unsigned int height, game_stream_buffer& buffer)
60 {
61 return false;
62 }
63
64 /*!
65 * \brief Free an allocated buffer
66 *
67 * \param buffer The buffer returned from GetBuffer()
68 */
69 virtual void ReleaseBuffer(game_stream_buffer& buffer) {}
70
71 /*!
72 * \brief Add a data packet to a stream
73 *
74 * \param packet The data packet
75 */
76 virtual void AddData(const game_stream_packet& packet) = 0;
77 };
78
79 } // namespace GAME
80 } // namespace KODI