aboutsummaryrefslogtreecommitdiffstats
path: root/src/Partition.hxx
diff options
context:
space:
mode:
Diffstat (limited to 'src/Partition.hxx')
-rw-r--r--src/Partition.hxx57
1 files changed, 38 insertions, 19 deletions
diff --git a/src/Partition.hxx b/src/Partition.hxx
index 512ba3bca..d89c4b41f 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,29 @@
#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"
+#include "Chrono.hxx"
+#include "Compiler.h"
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 +50,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 +81,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);
}
@@ -134,15 +143,15 @@ struct Partition {
}
PlaylistResult SeekSongPosition(unsigned song_position,
- float seek_time) {
+ SongTime seek_time) {
return playlist.SeekSongPosition(pc, song_position, seek_time);
}
- PlaylistResult SeekSongId(unsigned song_id, float seek_time) {
+ PlaylistResult SeekSongId(unsigned song_id, SongTime seek_time) {
return playlist.SeekSongId(pc, song_id, seek_time);
}
- PlaylistResult SeekCurrent(float seek_time, bool relative) {
+ PlaylistResult SeekCurrent(SignedSongTime seek_time, bool relative) {
return playlist.SeekCurrent(pc, seek_time, relative);
}
@@ -166,11 +175,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 +193,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