aboutsummaryrefslogtreecommitdiffstats
path: root/src/Partition.hxx
diff options
context:
space:
mode:
Diffstat (limited to 'src/Partition.hxx')
-rw-r--r--src/Partition.hxx49
1 files changed, 33 insertions, 16 deletions
diff --git a/src/Partition.hxx b/src/Partition.hxx
index 512ba3bca..4341a9ed3 100644
--- a/src/Partition.hxx
+++ b/src/Partition.hxx
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2003-2013 The Music Player Daemon Project
+ * Copyright (C) 2003-2014 The Music Player Daemon Project
* http://www.musicpd.org
*
* This program is free software; you can redistribute it and/or modify
@@ -20,20 +20,27 @@
#ifndef MPD_PARTITION_HXX
#define MPD_PARTITION_HXX
-#include "Playlist.hxx"
+#include "queue/Playlist.hxx"
+#include "output/MultipleOutputs.hxx"
+#include "mixer/Listener.hxx"
#include "PlayerControl.hxx"
+#include "PlayerListener.hxx"
struct Instance;
+class MultipleOutputs;
+class SongLoader;
/**
* A partition of the Music Player Daemon. It is a separate unit with
* a playlist, a player, outputs etc.
*/
-struct Partition {
+struct Partition final : private PlayerListener, private MixerListener {
Instance &instance;
struct playlist playlist;
+ MultipleOutputs outputs;
+
PlayerControl pc;
Partition(Instance &_instance,
@@ -41,21 +48,17 @@ struct Partition {
unsigned buffer_chunks,
unsigned buffered_before_play)
:instance(_instance), playlist(max_length),
- pc(buffer_chunks, buffered_before_play) {
- }
+ outputs(*this),
+ pc(*this, outputs, buffer_chunks, buffered_before_play) {}
void ClearQueue() {
playlist.Clear(pc);
}
- PlaylistResult AppendFile(const char *path_utf8,
- unsigned *added_id=nullptr) {
- return playlist.AppendFile(pc, path_utf8, added_id);
- }
-
- PlaylistResult AppendURI(const char *uri_utf8,
- unsigned *added_id=nullptr) {
- return playlist.AppendURI(pc, uri_utf8, added_id);
+ unsigned AppendURI(const SongLoader &loader,
+ const char *uri_utf8,
+ Error &error) {
+ return playlist.AppendURI(pc, loader, uri_utf8, error);
}
PlaylistResult DeletePosition(unsigned position) {
@@ -76,10 +79,14 @@ struct Partition {
return playlist.DeleteRange(pc, start, end);
}
- void DeleteSong(const Song &song) {
- playlist.DeleteSong(pc, song);
+#ifdef ENABLE_DATABASE
+
+ void DeleteSong(const char *uri) {
+ playlist.DeleteSong(pc, uri);
}
+#endif
+
void Shuffle(unsigned start, unsigned end) {
playlist.Shuffle(pc, start, end);
}
@@ -166,11 +173,13 @@ struct Partition {
playlist.SetConsume(new_value);
}
+#ifdef ENABLE_DATABASE
/**
* The database has been modified. Propagate the change to
* all subsystems.
*/
- void DatabaseModified();
+ void DatabaseModified(const Database &db);
+#endif
/**
* A tag in the play queue has been modified by the player
@@ -182,6 +191,14 @@ struct Partition {
* Synchronize the player with the play queue.
*/
void SyncWithPlayer();
+
+private:
+ /* virtual methods from class PlayerListener */
+ virtual void OnPlayerSync() override;
+ virtual void OnPlayerTagModified() override;
+
+ /* virtual methods from class MixerListener */
+ virtual void OnMixerVolumeChanged(Mixer &mixer, int volume) override;
};
#endif