aboutsummaryrefslogtreecommitdiffstats
path: root/src/output/OutputState.cxx
diff options
context:
space:
mode:
authorMax Kellermann <max@duempel.org>2014-01-27 08:20:25 +0100
committerMax Kellermann <max@duempel.org>2014-01-28 09:20:53 +0100
commitf5a923b9d16e4c63942a033d1bdb2ab150aae342 (patch)
tree6e3c39b305fd2a1da2a7b9c2b79a6737ca21a23b /src/output/OutputState.cxx
parent36bab6ef066c6898a791dd15054301f80757b3f6 (diff)
downloadmpd-f5a923b9d16e4c63942a033d1bdb2ab150aae342.tar.gz
mpd-f5a923b9d16e4c63942a033d1bdb2ab150aae342.tar.xz
mpd-f5a923b9d16e4c63942a033d1bdb2ab150aae342.zip
OutputAll: convert to class, move instance to class Partition
Another big chunk of code for multi-player support.
Diffstat (limited to 'src/output/OutputState.cxx')
-rw-r--r--src/output/OutputState.cxx19
1 files changed, 7 insertions, 12 deletions
diff --git a/src/output/OutputState.cxx b/src/output/OutputState.cxx
index 1141abeda..abd5dd2ae 100644
--- a/src/output/OutputState.cxx
+++ b/src/output/OutputState.cxx
@@ -24,7 +24,7 @@
#include "config.h"
#include "OutputState.hxx"
-#include "OutputAll.hxx"
+#include "MultipleOutputs.hxx"
#include "OutputInternal.hxx"
#include "OutputError.hxx"
#include "Log.hxx"
@@ -38,27 +38,22 @@
unsigned audio_output_state_version;
void
-audio_output_state_save(FILE *fp)
+audio_output_state_save(FILE *fp, const MultipleOutputs &outputs)
{
- unsigned n = audio_output_count();
-
- assert(n > 0);
-
- for (unsigned i = 0; i < n; ++i) {
- const struct audio_output *ao = audio_output_get(i);
+ for (unsigned i = 0, n = outputs.Size(); i != n; ++i) {
+ const audio_output &ao = outputs.Get(i);
fprintf(fp, AUDIO_DEVICE_STATE "%d:%s\n",
- ao->enabled, ao->name);
+ ao.enabled, ao.name);
}
}
bool
-audio_output_state_read(const char *line)
+audio_output_state_read(const char *line, MultipleOutputs &outputs)
{
long value;
char *endptr;
const char *name;
- struct audio_output *ao;
if (!StringStartsWith(line, AUDIO_DEVICE_STATE))
return false;
@@ -74,7 +69,7 @@ audio_output_state_read(const char *line)
return true;
name = endptr + 1;
- ao = audio_output_find(name);
+ audio_output *ao = outputs.FindByName(name);
if (ao == NULL) {
FormatDebug(output_domain,
"Ignoring device state for '%s'", name);