Makefile.am: don't compile disabled decoder plugins

Don't compile the sources of disabled decoder plugins at all, and
don't attempt to register these.
This commit is contained in:
Max Kellermann 2008-10-17 21:57:09 +02:00
parent 25b5d90e44
commit 4ee8da2e69
17 changed files with 103 additions and 159 deletions

View File

@ -420,6 +420,8 @@ if test x$enable_mp3 = xyes; then
enable_mp3=no)
fi
AM_CONDITIONAL(HAVE_MAD, test x$enable_mp3 = xyes)
if test x$enable_lame = xyes; then
AM_PATH_LAME([MPD_LIBS="$MPD_LIBS $LAME_LIBS" MPD_CFLAGS="$MPD_CFLAGS $LAME_CFLAGS"],
[enable_lame=no;AC_MSG_WARN(You need lame -- disabling lame support)])
@ -461,12 +463,16 @@ if test x$enable_mpc = xyes; then
CPPFLAGS=$oldcppflags
fi
AM_CONDITIONAL(HAVE_MPCDEC, test x$enable_mpc = xyes)
if test x$enable_wavpack = xyes; then
PKG_CHECK_MODULES([WAVPACK], [wavpack],
[enable_wavpack=yes;AC_DEFINE([HAVE_WAVPACK], 1, [Define to enable WavPack support])] MPD_LIBS="$MPD_LIBS $WAVPACK_LIBS" MPD_CFLAGS="$MPD_CFLAGS $WAVPACK_CFLAGS",
[enable_wavpack=no;AC_MSG_WARN([WavPack not found -- disabling])])
fi
AM_CONDITIONAL(HAVE_WAVPACK, test x$enable_wavpack = xyes)
MP4FF_SUBDIR=""
if test x$enable_aac = xyes; then
@ -576,6 +582,8 @@ int main() {
CPPFLAGS=$oldcppflags
fi
AM_CONDITIONAL(HAVE_FAAD, test x$enable_aac = xyes)
if test x$use_tremor = xyes; then
if test "x$tremor_libraries" != "x" ; then
TREMOR_LIBS="-L$tremor_libraries"
@ -603,6 +611,8 @@ elif test x$enable_oggvorbis = xyes; then
enable_oggvorbis=no)
fi
AM_CONDITIONAL(HAVE_OGGVORBIS, test x$enable_oggvorbis = xyes)
if test x$use_tremor = xyes; then
AC_DEFINE(HAVE_TREMOR,1,[Define to use tremor (libvorbisidec) for ogg support])
if test x$enable_oggflac = xyes; then
@ -629,6 +639,8 @@ if test x$enable_flac = xyes; then
LIBS="$oldlibs"
fi
AM_CONDITIONAL(HAVE_FLAC, test x$enable_flac = xyes)
if test x$enable_oggflac = xyes; then
oldmpdcflags="$MPD_CFLAGS"
oldmpdlibs="$MPD_LIBS"
@ -639,6 +651,10 @@ if test x$enable_oggflac = xyes; then
AC_DEFINE(HAVE_OGGFLAC,1,[Define for OggFLAC support])
fi
AM_CONDITIONAL(HAVE_OGGFLAC, test x$enable_oggflac = xyes)
AM_CONDITIONAL(HAVE_FLAC_COMMON, test x$enable_flac = xyes || test x$enable_oggflac = xyes)
AM_CONDITIONAL(HAVE_OGG_COMMON, test x$enable_oggvorbis = xyes || test x$enable_oggflac = xyes)
if test x$enable_audiofile = xyes; then
PKG_CHECK_MODULES(AUDIOFILE, [audiofile >= 0.1.7],
@ -646,12 +662,16 @@ if test x$enable_audiofile = xyes; then
enable_audiofile=no)
fi
AM_CONDITIONAL(HAVE_AUDIOFILE, test x$enable_audiofile = xyes)
if test x$enable_mod = xyes; then
PKG_CHECK_MODULES(LIBMIKMOD, [libmikmod],
AC_DEFINE(HAVE_MIKMOD, 1, [Define for mikmod support]),
enable_mod=no)
fi
AM_CONDITIONAL(HAVE_MIKMOD, test x$enable_mod = xyes)
case $with_zeroconf in
no|avahi|bonjour)
;;

View File

