aboutsummaryrefslogtreecommitdiffstats
path: root/src/audio.c
diff options
context:
space:
mode:
authorWarren Dukes <warren.dukes@gmail.com>2004-04-11 04:49:27 +0000
committerWarren Dukes <warren.dukes@gmail.com>2004-04-11 04:49:27 +0000
commit7091235a683bfcaea32e95a81b86842de7657aa7 (patch)
treed77515597b5350bd39dbe85d5f94d9f72b0cf6bb /src/audio.c
parent30d9589cb324d7657fc971ceb6574eb2fd7c9f5e (diff)
downloadmpd-7091235a683bfcaea32e95a81b86842de7657aa7.tar.gz
mpd-7091235a683bfcaea32e95a81b86842de7657aa7.tar.xz
mpd-7091235a683bfcaea32e95a81b86842de7657aa7.zip
add --disable-audio configure option
git-svn-id: https://svn.musicpd.org/mpd/trunk@679 09075e82-0dd4-0310-85a5-a0d7c8717e4f
Diffstat (limited to 'src/audio.c')
-rw-r--r--src/audio.c20
1 files changed, 18 insertions, 2 deletions
diff --git a/src/audio.c b/src/audio.c
index f8ad963ea..df497203e 100644
--- a/src/audio.c
+++ b/src/audio.c
@@ -25,6 +25,9 @@
#include <assert.h>
#include <signal.h>
+#ifdef HAVE_AUDIO
+#include <ao/ao.h>
+
int audio_write_size;
int audio_ao_driver_id;
@@ -32,8 +35,10 @@ ao_option * audio_ao_options;
AudioFormat audio_format;
ao_device * audio_device = NULL;
+#endif
void initAudioDriver() {
+#ifdef HAVE_AUDIO
ao_info * ai;
char * dup;
char * stk1;
@@ -107,15 +112,19 @@ void initAudioDriver() {
}
}
free(dup);
+#endif
}
void finishAudioDriver() {
+#ifdef HAVE_AUDIO
ao_free_options(audio_ao_options);
ao_shutdown();
+#endif
}
int isCurrentAudioFormat(AudioFormat * audioFormat) {
+#ifdef HAVE_AUDIO
if(!audio_device || !audioFormat) return 0;
if(audio_format.bits!=audioFormat->bits ||
@@ -124,11 +133,12 @@ int isCurrentAudioFormat(AudioFormat * audioFormat) {
{
return 0;
}
-
+#endif
return 1;
}
int initAudio(AudioFormat * audioFormat) {
+#ifdef HAVE_AUDIO
ao_sample_format format;
if(audio_device && !isCurrentAudioFormat(audioFormat)) {
@@ -154,12 +164,13 @@ int initAudio(AudioFormat * audioFormat) {
if(audio_device==NULL) return -1;
}
-
+#endif
return 0;
}
int playAudio(char * playChunk, int size) {
+#ifdef HAVE_AUDIO
int send;
if(audio_device==NULL) {
@@ -181,19 +192,23 @@ int playAudio(char * playChunk, int size) {
size-=send;
}
+#endif
return 0;
}
void finishAudio() {
+#ifdef HAVE_AUDIO
if(audio_device) {
blockSignals();
ao_close(audio_device);
audio_device = NULL;
unblockSignals();
}
+#endif
}
void audioError() {
+#ifdef HAVE_AUDIO
if(errno==AO_ENOTLIVE) {
ERROR("not a live ao device\n");
}
@@ -203,4 +218,5 @@ void audioError() {
else if(errno==AO_EBADOPTION) {
ERROR("bad driver option\n");
}
+#endif
}