output: don't compile plugins which are disabled

Don't compile the sources of disabled output plugins at all.
This commit is contained in:
Max Kellermann 2008-10-26 21:58:37 +01:00
parent 3dac99034a
commit 0800c6f4ca
15 changed files with 92 additions and 104 deletions

View File

@ -327,6 +327,8 @@ case $host in
enable_osx=yes ;;
esac
AM_CONDITIONAL(HAVE_OSX, test x$enable_osx = xyes)
if test x$enable_curl = xyes; then
PKG_CHECK_MODULES(CURL, [libcurl],
AC_DEFINE(HAVE_CURL, 1, [Define when libcurl is used for HTTP streaming]),
@ -375,16 +377,24 @@ if test x$enable_shout_mp3 = xyes; then
fi
fi
AM_CONDITIONAL(HAVE_SHOUT, test x$enable_shout = xyes)
AM_CONDITIONAL(HAVE_SHOUT_OGG, test x$enable_shout_ogg = xyes)
AM_CONDITIONAL(HAVE_SHOUT_MP3, test x$enable_shout_mp3 = xyes)
if test x$enable_ao = xyes; then
PKG_CHECK_MODULES(AO, [ao],
AC_DEFINE(HAVE_AO, 1, [Define to play with ao]),
enable_ao=no)
fi
AM_CONDITIONAL(HAVE_AO, test x$enable_ao = xyes)
if test x$enable_oss = xyes; then
AC_CHECK_HEADER(sys/soundcard.h,[enable_oss=yes;AC_DEFINE(HAVE_OSS,1,[Define to enable OSS])],[AC_MSG_WARN(Soundcard headers not found -- disabling OSS support);enable_oss=no])
fi
AM_CONDITIONAL(HAVE_OSS, test x$enable_oss = xyes)
PKG_PROG_PKG_CONFIG
if test x$enable_pulse = xyes; then
@ -393,6 +403,8 @@ if test x$enable_pulse = xyes; then
[enable_pulse=no;AC_MSG_WARN([PulseAudio not found -- disabling])])
fi
AM_CONDITIONAL(HAVE_PULSE, test x$enable_pulse = xyes)
if test x$enable_lsr = xyes; then
PKG_CHECK_MODULES([SAMPLERATE], [samplerate >= 0.0.15],
[enable_lsr=yes;AC_DEFINE([HAVE_LIBSAMPLERATE], 1, [Define to enable libsamplerate])] MPD_LIBS="$MPD_LIBS $SAMPLERATE_LIBS" MPD_CFLAGS="$MPD_CFLAGS $SAMPLERATE_CFLAGS",
@ -412,22 +424,30 @@ if test x$enable_fifo = xyes; then
[enable_fifo=no;AC_MSG_WARN([mkfifo not found -- disabling support for writing audio to a FIFO])])
fi
AM_CONDITIONAL(HAVE_FIFO, test x$enable_fifo = xyes)
if test x$enable_mvp = xyes; then
AC_DEFINE(HAVE_MVP,1,[Define to enable Hauppauge Media MVP support])
fi
AM_CONDITIONAL(HAVE_MVP, test x$enable_mvp = xyes)
if test x$enable_alsa = xyes; then
PKG_CHECK_MODULES(ALSA, [alsa >= 0.9.0],
AC_DEFINE(HAVE_ALSA, 1, [Define to enable ALSA support]),
enable_alsa=no)
fi
AM_CONDITIONAL(HAVE_ALSA, test x$enable_alsa = xyes)
if test x$enable_jack = xyes; then
PKG_CHECK_MODULES([JACK], [jack >= 0.4],
[enable_jack=yes;AC_DEFINE([HAVE_JACK], 1, [Define to enable JACK support])] MPD_LIBS="$MPD_LIBS $JACK_LIBS" MPD_CFLAGS="$MPD_CFLAGS $JACK_CFLAGS",
[enable_jack=no;AC_MSG_WARN([JACK not found -- disabling])])
fi
AM_CONDITIONAL(HAVE_JACK, test x$enable_jack = xyes)
if test x$enable_id3 = xyes; then
PKG_CHECK_MODULES([ID3TAG], [id3tag],
AC_DEFINE(HAVE_ID3TAG, 1, [Define to use id3tag]),

View File

@ -1,19 +1,5 @@
bin_PROGRAMS = mpd
mpd_output = \
output/shout_plugin.c \
output/shout_ogg.c \
output/shout_mp3.c \
output/null_plugin.c \
output/fifo_plugin.c \
output/alsa_plugin.c \
output/ao_plugin.c \
output/oss_plugin.c \
output/osx_plugin.c \
output/pulse_plugin.c \
output/mvp_plugin.c \
output/jack_plugin.c
mpd_headers = \
notify.h \
ack.h \
@ -102,7 +88,6 @@ mpd_headers = \
mpd_SOURCES = \
$(mpd_headers) \
$(mpd_output) \
notify.c \
audio.c \
audioOutput.c \
@ -111,6 +96,7 @@ mpd_SOURCES = \
output_thread.c \
output_control.c \
output_init.c \
output/null_plugin.c \
buffer2array.c \
command.c \
idle.c \
@ -248,6 +234,51 @@ mpd_SOURCES += input_curl.c
endif
if HAVE_ALSA
mpd_SOURCES += output/alsa_plugin.c
endif
if HAVE_AO
mpd_SOURCES += output/ao_plugin.c
endif
if HAVE_FIFO
mpd_SOURCES += output/fifo_plugin.c
endif
if HAVE_JACK
mpd_SOURCES += output/jack_plugin.c
endif
if HAVE_MVP
mpd_SOURCES += output/mvp_plugin.c
endif
if HAVE_OSS
mpd_SOURCES += output/oss_plugin.c
endif
if HAVE_OSX
mpd_SOURCES += output/osx_plugin.c
endif
if HAVE_PULSE
mpd_SOURCES += output/pulse_plugin.c
endif
if HAVE_SHOUT
mpd_SOURCES += output/shout_plugin.c
endif
if HAVE_SHOUT_MP3
mpd_SOURCES += output/shout_mp3.c
endif
if HAVE_SHOUT_OGG
mpd_SOURCES += output/shout_ogg.c
endif
mpd_CFLAGS = $(MPD_CFLAGS)
mpd_CPPFLAGS = \
$(CURL_CFLAGS) \

View File

@ -17,8 +17,10 @@
*/
#include "../output_api.h"
#include "../utils.h"
#include "../log.h"
#ifdef HAVE_ALSA
#include <alsa/asoundlib.h>
#define ALSA_PCM_NEW_HW_PARAMS_API
#define ALSA_PCM_NEW_SW_PARAMS_API
@ -27,11 +29,6 @@ static const char default_device[] = "default";
#define MPD_ALSA_RETRY_NR 5
#include "../utils.h"
#include "../log.h"
#include <alsa/asoundlib.h>
typedef snd_pcm_sframes_t alsa_writei_t(snd_pcm_t * pcm, const void *buffer,
snd_pcm_uframes_t size);
@ -437,8 +434,3 @@ const struct audio_output_plugin alsaPlugin = {
.cancel = alsa_dropBufferedAudio,
.close = alsa_closeDevice,
};
#else /* HAVE ALSA */
DISABLED_AUDIO_OUTPUT_PLUGIN(alsaPlugin)
#endif /* HAVE_ALSA */

View File

@ -17,9 +17,6 @@
*/
#include "../output_api.h"
#ifdef HAVE_AO
#include "../utils.h"
#include "../log.h"
@ -246,8 +243,3 @@ const struct audio_output_plugin aoPlugin = {
.cancel = audioOutputAo_dropBufferedAudio,
.close = audioOutputAo_closeDevice,
};
#else
DISABLED_AUDIO_OUTPUT_PLUGIN(aoPlugin)
#endif

View File

@ -17,9 +17,6 @@
*/
#include "../output_api.h"
#ifdef HAVE_FIFO
#include "../log.h"
#include "../utils.h"
#include "../timer.h"
@ -282,9 +279,3 @@ const struct audio_output_plugin fifoPlugin = {
.cancel = fifo_dropBufferedAudio,
.close = fifo_closeDevice,
};
#else /* HAVE_FIFO */
DISABLED_AUDIO_OUTPUT_PLUGIN(fifoPlugin)
#endif /* !HAVE_FIFO */

View File

@ -16,9 +16,6 @@
*/
#include "../output_api.h"
#ifdef HAVE_JACK
#include "../utils.h"
#include "../log.h"
@ -478,9 +475,3 @@ const struct audio_output_plugin jackPlugin = {
.cancel = mpd_jack_cancel,
.close = mpd_jack_close,
};
#else /* HAVE JACK */
DISABLED_AUDIO_OUTPUT_PLUGIN(jackPlugin)
#endif /* HAVE_JACK */

View File

@ -20,9 +20,6 @@
*/
#include "../output_api.h"
#ifdef HAVE_MVP
#include "../utils.h"
#include "../log.h"
@ -273,8 +270,3 @@ const struct audio_output_plugin mvpPlugin = {
.cancel = mvp_dropBufferedAudio,
.close = mvp_closeDevice,
};
#else /* HAVE_MVP */
DISABLED_AUDIO_OUTPUT_PLUGIN(mvpPlugin)
#endif /* HAVE_MVP */

View File

@ -20,9 +20,6 @@
*/
#include "../output_api.h"
#ifdef HAVE_OSS
#include "../utils.h"
#include "../log.h"
@ -564,8 +561,3 @@ const struct audio_output_plugin ossPlugin = {
.cancel = oss_dropBufferedAudio,
.close = oss_closeDevice,
};
#else /* HAVE OSS */
DISABLED_AUDIO_OUTPUT_PLUGIN(ossPlugin)
#endif /* HAVE_OSS */

View File

@ -17,14 +17,11 @@
*/
#include "../output_api.h"
#ifdef HAVE_OSX
#include <AudioUnit/AudioUnit.h>
#include "../utils.h"
#include "../log.h"
#include <AudioUnit/AudioUnit.h>
typedef struct _OsxData {
AudioUnit au;
pthread_mutex_t mutex;
@ -361,8 +358,3 @@ const struct audio_output_plugin osxPlugin = {
.cancel = osx_dropBufferedAudio,
.close = osx_closeDevice,
};
#else
DISABLED_AUDIO_OUTPUT_PLUGIN(osxPlugin)
#endif

View File

@ -17,9 +17,6 @@
*/
#include "../output_api.h"
#ifdef HAVE_PULSE
#include "../utils.h"
#include "../log.h"
@ -211,8 +208,3 @@ const struct audio_output_plugin pulsePlugin = {
.cancel = pulse_dropBufferedAudio,
.close = pulse_closeDevice,
};
#else /* HAVE_PULSE */
DISABLED_AUDIO_OUTPUT_PLUGIN(pulsePlugin)
#endif /* HAVE_PULSE */

View File

@ -17,10 +17,8 @@
*/
#include "shout_plugin.h"
#ifdef HAVE_SHOUT_MP3
#include "../utils.h"
#include <lame/lame.h>
struct lame_data {
@ -184,5 +182,3 @@ const struct shout_encoder_plugin shout_mp3_encoder = {
shout_mp3_encoder_init_encoder,
shout_mp3_encoder_send_metadata,
};
#endif

View File

@ -17,10 +17,8 @@
*/
#include "shout_plugin.h"
#ifdef HAVE_SHOUT_OGG
#include "../utils.h"
#include <vorbis/vorbisenc.h>
struct ogg_vorbis_data {
@ -302,5 +300,3 @@ const struct shout_encoder_plugin shout_ogg_encoder = {
shout_ogg_encoder_init_encoder,
shout_ogg_encoder_send_metadata,
};
#endif

View File

@ -20,9 +20,6 @@
#define AUDIO_OUTPUT_SHOUT_H
#include "../output_api.h"
#ifdef HAVE_SHOUT
#include "../conf.h"
#include "../timer.h"
@ -89,5 +86,3 @@ extern const struct shout_encoder_plugin shout_mp3_encoder;
extern const struct shout_encoder_plugin shout_ogg_encoder;
#endif
#endif

View File

@ -32,16 +32,34 @@ extern const struct audio_output_plugin mvpPlugin;
extern const struct audio_output_plugin jackPlugin;
const struct audio_output_plugin *audio_output_plugins[] = {
#ifdef HAVE_SHOUT
&shoutPlugin,
#endif
&nullPlugin,
#ifdef HAVE_FIFO
&fifoPlugin,
#endif
#ifdef HAVE_ALSA
&alsaPlugin,
#endif
#ifdef HAVE_AO
&aoPlugin,
#endif
#ifdef HAVE_OSS
&ossPlugin,
#endif
#ifdef HAVE_OSX
&osxPlugin,
#endif
#ifdef HAVE_PULSE
&pulsePlugin,
#endif
#ifdef HAVE_MVP
&mvpPlugin,
#endif
#ifdef HAVE_JACK
&jackPlugin,
#endif
NULL
};

View File

@ -25,8 +25,6 @@ const struct audio_output_plugin *
audio_output_plugin_get(const char *name);
#define audio_output_plugins_for_each(plugin, i) \
for (i = 0; (plugin = audio_output_plugins[i]) != NULL; ++i) \
if (plugin->name != NULL)
for (i = 0; (plugin = audio_output_plugins[i]) != NULL; ++i)
#endif