aboutsummaryrefslogtreecommitdiffstats
path: root/src/player.c
diff options
context:
space:
mode:
authorMax Kellermann <max@duempel.org>2008-08-26 08:27:09 +0200
committerMax Kellermann <max@duempel.org>2008-08-26 08:27:09 +0200
commite8bd9ddc9fc99d31659db1121622bef0f3303fc1 (patch)
treea9fea2466a207ca957fe47c6a0881e957ba2aad5 /src/player.c
parent6104e9690e75046b793c0abe6fc20576fb3da19b (diff)
downloadmpd-e8bd9ddc9fc99d31659db1121622bef0f3303fc1.tar.gz
mpd-e8bd9ddc9fc99d31659db1121622bef0f3303fc1.tar.xz
mpd-e8bd9ddc9fc99d31659db1121622bef0f3303fc1.zip
moved code to player_thread.c
Move code which runs in the player thread to player_thread.c. Having a lot of player thread code in decode.c isn't easy to understand.
Diffstat (limited to '')
-rw-r--r--src/player.c53
1 files changed, 1 insertions, 52 deletions
diff --git a/src/player.c b/src/player.c
index 08ad94096..c2e84c1bd 100644
--- a/src/player.c
+++ b/src/player.c
@@ -17,67 +17,16 @@
*/
#include "player.h"
+#include "player_thread.h"
#include "path.h"
#include "command.h"
-#include "log.h"
#include "playerData.h"
#include "ack.h"
#include "os_compat.h"
#include "main_notify.h"
-#include "audio.h"
static void playerCloseAudio(void);
-static void * player_task(mpd_unused void *arg)
-{
- notify_enter(&pc.notify);
-
- while (1) {
- switch (pc.command) {
- case PLAYER_COMMAND_PLAY:
- decode();
- break;
-
- case PLAYER_COMMAND_STOP:
- case PLAYER_COMMAND_SEEK:
- case PLAYER_COMMAND_PAUSE:
- player_command_finished();
- break;
-
- case PLAYER_COMMAND_CLOSE_AUDIO:
- closeAudioDevice();
- player_command_finished();
- break;
-
- case PLAYER_COMMAND_LOCK_QUEUE:
- pc.queueLockState = PLAYER_QUEUE_LOCKED;
- player_command_finished();
- break;
-
- case PLAYER_COMMAND_UNLOCK_QUEUE:
- pc.queueLockState = PLAYER_QUEUE_UNLOCKED;
- player_command_finished();
- break;
-
- case PLAYER_COMMAND_NONE:
- notify_wait(&pc.notify);
- break;
- }
- }
- return NULL;
-}
-
-void playerInit(void)
-{
- pthread_attr_t attr;
- pthread_t player_thread;
-
- pthread_attr_init(&attr);
- pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_DETACHED);
- if (pthread_create(&player_thread, &attr, player_task, NULL))
- FATAL("Failed to spawn player task: %s\n", strerror(errno));
-}
-
int playerWait(int fd)
{
if (playerStop(fd) < 0)