summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMax Kellermann <max@musicpd.org>2017-02-17 23:18:51 +0100
committerMax Kellermann <max@musicpd.org>2017-02-17 23:18:51 +0100
commitc335f18be7e48ded9726d5bb8ccaa527fdd6d41e (patch)
treec9c3680404a733b3aa0bf904e375f772257f6eac
parent7dc3e73782266f0c51dc89ac9ba9077a51f8f765 (diff)
Partition: add "name" attribute
-rw-r--r--src/Main.cxx1
-rw-r--r--src/Partition.cxx2
-rw-r--r--src/Partition.hxx5
-rw-r--r--src/command/PartitionCommands.cxx6
4 files changed, 12 insertions, 2 deletions
diff --git a/src/Main.cxx b/src/Main.cxx
index d833ba5e3..d2deff4c8 100644
--- a/src/Main.cxx
+++ b/src/Main.cxx
@@ -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,
diff --git a/src/Partition.cxx b/src/Partition.cxx
index 59754d2fb..12137b6bc 100644
--- a/src/Partition.cxx
+++ b/src/Partition.cxx
@@ -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),
diff --git a/src/Partition.hxx b/src/Partition.hxx
index b3c0bad72..4b571ee06 100644
--- a/src/Partition.hxx
+++ b/src/Partition.hxx
@@ -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,
diff --git a/src/command/PartitionCommands.cxx b/src/command/PartitionCommands.cxx
index 78697e579..e3064ad98 100644
--- a/src/command/PartitionCommands.cxx
+++ b/src/command/PartitionCommands.cxx
@@ -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;
}