@ -15,21 +15,6 @@ mpd_audioOutputs = \
audioOutputs/audioOutput_mvp.c \
audioOutputs/audioOutput_jack.c
mpd_inputPlugins = \
inputPlugins/_flac_common.c \
inputPlugins/_ogg_common.c \
inputPlugins/oggflac_plugin.c \
inputPlugins/oggvorbis_plugin.c \
inputPlugins/aac_plugin.c \
inputPlugins/audiofile_plugin.c \
inputPlugins/flac_plugin.c \
inputPlugins/mod_plugin.c \
inputPlugins/mp3_plugin.c \
inputPlugins/mp4_plugin.c \
inputPlugins/mpc_plugin.c \
inputPlugins/wavpack_plugin.c
mpd_headers = \
notify.h \
ack.h \
@ -118,7 +103,6 @@ mpd_headers = \
mpd_SOURCES = \
$(mpd_headers) \
$(mpd_audioOutputs) \
$(mpd_inputPlugins) \
notify.c \
audio.c \
audioOutput.c \
@ -194,6 +178,54 @@ if HAVE_ID3TAG
mpd_SOURCES += tag_id3.c
endif
# decoder plugins
if HAVE_MAD
mpd_SOURCES += inputPlugins/mp3_plugin.c
endif
if HAVE_MPCDEC
mpd_SOURCES += inputPlugins/mpc_plugin.c
endif
if HAVE_WAVPACK
mpd_SOURCES += inputPlugins/wavpack_plugin.c
endif
if HAVE_FAAD
mpd_SOURCES += inputPlugins/aac_plugin.c inputPlugins/mp4_plugin.c
endif
if HAVE_OGG_COMMON
mpd_SOURCES += inputPlugins/_ogg_common.c
endif
if HAVE_FLAC_COMMON
mpd_SOURCES += inputPlugins/_flac_common.c
endif
if HAVE_OGGVORBIS
mpd_SOURCES += inputPlugins/oggvorbis_plugin.c
endif
if HAVE_FLAC
mpd_SOURCES += inputPlugins/flac_plugin.c
endif
if HAVE_OGGFLAC
mpd_SOURCES += inputPlugins/oggflac_plugin.c
endif
if HAVE_AUDIOFILE
mpd_SOURCES += inputPlugins/audiofile_plugin.c
endif
if HAVE_MIKMOD
mpd_SOURCES += inputPlugins/mod_plugin.c
endif
if HAVE_ZEROCONF
mpd_SOURCES += zeroconf.c
endif

View File

@ -151,16 +151,34 @@ void decoder_plugin_init_all(void)
inputPlugin_list = makeList(NULL, 1);
/* load plugins here */
#ifdef HAVE_MAD
decoder_plugin_load(&mp3Plugin);
#endif
#ifdef HAVE_OGGVORBIS
decoder_plugin_load(&oggvorbisPlugin);
#endif
#ifdef HAVE_FLAC_COMMON
decoder_plugin_load(&oggflacPlugin);
#endif
#ifdef HAVE_FLAC
decoder_plugin_load(&flacPlugin);
#endif
#ifdef HAVE_AUDIOFILE
decoder_plugin_load(&audiofilePlugin);
#endif
#ifdef HAVE_FAAD
decoder_plugin_load(&mp4Plugin);
decoder_plugin_load(&aacPlugin);
#endif
#ifdef HAVE_MPCDEC
decoder_plugin_load(&mpcPlugin);
#endif
#ifdef HAVE_WAVPACK
decoder_plugin_load(&wavpackPlugin);
#endif
#ifdef HAVE_MIKMOD
decoder_plugin_load(&modPlugin);
#endif
}
void decoder_plugin_deinit_all(void)

View File

@ -19,12 +19,7 @@
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#include "../decoder_api.h"
#if defined(HAVE_FLAC) || defined(HAVE_OGGFLAC)
#include "_flac_common.h"
#include "../log.h"
#include <FLAC/format.h>
@ -326,5 +321,3 @@ flac_common_write(FlacData *data, const FLAC__Frame * frame,
return FLAC__STREAM_DECODER_WRITE_STATUS_CONTINUE;
}
#endif /* HAVE_FLAC || HAVE_OGGFLAC */

View File

@ -24,8 +24,6 @@
#include "../decoder_api.h"
#if defined(HAVE_FLAC) || defined(HAVE_OGGFLAC)
#include <FLAC/export.h>
#if !defined(FLAC_API_VERSION_CURRENT) || FLAC_API_VERSION_CURRENT <= 7
# include <FLAC/seekable_stream_decoder.h>
@ -167,6 +165,4 @@ FLAC__StreamDecoderWriteStatus
flac_common_write(FlacData *data, const FLAC__Frame * frame,
const FLAC__int32 *const buf[]);
#endif /* HAVE_FLAC || HAVE_OGGFLAC */
#endif /* _FLAC_COMMON_H */

View File

