Partition: add "name" attribute

This commit is contained in:
Max Kellermann 2017-02-17 23:18:51 +01:00
parent 7dc3e73782
commit c335f18be7
4 changed files with 12 additions and 2 deletions

View File

@ -353,6 +353,7 @@ initialize_decoder_and_player(const ReplayGainConfig &replay_gain_config)
}
instance->partition = new Partition(*instance,
"default",
max_length,
buffered_chunks,
buffered_before_play,

View File

@ -25,12 +25,14 @@
#include "IdleFlags.hxx"
Partition::Partition(Instance &_instance,
const char *_name,
unsigned max_length,
unsigned buffer_chunks,
unsigned buffered_before_play,
AudioFormat configured_audio_format,
const ReplayGainConfig &replay_gain_config)
:instance(_instance),
name(_name),
global_events(instance.event_loop, BIND_THIS_METHOD(OnGlobalEvent)),
playlist(max_length, *this),
outputs(*this),

View File

@ -31,6 +31,8 @@
#include "Chrono.hxx"
#include "Compiler.h"
#include <string>
struct Instance;
class MultipleOutputs;
class SongLoader;
@ -45,6 +47,8 @@ struct Partition final : QueueListener, PlayerListener, MixerListener {
Instance &instance;
const std::string name;
MaskMonitor global_events;
struct playlist playlist;
@ -56,6 +60,7 @@ struct Partition final : QueueListener, PlayerListener, MixerListener {
ReplayGainMode replay_gain_mode = ReplayGainMode::OFF;
Partition(Instance &_instance,
const char *_name,
unsigned max_length,
unsigned buffer_chunks,
unsigned buffered_before_play,

View File

@ -20,11 +20,13 @@
#include "config.h"
#include "PartitionCommands.hxx"
#include "Request.hxx"
#include "Partition.hxx"
#include "client/Client.hxx"
#include "client/Response.hxx"
CommandResult
handle_listpartitions(Client &, Request, Response &r)
handle_listpartitions(Client &client, Request, Response &r)
{
r.Write("partition: default\n");
r.Format("partition: %s\n", client.partition.name.c_str());
return CommandResult::OK;
}