aboutsummaryrefslogtreecommitdiffstats
path: root/src/decode.c
diff options
context:
space:
mode:
authorWarren Dukes <warren.dukes@gmail.com>2004-03-20 19:47:05 +0000
committerWarren Dukes <warren.dukes@gmail.com>2004-03-20 19:47:05 +0000
commit6436b0ac8a59914b9edf8987274ef66f69637f36 (patch)
tree1e10694ebb9933db385f0e93a4a98080028b7d76 /src/decode.c
parent115b0d06cda83dc6b34cc590ab61501120489a6b (diff)
downloadmpd-6436b0ac8a59914b9edf8987274ef66f69637f36.tar.gz
mpd-6436b0ac8a59914b9edf8987274ef66f69637f36.tar.xz
mpd-6436b0ac8a59914b9edf8987274ef66f69637f36.zip
close audio device on pause
git-svn-id: https://svn.musicpd.org/mpd/trunk@329 09075e82-0dd4-0310-85a5-a0d7c8717e4f
Diffstat (limited to '')
-rw-r--r--src/decode.c22
1 files changed, 14 insertions, 8 deletions
diff --git a/src/decode.c b/src/decode.c
index 19efd6b1e..b80166af4 100644
--- a/src/decode.c
+++ b/src/decode.c
@@ -180,8 +180,19 @@ void decodeSeek(PlayerControl * pc, AudioFormat * af, DecoderControl * dc,
} \
if(pc->pause) { \
pause = !pause; \
- if(pause) pc->state = PLAYER_STATE_PAUSE; \
- else pc->state = PLAYER_STATE_PLAY; \
+ if(pause) { \
+ finishAudio(); \
+ pc->state = PLAYER_STATE_PAUSE; \
+ } \
+ else { \
+ if(initAudio(NULL)<0) { \
+ strncpy(pc->erroredFile,pc->file,MAXPATHLEN); \
+ pc->error = PLAYER_ERROR_AUDIO; \
+ quitDecode(pc,dc); \
+ return; \
+ } \
+ pc->state = PLAYER_STATE_PLAY; \
+ } \
pc->pause = 0; \
kill(getppid(),SIGUSR1); \
} \
@@ -296,7 +307,6 @@ void decode() {
{
/* PARENT */
- char silence[CHUNK_SIZE];
int pause = 0;
int quit = 0;
int bbp = buffered_before_play;
@@ -306,8 +316,6 @@ void decode() {
int nextChunk = -1;
int test;
- memset(silence,0,CHUNK_SIZE);
-
if(waitOnDecode(pc,af,dc,cb)<0) return;
pc->state = PLAYER_STATE_PLAY;
@@ -348,9 +356,7 @@ void decode() {
}
else doCrossFade = -1;
}
- if(pause) {
- if(playAudio(silence,CHUNK_SIZE)<0) quit = 1;
- }
+ if(pause) usleep(10000);
else if((cb->begin!=cb->end || cb->wrap) &&
cb->begin!=cb->next)
{