aboutsummaryrefslogtreecommitdiffstats
path: root/src/player.c
diff options
context:
space:
mode:
authorMax Kellermann <max@duempel.org>2008-04-12 04:18:49 +0000
committerEric Wong <normalperson@yhbt.net>2008-04-12 04:18:49 +0000
commitb0e47fce09be9774ff23f58042c8f760396c1ddc (patch)
treeb393583287ebcb71678113d220f71f97fc3e95b8 /src/player.c
parent7642d10fe90f77e21addbbbdfb02d95494655bc2 (diff)
downloadmpd-b0e47fce09be9774ff23f58042c8f760396c1ddc.tar.gz
mpd-b0e47fce09be9774ff23f58042c8f760396c1ddc.tar.xz
mpd-b0e47fce09be9774ff23f58042c8f760396c1ddc.zip
pass pc to player notify functions
Same as the previous patch: less global variables. git-svn-id: https://svn.musicpd.org/mpd/trunk@7317 09075e82-0dd4-0310-85a5-a0d7c8717e4f
Diffstat (limited to 'src/player.c')
-rw-r--r--src/player.c27
1 files changed, 12 insertions, 15 deletions
diff --git a/src/player.c b/src/player.c
index 5ef35f214..b930056e2 100644
--- a/src/player.c
+++ b/src/player.c
@@ -35,22 +35,19 @@
static void playerCloseAudio(void);
-void wakeup_player_nb(void)
+void wakeup_player_nb(PlayerControl *pc)
{
- PlayerControl *pc = &(getPlayerData()->playerControl);
notifySignal(&pc->notify);
}
-static void wakeup_player(void)
+static void wakeup_player(PlayerControl *pc)
{
- PlayerControl *pc = &(getPlayerData()->playerControl);
notifySignal(&pc->notify);
wait_main_task();
}
-void player_sleep(void)
+void player_sleep(PlayerControl *pc)
{
- PlayerControl *pc = &(getPlayerData()->playerControl);
notifyWait(&pc->notify);
}
@@ -80,7 +77,7 @@ static void * player_task(mpd_unused void *unused)
pc->queueLockState = PLAYER_QUEUE_UNLOCKED;
pc->unlockQueue = 0;
} else {
- player_sleep();
+ player_sleep(pc);
continue;
}
/* we did something, tell the main task about it */
@@ -129,7 +126,7 @@ int playerPlay(int fd, Song * song)
pc->play = 1;
/* FIXME: _nb() variant is probably wrong here, and everywhere... */
- do { wakeup_player_nb(); } while (pc->play);
+ do { wakeup_player_nb(pc); } while (pc->play);
return 0;
}
@@ -140,7 +137,7 @@ int playerStop(int fd)
if (pc->state != PLAYER_STATE_STOP) {
pc->stop = 1;
- do { wakeup_player(); } while (pc->stop);
+ do { wakeup_player(pc); } while (pc->stop);
}
pc->queueState = PLAYER_QUEUE_BLANK;
@@ -160,7 +157,7 @@ int playerPause(int fd)
if (pc->state != PLAYER_STATE_STOP) {
pc->pause = 1;
- do { wakeup_player(); } while (pc->pause);
+ do { wakeup_player(pc); } while (pc->pause);
}
return 0;
@@ -253,7 +250,7 @@ static void playerCloseAudio(void)
if (playerStop(STDERR_FILENO) < 0)
return;
pc->closeAudio = 1;
- do { wakeup_player(); } while (pc->closeAudio);
+ do { wakeup_player(pc); } while (pc->closeAudio);
}
int queueSong(Song * song)
@@ -281,7 +278,7 @@ void setQueueState(int queueState)
PlayerControl *pc = &(getPlayerData()->playerControl);
pc->queueState = queueState;
- wakeup_player_nb();
+ wakeup_player_nb(pc);
}
void playerQueueLock(void)
@@ -290,7 +287,7 @@ void playerQueueLock(void)
if (pc->queueLockState == PLAYER_QUEUE_UNLOCKED) {
pc->lockQueue = 1;
- do { wakeup_player(); } while (pc->lockQueue);
+ do { wakeup_player(pc); } while (pc->lockQueue);
}
}
@@ -300,7 +297,7 @@ void playerQueueUnlock(void)
if (pc->queueLockState == PLAYER_QUEUE_LOCKED) {
pc->unlockQueue = 1;
- do { wakeup_player(); } while (pc->unlockQueue);
+ do { wakeup_player(pc); } while (pc->unlockQueue);
}
}
@@ -323,7 +320,7 @@ int playerSeek(int fd, Song * song, float seek_time)
pc->seekWhere = seek_time;
pc->seek = 1;
/* FIXME: _nb() is probably wrong here, too */
- do { wakeup_player_nb(); } while (pc->seek);
+ do { wakeup_player_nb(pc); } while (pc->seek);
}
return 0;