add --disable-audio configure option

git-svn-id: https://svn.musicpd.org/mpd/trunk@679 09075e82-0dd4-0310-85a5-a0d7c8717e4f
This commit is contained in:
Warren Dukes 2004-04-11 04:49:27 +00:00
parent 30d9589cb3
commit 7091235a68
5 changed files with 31 additions and 8 deletions

View File

@ -27,6 +27,7 @@ AM_CONFIG_HEADER(config.h)
MPD_CFLAGS="-Wall" MPD_CFLAGS="-Wall"
MPD_LIBS="" MPD_LIBS=""
AC_ARG_ENABLE(audio,[ --disable-audio disable support for playing],,enable_ao=yes)
AC_ARG_ENABLE(iconv,[ --disable-iconv disable iconv support],,enable_iconv=yes) AC_ARG_ENABLE(iconv,[ --disable-iconv disable iconv support],,enable_iconv=yes)
AC_ARG_ENABLE(ipv6,[ --disable-ipv6 disable IPv6 support],,enable_ipv6=yes) AC_ARG_ENABLE(ipv6,[ --disable-ipv6 disable IPv6 support],,enable_ipv6=yes)
AC_ARG_ENABLE(alsa,[ --disable-alsa disable Alsa Mixer support],,enable_alsa=yes) AC_ARG_ENABLE(alsa,[ --disable-alsa disable Alsa Mixer support],,enable_alsa=yes)
@ -91,7 +92,11 @@ AP_maGiC_VALUE
) )
fi fi
XIPH_PATH_AO(MPD_LIBS="$MPD_LIBS $AO_LIBS" MPD_CFLAGS="$MPD_CFLAGS $AO_CFLAGS",AC_MSG_ERROR(Must have libao installed!!!)) if test x$enable_ao = xyes; then
XIPH_PATH_AO(MPD_LIBS="$MPD_LIBS $AO_LIBS" MPD_CFLAGS="$MPD_CFLAGS $AO_CFLAGS",AC_MSG_ERROR(Must have libao installed!!!))
AC_DEFINE(HAVE_AUDIO, 1, [Define to play audio])
fi
AC_CHECK_HEADER(sys/soundcard.h,enable_oss=yes,[AC_MSG_WARN(Soundcard headers not found -- disabling OSS mixer);enable_oss=no;AC_DEFINE(NO_OSS_MIXER,1,[Define to disable OSS mixer support])]) AC_CHECK_HEADER(sys/soundcard.h,enable_oss=yes,[AC_MSG_WARN(Soundcard headers not found -- disabling OSS mixer);enable_oss=no;AC_DEFINE(NO_OSS_MIXER,1,[Define to disable OSS mixer support])])
if test x$enable_alsa = xyes; then if test x$enable_alsa = xyes; then
@ -502,6 +507,12 @@ fi
echo "" echo ""
echo "Audio Format Support:" echo "Audio Format Support:"
if test x$enable_ao = xyes; then
echo "Playing audio .................enabled"
else
echo "Playing audio .................disabled"
fi
if test x$enable_id3 = xyes; then if test x$enable_id3 = xyes; then
echo "ID3 tag support ...............enabled" echo "ID3 tag support ...............enabled"
if test x$use_mpd_id3tag = xyes; then if test x$use_mpd_id3tag = xyes; then

View File

