aboutsummaryrefslogtreecommitdiffstats
path: root/src/player_control.c
diff options
context:
space:
mode:
authorMax Kellermann <max@duempel.org>2008-10-12 00:07:54 +0200
committerMax Kellermann <max@duempel.org>2008-10-12 00:07:54 +0200
commit35a939e3e766975776ecaf99e0e46f8a3a68faf2 (patch)
treebde09a92e04ff41ac4502d86b2d2eaa504258d44 /src/player_control.c
parent35a16b99238a7daea97bedd244861f5b82e0b0cf (diff)
downloadmpd-35a939e3e766975776ecaf99e0e46f8a3a68faf2.tar.gz
mpd-35a939e3e766975776ecaf99e0e46f8a3a68faf2.tar.xz
mpd-35a939e3e766975776ecaf99e0e46f8a3a68faf2.zip
player: added commands QUEUE and CANCEL
QUEUE adds a new song to the player's queue. CANCEL clears the queue. These two commands replace the old and complex queueState and queueLockState code.
Diffstat (limited to 'src/player_control.c')
-rw-r--r--src/player_control.c46
1 files changed, 7 insertions, 39 deletions
diff --git a/src/player_control.c b/src/player_control.c
index 8ba215ae1..e7935f80f 100644
--- a/src/player_control.c
+++ b/src/player_control.c
@@ -33,8 +33,6 @@ void pc_init(unsigned int buffered_before_play)
pc.command = PLAYER_COMMAND_NONE;
pc.error = PLAYER_ERROR_NOERROR;
pc.state = PLAYER_STATE_STOP;
- pc.queueState = PLAYER_QUEUE_BLANK;
- pc.queueLockState = PLAYER_QUEUE_UNLOCKED;
pc.crossFade = 0;
pc.softwareVolume = 1000;
}
@@ -57,26 +55,22 @@ void
playerPlay(struct song *song)
{
assert(song != NULL);
- assert(pc.queueLockState == PLAYER_QUEUE_UNLOCKED);
if (pc.state != PLAYER_STATE_STOP)
player_command(PLAYER_COMMAND_STOP);
- pc.queueState = PLAYER_QUEUE_BLANK;
-
pc.next_song = song;
player_command(PLAYER_COMMAND_PLAY);
}
-void playerWait(void)
+void pc_cancel(void)
{
- player_command(PLAYER_COMMAND_CLOSE_AUDIO);
-
- assert(pc.queueLockState == PLAYER_QUEUE_UNLOCKED);
+ player_command(PLAYER_COMMAND_CANCEL);
+}
+void playerWait(void)
+{
player_command(PLAYER_COMMAND_CLOSE_AUDIO);
-
- pc.queueState = PLAYER_QUEUE_BLANK;
}
void playerKill(void)
@@ -172,36 +166,10 @@ void
queueSong(struct song *song)
{
assert(song != NULL);
- assert(pc.queueState == PLAYER_QUEUE_BLANK);
+ assert(pc.next_song == NULL);
pc.next_song = song;
- pc.queueState = PLAYER_QUEUE_FULL;
-}
-
-enum player_queue_state getPlayerQueueState(void)
-{
- return pc.queueState;
-}
-
-void setQueueState(enum player_queue_state queueState)
-{
- pc.queueState = queueState;
- notify_signal(&pc.notify);
-}
-
-void playerQueueLock(void)
-{
- assert(pc.queueLockState == PLAYER_QUEUE_UNLOCKED);
- player_command(PLAYER_COMMAND_LOCK_QUEUE);
- assert(pc.queueLockState == PLAYER_QUEUE_LOCKED);
-}
-
-void playerQueueUnlock(void)
-{
- if (pc.queueLockState == PLAYER_QUEUE_LOCKED)
- player_command(PLAYER_COMMAND_UNLOCK_QUEUE);
-
- assert(pc.queueLockState == PLAYER_QUEUE_UNLOCKED);
+ player_command(PLAYER_COMMAND_QUEUE);
}
int