| 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 |
#include "IGameClientStream.h" |
| 12 |
#include "addons/kodi-dev-kit/include/kodi/addon-instance/Game.h" |
| 13 |
|
| 14 |
#include <vector> |
| 15 |
|
| 16 |
namespace KODI |
| 17 |
{ |
| 18 |
namespace RETRO |
| 19 |
{ |
| 20 |
class IRetroPlayerStream; |
| 21 |
struct AudioStreamProperties; |
| 22 |
} // namespace RETRO |
| 23 |
|
| 24 |
namespace GAME |
| 25 |
{ |
| 26 |
|
| 27 |
/*! |
| 28 |
* \ingroup games |
| 29 |
*/ |
| 30 |
class CGameClientStreamAudio : public IGameClientStream |
| 31 |
{ |
| 32 |
public: |
| 33 |
CGameClientStreamAudio(double sampleRate); |
| 34 |
~CGameClientStreamAudio() override { CloseStream(); } |
| 35 |
|
| 36 |
// Implementation of IGameClientStream |
| 37 |
bool OpenStream(RETRO::IRetroPlayerStream* stream, |
| 38 |
const game_stream_properties& properties) override; |
| 39 |
void CloseStream() override; |
| 40 |
void AddData(const game_stream_packet& packet) override; |
| 41 |
|
| 42 |
private: |
| 43 |
// Utility functions |
| 44 |
static RETRO::AudioStreamProperties* TranslateProperties( |
| 45 |
const game_stream_audio_properties& properties, double sampleRate); |
| 46 |
|
| 47 |
// Construction parameters |
| 48 |
const double m_sampleRate; |
| 49 |
|
| 50 |
// Stream parameters |
| 51 |
RETRO::IRetroPlayerStream* m_stream = nullptr; |
| 52 |
}; |
| 53 |
|
| 54 |
} // namespace GAME |
| 55 |
} // namespace KODI |