Commit c335f18b authored by Max Kellermann's avatar Max Kellermann

Partition: add "name" attribute

parent 7dc3e737
...@@ -353,6 +353,7 @@ initialize_decoder_and_player(const ReplayGainConfig &replay_gain_config) ...@@ -353,6 +353,7 @@ initialize_decoder_and_player(const ReplayGainConfig &replay_gain_config)
} }
instance->partition = new Partition(*instance, instance->partition = new Partition(*instance,
"default",
max_length, max_length,
buffered_chunks, buffered_chunks,
buffered_before_play, buffered_before_play,
......
...@@ -25,12 +25,14 @@ ...@@ -25,12 +25,14 @@
#include "IdleFlags.hxx" #include "IdleFlags.hxx"
Partition::Partition(Instance &_instance, Partition::Partition(Instance &_instance,
const char *_name,
unsigned max_length, unsigned max_length,
unsigned buffer_chunks, unsigned buffer_chunks,
unsigned buffered_before_play, unsigned buffered_before_play,
AudioFormat configured_audio_format, AudioFormat configured_audio_format,
const ReplayGainConfig &replay_gain_config) const ReplayGainConfig &replay_gain_config)
:instance(_instance), :instance(_instance),
name(_name),
global_events(instance.event_loop, BIND_THIS_METHOD(OnGlobalEvent)), global_events(instance.event_loop, BIND_THIS_METHOD(OnGlobalEvent)),
playlist(max_length, *this), playlist(max_length, *this),
outputs(*this), outputs(*this),
......
...@@ -31,6 +31,8 @@ ...@@ -31,6 +31,8 @@
#include "Chrono.hxx" #include "Chrono.hxx"
#include "Compiler.h" #include "Compiler.h"
#include <string>
struct Instance; struct Instance;
class MultipleOutputs; class MultipleOutputs;
class SongLoader; class SongLoader;
...@@ -45,6 +47,8 @@ struct Partition final : QueueListener, PlayerListener, MixerListener { ...@@ -45,6 +47,8 @@ struct Partition final : QueueListener, PlayerListener, MixerListener {
Instance &instance; Instance &instance;
const std::string name;
MaskMonitor global_events; MaskMonitor global_events;
struct playlist playlist; struct playlist playlist;
...@@ -56,6 +60,7 @@ struct Partition final : QueueListener, PlayerListener, MixerListener { ...@@ -56,6 +60,7 @@ struct Partition final : QueueListener, PlayerListener, MixerListener {
ReplayGainMode replay_gain_mode = ReplayGainMode::OFF; ReplayGainMode replay_gain_mode = ReplayGainMode::OFF;
Partition(Instance &_instance, Partition(Instance &_instance,
const char *_name,
unsigned max_length, unsigned max_length,
unsigned buffer_chunks, unsigned buffer_chunks,
unsigned buffered_before_play, unsigned buffered_before_play,
......
...@@ -20,11 +20,13 @@ ...@@ -20,11 +20,13 @@
#include "config.h" #include "config.h"
#include "PartitionCommands.hxx" #include "PartitionCommands.hxx"
#include "Request.hxx" #include "Request.hxx"
#include "Partition.hxx"
#include "client/Client.hxx"
#include "client/Response.hxx" #include "client/Response.hxx"
CommandResult 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; return CommandResult::OK;
} }
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment