aboutsummaryrefslogtreecommitdiffstats
path: root/src/audioOutput.c
diff options
context:
space:
mode:
authorWarren Dukes <warren.dukes@gmail.com>2004-10-20 17:11:04 +0000
committerWarren Dukes <warren.dukes@gmail.com>2004-10-20 17:11:04 +0000
commitfd2ae556a241c40974ad34eb18556adc0f2f5977 (patch)
tree98dc86bfdb636b89bc9a5f93c0d27995882439db /src/audioOutput.c
parentf4d75d7596c02ed1cc6ff30310268eacfc6e75a8 (diff)
downloadmpd-fd2ae556a241c40974ad34eb18556adc0f2f5977.tar.gz
mpd-fd2ae556a241c40974ad34eb18556adc0f2f5977.tar.xz
mpd-fd2ae556a241c40974ad34eb18556adc0f2f5977.zip
some small cleanups
git-svn-id: https://svn.musicpd.org/mpd/trunk@2280 09075e82-0dd4-0310-85a5-a0d7c8717e4f
Diffstat (limited to 'src/audioOutput.c')
-rw-r--r--src/audioOutput.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/src/audioOutput.c b/src/audioOutput.c
index 1165f247e..5352be012 100644
--- a/src/audioOutput.c
+++ b/src/audioOutput.c
@@ -41,18 +41,21 @@ AudioOutput * newAudioOutput(char * name) {
}
int openAudioOutput(AudioOutput * audioOutput, AudioFormat * audioFormat) {
+ if(audioOutput->open) closeAudioOutput(audioOutput);
return audioOutput->openDeviceFunc(audioOutput, audioFormat);
}
int playAudioOutput(AudioOutput * audioOutput, char * playChunk, int size) {
+ if(!audioOutput->open) return -1;
return audioOutput->playFunc(audioOutput, playChunk, size);
}
void closeAudioOutput(AudioOutput * audioOutput) {
- audioOutput->closeDeviceFunc(audioOutput);
+ if(audioOutput->open) audioOutput->closeDeviceFunc(audioOutput);
}
void finishAudioOutput(AudioOutput * audioOutput) {
+ closeAudioOutput(audioOutput);
audioOutput->finishDriverFunc(audioOutput);
free(audioOutput);
}