diff options
-rw-r--r-- | configure.ac | 20 | ||||
-rw-r--r-- | src/Makefile.am | 64 | ||||
-rw-r--r-- | src/decoder_list.c | 18 | ||||
-rw-r--r-- | src/inputPlugins/_flac_common.c | 7 | ||||
-rw-r--r-- | src/inputPlugins/_flac_common.h | 4 | ||||
-rw-r--r-- | src/inputPlugins/_ogg_common.c | 8 | ||||
-rw-r--r-- | src/inputPlugins/_ogg_common.h | 5 | ||||
-rw-r--r-- | src/inputPlugins/aac_plugin.c | 8 | ||||
-rw-r--r-- | src/inputPlugins/audiofile_plugin.c | 9 | ||||
-rw-r--r-- | src/inputPlugins/flac_plugin.c | 49 | ||||
-rw-r--r-- | src/inputPlugins/mod_plugin.c | 9 | ||||
-rw-r--r-- | src/inputPlugins/mp3_plugin.c | 14 | ||||
-rw-r--r-- | src/inputPlugins/mp4_plugin.c | 9 | ||||
-rw-r--r-- | src/inputPlugins/mpc_plugin.c | 9 | ||||
-rw-r--r-- | src/inputPlugins/oggflac_plugin.c | 9 | ||||
-rw-r--r-- | src/inputPlugins/oggvorbis_plugin.c | 11 | ||||
-rw-r--r-- | src/inputPlugins/wavpack_plugin.c | 9 |
17 files changed, 103 insertions, 159 deletions
diff --git a/configure.ac b/configure.ac index 5ff6b4071..a5cee2ca3 100644 --- a/configure.ac +++ b/configure.ac @@ -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) ;; diff --git a/src/Makefile.am b/src/Makefile.am index f36ea5483..70222db0c 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -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 diff --git a/src/decoder_list.c b/src/decoder_list.c index 6626f556a..4aab73bda 100644 --- a/src/decoder_list.c +++ b/src/decoder_list.c @@ -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) diff --git a/src/inputPlugins/_flac_common.c b/src/inputPlugins/_flac_common.c index f24e20531..db43e0003 100644 --- a/src/inputPlugins/_flac_common.c +++ b/src/inputPlugins/_flac_common.c @@ -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 */ diff --git a/src/inputPlugins/_flac_common.h b/src/inputPlugins/_flac_common.h index e05824147..45714b4bd 100644 --- a/src/inputPlugins/_flac_common.h +++ b/src/inputPlugins/_flac_common.h @@ -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 */ diff --git a/src/inputPlugins/_ogg_common.c b/src/inputPlugins/_ogg_common.c index 535b9a9dc..841b2ad3f 100644 --- a/src/inputPlugins/_ogg_common.c +++ b/src/inputPlugins/_ogg_common.c @@ -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) */ diff --git a/src/inputPlugins/_ogg_common.h b/src/inputPlugins/_ogg_common.h index 3382e2860..7c9e7b630 100644 --- a/src/inputPlugins/_ogg_common.h +++ b/src/inputPlugins/_ogg_common.h @@ -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 */ diff --git a/src/inputPlugins/aac_plugin.c b/src/inputPlugins/aac_plugin.c index e9b2d7476..7842bcc22 100644 --- a/src/inputPlugins/aac_plugin.c +++ b/src/inputPlugins/aac_plugin.c @@ -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 */ diff --git a/src/inputPlugins/audiofile_plugin.c b/src/inputPlugins/audiofile_plugin.c index 4c08074c4..99846e853 100644 --- a/src/inputPlugins/audiofile_plugin.c +++ b/src/inputPlugins/audiofile_plugin.c @@ -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 */ diff --git a/src/inputPlugins/flac_plugin.c b/src/inputPlugins/flac_plugin.c index 2f3ec88d9..7b9fce27d 100644 --- a/src/inputPlugins/flac_plugin.c +++ b/src/inputPlugins/flac_plugin.c @@ -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 */ diff --git a/src/inputPlugins/mod_plugin.c b/src/inputPlugins/mod_plugin.c index 98bd67f0f..5916a24ab 100644 --- a/src/inputPlugins/mod_plugin.c +++ b/src/inputPlugins/mod_plugin.c @@ -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 */ diff --git a/src/inputPlugins/mp3_plugin.c b/src/inputPlugins/mp3_plugin.c index 13e4a4619..18eddf017 100644 --- a/src/inputPlugins/mp3_plugin.c +++ b/src/inputPlugins/mp3_plugin.c @@ -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 */ diff --git a/src/inputPlugins/mp4_plugin.c b/src/inputPlugins/mp4_plugin.c index 0e152c3a6..1a8268e40 100644 --- a/src/inputPlugins/mp4_plugin.c +++ b/src/inputPlugins/mp4_plugin.c @@ -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 */ diff --git a/src/inputPlugins/mpc_plugin.c b/src/inputPlugins/mpc_plugin.c index f74dc8ddc..fb1b0b56c 100644 --- a/src/inputPlugins/mpc_plugin.c +++ b/src/inputPlugins/mpc_plugin.c @@ -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 */ diff --git a/src/inputPlugins/oggflac_plugin.c b/src/inputPlugins/oggflac_plugin.c index 53f233e0c..091b00988 100644 --- a/src/inputPlugins/oggflac_plugin.c +++ b/src/inputPlugins/oggflac_plugin.c @@ -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 */ diff --git a/src/inputPlugins/oggvorbis_plugin.c b/src/inputPlugins/oggvorbis_plugin.c index bf2448605..0eecb783f 100644 --- a/src/inputPlugins/oggvorbis_plugin.c +++ b/src/inputPlugins/oggvorbis_plugin.c @@ -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 */ diff --git a/src/inputPlugins/wavpack_plugin.c b/src/inputPlugins/wavpack_plugin.c index 3e99980bd..14b7e5f69 100644 --- a/src/inputPlugins/wavpack_plugin.c +++ b/src/inputPlugins/wavpack_plugin.c @@ -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 */ |