aboutsummaryrefslogtreecommitdiffstats
path: root/src/player.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/player.c')
-rw-r--r--src/player.c23
1 files changed, 23 insertions, 0 deletions
diff --git a/src/player.c b/src/player.c
index 4870dc739..e2dc21064 100644
--- a/src/player.c
+++ b/src/player.c
@@ -155,6 +155,9 @@ int playerInit(void)
} else if (pc->cycleLogFiles) {
cycle_log_files();
pc->cycleLogFiles = 0;
+ } else if (pc->quit) {
+ pc->quit = 0;
+ break;
} else
my_usleep(10000);
}
@@ -174,6 +177,24 @@ int playerInit(void)
return 0;
}
+int playerQuit(int fd)
+{
+ PlayerControl *pc = &(getPlayerData()->playerControl);
+
+ if (playerStop(fd) < 0)
+ return -1;
+
+ playerCloseAudio();
+
+ if (player_pid > 0) {
+ pc->quit = 1;
+ while (player_pid > 0 && pc->quit)
+ my_usleep(1000);
+ }
+
+ return 0;
+}
+
int playerPlay(int fd, Song * song)
{
PlayerControl *pc = &(getPlayerData()->playerControl);
@@ -341,6 +362,8 @@ void playerCloseAudio(void)
if (playerStop(STDERR_FILENO) < 0)
return;
pc->closeAudio = 1;
+ while (player_pid > 0 && pc->closeAudio)
+ my_usleep(1000);
}
}