@ -19,12 +19,8 @@
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#include "_flac_common.h"
#include "_ogg_common.h"
#if defined(HAVE_OGGFLAC) || defined(HAVE_OGGVORBIS) || \
(defined(FLAC_API_VERSION_CURRENT) && FLAC_API_VERSION_CURRENT > 7)
#include "_flac_common.h"
#include "../utils.h"
ogg_stream_type ogg_stream_type_detect(InputStream * inStream)
@ -51,5 +47,3 @@ ogg_stream_type ogg_stream_type_detect(InputStream * inStream)
}
return VORBIS;
}
#endif /* defined(HAVE_OGGFLAC || defined(HAVE_OGGVORBIS) */

View File

@ -24,13 +24,8 @@
#include "../decoder_api.h"
#if defined(HAVE_OGGFLAC) || defined(HAVE_OGGVORBIS) || \
(defined(FLAC_API_VERSION_CURRENT) && FLAC_API_VERSION_CURRENT > 7)
typedef enum _ogg_stream_type { VORBIS, FLAC } ogg_stream_type;
ogg_stream_type ogg_stream_type_detect(InputStream * inStream);
#endif /* defined(HAVE_OGGFLAC || defined(HAVE_OGGVORBIS) */
#endif /* _OGG_COMMON_H */

View File

@ -18,8 +18,6 @@
#include "../decoder_api.h"
#ifdef HAVE_FAAD
#define AAC_MAX_CHANNELS 6
#include "../utils.h"
@ -602,9 +600,3 @@ struct decoder_plugin aacPlugin = {
.suffixes = aac_suffixes,
.mime_types = aac_mimeTypes
};
#else
struct decoder_plugin aacPlugin;
#endif /* HAVE_FAAD */

View File

@ -19,9 +19,6 @@
*/
#include "../decoder_api.h"
#ifdef HAVE_AUDIOFILE
#include "../log.h"
#include <sys/stat.h>
@ -148,9 +145,3 @@ struct decoder_plugin audiofilePlugin = {
.stream_types = INPUT_PLUGIN_STREAM_FILE,
.suffixes = audiofileSuffixes,
};
#else
struct decoder_plugin audiofilePlugin;
#endif /* HAVE_AUDIOFILE */

View File

