Add ClientSettings struct for client settings

Add "player" command line argument to choose the player backend.
Currently there are only for Android different players available.
This commit is contained in:
badaix 2020-02-09 19:57:10 +01:00
parent 83ab1cb260
commit eb3a240120
5 changed files with 129 additions and 70 deletions

View file

@ -23,19 +23,22 @@
#include "message/message.hpp"
#include "message/server_settings.hpp"
#include "message/stream_tags.hpp"
#include "player/pcm_device.hpp"
#include <atomic>
#include <thread>
#ifdef HAS_ALSA
#include "player/alsa_player.hpp"
#elif HAS_OPENSL
#endif
#ifdef HAS_OPENSL
#include "player/opensl_player.hpp"
#elif HAS_OBOE
#endif
#ifdef HAS_OBOE
#include "player/oboe_player.hpp"
#elif HAS_COREAUDIO
#endif
#ifdef HAS_COREAUDIO
#include "player/coreaudio_player.hpp"
#endif
#include "client_connection.hpp"
#include "client_settings.hpp"
#include "metadata.hpp"
#include "stream.hpp"
@ -50,9 +53,9 @@
class Controller : public MessageReceiver
{
public:
Controller(const std::string& clientId, size_t instance, std::shared_ptr<MetadataAdapter> meta);
void start(const PcmDevice& pcmDevice, const std::string& host, size_t port, int latency);
void run(const PcmDevice& pcmDevice, const std::string& host, size_t port, int latency);
Controller(const ClientSettings& settings, std::shared_ptr<MetadataAdapter> meta);
void start();
void run();
void stop();
/// Implementation of MessageReceiver.
@ -66,14 +69,11 @@ public:
private:
void worker();
bool sendTimeSyncMessage(long after = 1000);
std::string hostId_;
ClientSettings settings_;
std::string meta_callback_;
size_t instance_;
std::atomic<bool> active_;
std::thread controllerThread_;
SampleFormat sampleFormat_;
PcmDevice pcmDevice_;
int latency_;
std::unique_ptr<ClientConnection> clientConnection_;
std::shared_ptr<Stream> stream_;
std::unique_ptr<decoder::Decoder> decoder_;