@ -25,6 +25,9 @@
#include <assert.h> #include <assert.h>
#include <signal.h> #include <signal.h>
#ifdef HAVE_AUDIO
#include <ao/ao.h>
int audio_write_size; int audio_write_size;
int audio_ao_driver_id; int audio_ao_driver_id;
@ -32,8 +35,10 @@ ao_option * audio_ao_options;
AudioFormat audio_format; AudioFormat audio_format;
ao_device * audio_device = NULL; ao_device * audio_device = NULL;
#endif
void initAudioDriver() { void initAudioDriver() {
#ifdef HAVE_AUDIO
ao_info * ai; ao_info * ai;
char * dup; char * dup;
char * stk1; char * stk1;
@ -107,15 +112,19 @@ void initAudioDriver() {
} }
} }
free(dup); free(dup);
#endif
} }
void finishAudioDriver() { void finishAudioDriver() {
#ifdef HAVE_AUDIO
ao_free_options(audio_ao_options); ao_free_options(audio_ao_options);
ao_shutdown(); ao_shutdown();
#endif
} }
int isCurrentAudioFormat(AudioFormat * audioFormat) { int isCurrentAudioFormat(AudioFormat * audioFormat) {
#ifdef HAVE_AUDIO
if(!audio_device || !audioFormat) return 0; if(!audio_device || !audioFormat) return 0;
if(audio_format.bits!=audioFormat->bits || if(audio_format.bits!=audioFormat->bits ||
@ -124,11 +133,12 @@ int isCurrentAudioFormat(AudioFormat * audioFormat) {
{ {
return 0; return 0;
} }
#endif
return 1; return 1;
} }
int initAudio(AudioFormat * audioFormat) { int initAudio(AudioFormat * audioFormat) {
#ifdef HAVE_AUDIO
ao_sample_format format; ao_sample_format format;
if(audio_device && !isCurrentAudioFormat(audioFormat)) { if(audio_device && !isCurrentAudioFormat(audioFormat)) {
@ -154,12 +164,13 @@ int initAudio(AudioFormat * audioFormat) {
if(audio_device==NULL) return -1; if(audio_device==NULL) return -1;
} }
#endif
return 0; return 0;
} }
int playAudio(char * playChunk, int size) { int playAudio(char * playChunk, int size) {
#ifdef HAVE_AUDIO
int send; int send;
if(audio_device==NULL) { if(audio_device==NULL) {
@ -181,19 +192,23 @@ int playAudio(char * playChunk, int size) {
size-=send; size-=send;
} }
#endif
return 0; return 0;
} }
void finishAudio() { void finishAudio() {
#ifdef HAVE_AUDIO
if(audio_device) { if(audio_device) {
blockSignals(); blockSignals();
ao_close(audio_device); ao_close(audio_device);
audio_device = NULL; audio_device = NULL;
unblockSignals(); unblockSignals();
} }
#endif
} }
void audioError() { void audioError() {
#ifdef HAVE_AUDIO
if(errno==AO_ENOTLIVE) { if(errno==AO_ENOTLIVE) {
ERROR("not a live ao device\n"); ERROR("not a live ao device\n");
} }
@ -203,4 +218,5 @@ void audioError() {
else if(errno==AO_EBADOPTION) { else if(errno==AO_EBADOPTION) {
ERROR("bad driver option\n"); ERROR("bad driver option\n");
} }
#endif
} }

View File

@ -24,7 +24,6 @@
#include "mpd_types.h" #include "mpd_types.h"
#include <stdio.h> #include <stdio.h>
#include <ao/ao.h>
#define AUDIO_AO_DRIVER_DEFAULT "default" #define AUDIO_AO_DRIVER_DEFAULT "default"
@ -34,9 +33,6 @@ typedef struct _AudioFormat {
mpd_sint8 bits; mpd_sint8 bits;
} AudioFormat; } AudioFormat;
extern int audio_ao_driver_id;
extern ao_option * audio_ao_options;
void initAudioDriver(); void initAudioDriver();
void finishAudioDriver(); void finishAudioDriver();

View File

@ -45,7 +45,6 @@ typedef struct {
/* this code is based on flac123, from flac-tools */ /* this code is based on flac123, from flac-tools */
int flacSendChunk(FlacData * data); int flacSendChunk(FlacData * data);
void flacPlayfile(const char * file, Buffer * cb, ao_sample_format * format);
void flacError(const FLAC__FileDecoder *, FLAC__StreamDecoderErrorStatus, void *); void flacError(const FLAC__FileDecoder *, FLAC__StreamDecoderErrorStatus, void *);
void flacPrintErroredState(FLAC__FileDecoderState state, char * file); void flacPrintErroredState(FLAC__FileDecoderState state, char * file);
void flacMetadata(const FLAC__FileDecoder *, const FLAC__StreamMetadata *, void *); void flacMetadata(const FLAC__FileDecoder *, const FLAC__StreamMetadata *, void *);

View File

@ -42,6 +42,7 @@
#include <sys/types.h> #include <sys/types.h>
#include <sys/stat.h> #include <sys/stat.h>
#include <unistd.h> #include <unistd.h>
#include <errno.h>
#define FRAMES_CUSHION 2000 #define FRAMES_CUSHION 2000