@ -17,9 +17,6 @@
*/
#include "_flac_common.h"
#ifdef HAVE_FLAC
#include "../utils.h"
#include "../log.h"
@ -386,12 +383,8 @@ static int flac_decode(struct decoder * decoder, InputStream * inStream)
return flac_decode_internal(decoder, inStream, 0);
}
#if !defined(FLAC_API_VERSION_CURRENT) || FLAC_API_VERSION_CURRENT <= 7
# define flac_plugin_init NULL
#else /* FLAC_API_VERSION_CURRENT >= 7 */
/* some of this stuff is duplicated from oggflac_plugin.c */
extern struct decoder_plugin oggflacPlugin;
#if defined(FLAC_API_VERSION_CURRENT) && FLAC_API_VERSION_CURRENT > 7 && \
!defined(HAVE_OGGFLAC)
static struct tag *oggflac_tag_dup(char *file)
{
struct tag *ret = NULL;
@ -429,7 +422,8 @@ static int oggflac_decode(struct decoder *decoder, InputStream * inStream)
static bool oggflac_try_decode(InputStream * inStream)
{
return ogg_stream_type_detect(inStream) == FLAC;
return FLAC_API_SUPPORTS_OGG_FLAC &&
ogg_stream_type_detect(inStream) == FLAC;
}
static const char *oggflac_suffixes[] = { "ogg", "oga", NULL };
@ -438,25 +432,15 @@ static const char *oggflac_mime_types[] = { "audio/x-flac+ogg",
"application/x-ogg",
NULL };
static int flac_plugin_init(void)
{
if (!FLAC_API_SUPPORTS_OGG_FLAC) {
DEBUG("libFLAC does not support OggFLAC\n");
return 1;
}
DEBUG("libFLAC supports OggFLAC, initializing OggFLAC support\n");
assert(oggflacPlugin.name == NULL);
oggflacPlugin.name = "oggflac";
oggflacPlugin.try_decode = oggflac_try_decode;
oggflacPlugin.stream_decode = oggflac_decode;
oggflacPlugin.tag_dup = oggflac_tag_dup;
oggflacPlugin.stream_types = INPUT_PLUGIN_STREAM_URL |
INPUT_PLUGIN_STREAM_FILE;
oggflacPlugin.suffixes = oggflac_suffixes;
oggflacPlugin.mime_types = oggflac_mime_types;
decoder_plugin_register(&oggflacPlugin);
return 1;
}
struct decoder_plugin oggflacPlugin = {
.name = "oggflac",
.try_decode = oggflac_try_decode,
.stream_decode = oggflac_decode,
.tag_dup = oggflac_tag_dup,
.stream_types = INPUT_PLUGIN_STREAM_URL | INPUT_PLUGIN_STREAM_FILE,
.suffixes = oggflac_suffixes,
.mime_types = oggflac_mime_types
};
#endif /* FLAC_API_VERSION_CURRENT >= 7 */
@ -467,16 +451,9 @@ static const char *flac_mime_types[] = { "audio/x-flac",
struct decoder_plugin flacPlugin = {
.name = "flac",
.init = flac_plugin_init,
.stream_decode = flac_decode,
.tag_dup = flacTagDup,
.stream_types = INPUT_PLUGIN_STREAM_URL | INPUT_PLUGIN_STREAM_FILE,
.suffixes = flacSuffixes,
.mime_types = flac_mime_types
};
#else /* !HAVE_FLAC */
struct decoder_plugin flacPlugin;
#endif /* HAVE_FLAC */

View File

@ -17,9 +17,6 @@
*/
#include "../decoder_api.h"
#ifdef HAVE_MIKMOD
#include "../utils.h"
#include "../log.h"
@ -279,9 +276,3 @@ struct decoder_plugin modPlugin = {
.stream_types = INPUT_PLUGIN_STREAM_FILE,
.suffixes = modSuffixes,
};
#else
struct decoder_plugin modPlugin;
#endif /* HAVE_MIKMOD */

View File

@ -17,8 +17,9 @@
*/
#include "../decoder_api.h"
#ifdef HAVE_MAD
#include "../log.h"
#include "../utils.h"
#include "../conf.h"
#include <mad.h>
@ -26,10 +27,6 @@
#include <id3tag.h>
#endif
#include "../log.h"
#include "../utils.h"
#include "../conf.h"
#define FRAMES_CUSHION 2000
#define READ_BUFFER_SIZE 40960
@ -1125,8 +1122,3 @@ struct decoder_plugin mp3Plugin = {
.suffixes = mp3_suffixes,
.mime_types = mp3_mimeTypes
};
#else
struct decoder_plugin mp3Plugin;
#endif /* HAVE_MAD */

View File

@ -17,9 +17,6 @@
*/
#include "../decoder_api.h"
#ifdef HAVE_FAAD
#include "../utils.h"
#include "../log.h"
@ -424,9 +421,3 @@ struct decoder_plugin mp4Plugin = {
.suffixes = mp4_suffixes,
.mime_types = mp4_mimeTypes,
};
#else
struct decoder_plugin mp4Plugin;
#endif /* HAVE_FAAD */

View File

@ -17,9 +17,6 @@
*/
#include "../decoder_api.h"
#ifdef HAVE_MPCDEC
#include "../utils.h"
#include "../log.h"
@ -309,9 +306,3 @@ struct decoder_plugin mpcPlugin = {
.stream_types = INPUT_PLUGIN_STREAM_URL | INPUT_PLUGIN_STREAM_FILE,
.suffixes = mpcSuffixes,
};
#else
struct decoder_plugin mpcPlugin;
#endif /* HAVE_MPCDEC */

View File

@ -20,9 +20,6 @@
*/
#include "_flac_common.h"
#ifdef HAVE_OGGFLAC
#include "_ogg_common.h"
#include "../utils.h"
@ -356,9 +353,3 @@ struct decoder_plugin oggflacPlugin = {
.suffixes = oggflac_Suffixes,
.mime_types = oggflac_mime_types
};
#else /* !HAVE_FLAC */
struct decoder_plugin oggflacPlugin;
#endif /* HAVE_OGGFLAC */

View File

@ -18,12 +18,7 @@
/* TODO 'ogg' should probably be replaced with 'oggvorbis' in all instances */
#include "../decoder_api.h"
#ifdef HAVE_OGGVORBIS
#include "_ogg_common.h"
#include "../utils.h"
#include "../log.h"
@ -390,9 +385,3 @@ struct decoder_plugin oggvorbisPlugin = {
.suffixes = oggvorbis_Suffixes,
.mime_types = oggvorbis_MimeTypes
};
#else /* !HAVE_OGGVORBIS */
struct decoder_plugin oggvorbisPlugin;
#endif /* HAVE_OGGVORBIS */

View File

@ -19,9 +19,6 @@
*/
#include "../decoder_api.h"
#ifdef HAVE_WAVPACK
#include "../utils.h"
#include "../log.h"
#include "../path.h"
@ -575,9 +572,3 @@ struct decoder_plugin wavpackPlugin = {
.suffixes = wavpackSuffixes,
.mime_types = wavpackMimeTypes
};
#else /* !HAVE_WAVPACK */
struct decoder_plugin wavpackPlugin;
#endif /* !HAVE_WAVPACK */