From db1e39a4e847cce30b27a8585364963f8cbbb0c9 Mon Sep 17 00:00:00 2001 From: Takashi Iwai Date: Wed, 30 Nov 2005 11:38:24 +0000 Subject: [PATCH] Allow partial build with selected components Add --enable-* and --with-pcm-plugins configure options for partial builds. User can choose the core components (pcm, mixer, rawmidi, hwdep, seq, instr) via --enable-xxx or --disable-xxx option. As default, all components are enabled. The PCM plugins to build can be selected via --with-pcm-plugins option. For example, to build only rate and linear plugin, pass --with-pcm-plugins=rate,linear Passing "all" will select all plugins (it's the default value). The plug plugin will select linear and copy plugins automatically. The other auto conversions of plug plugin are enabled only when the corresponding plugin is selected. --- Makefile.am | 9 ++- configure.in | 140 ++++++++++++++++++++++++++++++++++++++++ modules/Makefile.am | 2 + src/Makefile.am | 36 +++++++++-- src/pcm/Makefile.am | 99 +++++++++++++++++++++++++--- src/pcm/pcm_plug.c | 106 ++++++++++++++++++++++++++---- src/pcm/pcm_symbols.c | 26 +------- src/rawmidi/Makefile.am | 5 +- 8 files changed, 369 insertions(+), 54 deletions(-) diff --git a/Makefile.am b/Makefile.am index 522013b9..f4fb8276 100644 --- a/Makefile.am +++ b/Makefile.am @@ -1,4 +1,11 @@ -SUBDIRS=doc include src modules aserver alsalisp test utils +SUBDIRS=doc include src modules +if BUILD_PCM_PLUGIN_SHM +SUBDIRS += aserver +endif +if BUILD_MIXER +SUBDIRS += alsalisp +endif +SUBDIRS += test utils EXTRA_DIST=ChangeLog INSTALL TODO NOTES configure cvscompile libtool depcomp version MEMORY-LEAK AUTOMAKE_OPTIONS=foreign diff --git a/configure.in b/configure.in index eb69a384..995f0429 100644 --- a/configure.in +++ b/configure.in @@ -196,6 +196,146 @@ if test "$aload" = "yes"; then AC_DEFINE(SUPPORT_ALOAD, "1", [Support /dev/aload* access for auto-loading]) fi +dnl Build conditions +AC_ARG_ENABLE(mixer, + [ --disable-mixer Disable the mixer component], + [build_mixer="$enableval"], [build_mixer="yes"]) +AC_ARG_ENABLE(pcm, + [ --disable-pcm Disable the PCM component], + [build_pcm="$enableval"], [build_pcm="yes"]) +AC_ARG_ENABLE(rawmidi, + [ --disable-rawmidi Disable the raw MIDI component], + [build_rawmidi="$enableval"], [build_rawmidi="yes"]) +AC_ARG_ENABLE(hwdep, + [ --disable-hwdep Disable the hwdep component], + [build_hwdep="$enableval"], [build_hwdep="yes"]) +AC_ARG_ENABLE(seq, + [ --disable-seq Disable the sequencer component], + [build_seq="$enableval"], [build_seq="yes"]) +AC_ARG_ENABLE(instr, + [ --disable-instr Disable the instrument component], + [build_instr="$enableval"], [build_instr="yes"]) + +if test "$build_seq" != "yes"; then + build_instr="no" +fi + +AM_CONDITIONAL(BUILD_MIXER, test x$build_mixer = xyes) +AM_CONDITIONAL(BUILD_PCM, test x$build_pcm = xyes) +AM_CONDITIONAL(BUILD_RAWMIDI, test x$build_rawmidi = xyes) +AM_CONDITIONAL(BUILD_HWDEP, test x$build_hwdep = xyes) +AM_CONDITIONAL(BUILD_SEQ, test x$build_seq = xyes) +AM_CONDITIONAL(BUILD_INSTR, test x$build_instr = xyes) + +if test "$build_mixer" = "yes"; then + AC_DEFINE([BUILD_MIXER], "1", [Build mixer component]) +fi +if test "$build_pcm" = "yes"; then + AC_DEFINE([BUILD_PCM], "1", [Build PCM component]) +fi +if test "$build_rawmidi" = "yes"; then + AC_DEFINE([BUILD_RAWMIDI], "1", [Build raw MIDI component]) +fi +if test "$build_seq" = "yes"; then + AC_DEFINE([BUILD_SEQ], "1", [Build sequencer component]) +fi +if test "$build_instr" = "yes"; then + AC_DEFINE([BUILD_INSTR], "1", [Build instrument component]) +fi + +dnl PCM Plugins + +if test "$build_pcm" = "yes"; then +AC_ARG_WITH(pcm-plugins, + [ --with-pcm-plugins= Build PCM plugins ], + [pcm_plugins="$withval"], [pcm_plugins="all"]) +else +pcm_plugins="" +fi + +PCM_PLUGIN_LIST="copy linear route mulaw alaw adpcm rate plug multi shm file null share meter hooks lfloat ladspa dmix dshare dsnoop asym iec958 softvol extplug ioplug" + +build_pcm_plugin="no" +for t in $PCM_PLUGIN_LIST; do + eval build_pcm_$t="no" +done + +pcm_plugins=`echo $pcm_plugins | sed 's/,/ /g'` +for p in $pcm_plugins; do + for t in $PCM_PLUGIN_LIST; do + if test "$p" = "$t" -o "$p" = "all"; then + eval build_pcm_$t="yes" + build_pcm_plugin="yes" + fi + done +done + +dnl special dependencies +if test "$build_pcm_plug" = "yes"; then + build_pcm_linear="yes" + build_pcm_copy="yes" +fi + +if test "$build_pcm_ioplug" = "yes"; then + build_pcm_extplug="yes" +fi + +AM_CONDITIONAL(BUILD_PCM_PLUGIN, test x$build_pcm_plugin = xyes) +AM_CONDITIONAL(BUILD_PCM_PLUGIN_COPY, test x$build_pcm_copy = xyes) +AM_CONDITIONAL(BUILD_PCM_PLUGIN_LINEAR, test x$build_pcm_linear = xyes) +AM_CONDITIONAL(BUILD_PCM_PLUGIN_ROUTE, test x$build_pcm_route = xyes) +AM_CONDITIONAL(BUILD_PCM_PLUGIN_MULAW, test x$build_pcm_mulaw = xyes) +AM_CONDITIONAL(BUILD_PCM_PLUGIN_ALAW, test x$build_pcm_alaw = xyes) +AM_CONDITIONAL(BUILD_PCM_PLUGIN_ADPCM, test x$build_pcm_adpcm = xyes) +AM_CONDITIONAL(BUILD_PCM_PLUGIN_RATE, test x$build_pcm_rate = xyes) +AM_CONDITIONAL(BUILD_PCM_PLUGIN_PLUG, test x$build_pcm_plug = xyes) +AM_CONDITIONAL(BUILD_PCM_PLUGIN_MULTI, test x$build_pcm_multi = xyes) +AM_CONDITIONAL(BUILD_PCM_PLUGIN_SHM, test x$build_pcm_shm = xyes) +AM_CONDITIONAL(BUILD_PCM_PLUGIN_FILE, test x$build_pcm_file = xyes) +AM_CONDITIONAL(BUILD_PCM_PLUGIN_NULL, test x$build_pcm_null = xyes) +AM_CONDITIONAL(BUILD_PCM_PLUGIN_SHARE, test x$build_pcm_share = xyes) +AM_CONDITIONAL(BUILD_PCM_PLUGIN_METER, test x$build_pcm_meter = xyes) +AM_CONDITIONAL(BUILD_PCM_PLUGIN_HOOKS, test x$build_pcm_hooks = xyes) +AM_CONDITIONAL(BUILD_PCM_PLUGIN_LFLOAT, test x$build_pcm_lfloat = xyes) +AM_CONDITIONAL(BUILD_PCM_PLUGIN_LADSPA, test x$build_pcm_ladspa = xyes) +AM_CONDITIONAL(BUILD_PCM_PLUGIN_DMIX, test x$build_pcm_dmix = xyes) +AM_CONDITIONAL(BUILD_PCM_PLUGIN_DSHARE, test x$build_pcm_dshare = xyes) +AM_CONDITIONAL(BUILD_PCM_PLUGIN_DSNOOP, test x$build_pcm_dsnoop = xyes) +AM_CONDITIONAL(BUILD_PCM_PLUGIN_ASYM, test x$build_pcm_asym = xyes) +AM_CONDITIONAL(BUILD_PCM_PLUGIN_IEC958, test x$build_pcm_iec958 = xyes) +AM_CONDITIONAL(BUILD_PCM_PLUGIN_SOFTVOL, test x$build_pcm_softvol = xyes) +AM_CONDITIONAL(BUILD_PCM_PLUGIN_EXTPLUG, test x$build_pcm_extplug = xyes) +AM_CONDITIONAL(BUILD_PCM_PLUGIN_IOPLUG, test x$build_pcm_ioplug = xyes) + +dnl Defines for plug plugin +if test "$build_pcm_rate" = "yes"; then + AC_DEFINE([BUILD_PCM_PLUGIN_RATE], "1", [Build PCM rate plugin]) +fi +if test "$build_pcm_route" = "yes"; then + AC_DEFINE([BUILD_PCM_PLUGIN_ROUTE], "1", [Build PCM route plugin]) +fi +if test "$build_pcm_lfloat" = "yes"; then + AC_DEFINE([BUILD_PCM_PLUGIN_LFLOAT], "1", [Build PCM lfloat plugin]) +fi +if test "$build_pcm_adpcm" = "yes"; then + AC_DEFINE([BUILD_PCM_PLUGIN_ADPCM], "1", [Build PCM adpcm plugin]) +fi +if test "$build_pcm_mulaw" = "yes"; then + AC_DEFINE([BUILD_PCM_PLUGIN_MULAW], "1", [Build PCM mulaw plugin]) +fi +if test "$build_pcm_alaw" = "yes"; then + AC_DEFINE([BUILD_PCM_PLUGIN_ALAW], "1", [Build PCM alaw plugin]) +fi + + +dnl Create PCM plugin symbol list for static library +rm -f src/pcm/pcm_symbols_list.c +for t in $PCM_PLUGIN_LIST; do + if eval test \$build_pcm_$t = yes; then + echo \&_snd_module_pcm_$t, >> src/pcm/pcm_symbols_list.c + fi +done + dnl Make a symlink for inclusion of alsa/xxx.h if test ! -L include/alsa ; then echo "Making a symlink include/alsa" diff --git a/modules/Makefile.am b/modules/Makefile.am index 98eda37c..bf9543e9 100644 --- a/modules/Makefile.am +++ b/modules/Makefile.am @@ -1 +1,3 @@ +if BUILD_MIXER SUBDIRS=mixer +endif diff --git a/src/Makefile.am b/src/Makefile.am index 5f5d76c8..f7cc81df 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -1,4 +1,3 @@ -SUBDIRS=control mixer pcm rawmidi timer hwdep seq instr compat conf alisp EXTRA_DIST=Versions COMPATNUM=@LIBTOOL_VERSION_INFO@ @@ -10,12 +9,35 @@ endif lib_LTLIBRARIES = libasound.la libasound_la_SOURCES = conf.c confmisc.c input.c output.c async.c error.c dlmisc.c socket.c shmarea.c userfile.c names.c -libasound_la_LIBADD = control/libcontrol.la \ - mixer/libmixer.la \ - pcm/libpcm.la \ - rawmidi/librawmidi.la timer/libtimer.la \ - hwdep/libhwdep.la seq/libseq.la instr/libinstr.la \ - compat/libcompat.la alisp/libalisp.la -lm -ldl -lpthread + +SUBDIRS=control +libasound_la_LIBADD = control/libcontrol.la +if BUILD_MIXER +SUBDIRS += mixer +libasound_la_LIBADD += mixer/libmixer.la +endif +if BUILD_PCM +SUBDIRS += pcm timer +libasound_la_LIBADD += pcm/libpcm.la timer/libtimer.la +endif +if BUILD_RAWMIDI +SUBDIRS += rawmidi +libasound_la_LIBADD += rawmidi/librawmidi.la +endif +if BUILD_HWDEP +SUBDIRS += hwdep +libasound_la_LIBADD += hwdep/libhwdep.la +endif +if BUILD_SEQ +SUBDIRS += seq +libasound_la_LIBADD += seq/libseq.la +endif +if BUILD_INSTR +SUBDIRS += instr +libasound_la_LIBADD += instr/libinstr.la +endif +SUBDIRS += compat conf alisp +libasound_la_LIBADD += compat/libcompat.la alisp/libalisp.la -lm -ldl -lpthread libasound_la_LDFLAGS = -version-info $(COMPATNUM) AM_LDFLAGS = $(VSYMS) diff --git a/src/pcm/Makefile.am b/src/pcm/Makefile.am index 7844bc4f..0e032b78 100644 --- a/src/pcm/Makefile.am +++ b/src/pcm/Makefile.am @@ -5,14 +5,97 @@ EXTRA_LTLIBRARIES = libpcm.la libpcm_la_SOURCES = atomic.c mask.c interval.c \ pcm.c pcm_params.c pcm_simple.c \ - pcm_hw.c pcm_generic.c pcm_plugin.c pcm_copy.c pcm_linear.c \ - pcm_route.c pcm_mulaw.c pcm_alaw.c pcm_adpcm.c \ - pcm_rate.c pcm_plug.c pcm_misc.c pcm_mmap.c pcm_multi.c \ - pcm_shm.c pcm_file.c pcm_null.c pcm_share.c \ - pcm_meter.c pcm_hooks.c pcm_lfloat.c pcm_ladspa.c \ - pcm_direct.c pcm_dmix.c pcm_dsnoop.c pcm_dshare.c \ - pcm_asym.c pcm_iec958.c pcm_softvol.c pcm_symbols.c \ - pcm_ioplug.c pcm_extplug.c + pcm_hw.c pcm_misc.c pcm_mmap.c pcm_symbols.c + +if BUILD_PCM_PLUGIN +libpcm_la_SOURCES += pcm_generic.c pcm_plugin.c +endif +if BUILD_PCM_PLUGIN_COPY +libpcm_la_SOURCES += pcm_copy.c +endif +if BUILD_PCM_PLUGIN_LINEAR +libpcm_la_SOURCES += pcm_linear.c +endif +if BUILD_PCM_PLUGIN_ROUTE +libpcm_la_SOURCES += pcm_route.c +endif +if BUILD_PCM_PLUGIN_MULAW +libpcm_la_SOURCES += pcm_mulaw.c +endif +if BUILD_PCM_PLUGIN_ALAW +libpcm_la_SOURCES += pcm_alaw.c +endif +if BUILD_PCM_PLUGIN_ADPCM +libpcm_la_SOURCES += pcm_adpcm.c +endif +if BUILD_PCM_PLUGIN_RATE +libpcm_la_SOURCES += pcm_rate.c +endif +if BUILD_PCM_PLUGIN_PLUG +libpcm_la_SOURCES += pcm_plug.c +endif +if BUILD_PCM_PLUGIN_MULTI +libpcm_la_SOURCES += pcm_multi.c +endif +if BUILD_PCM_PLUGIN_SHM +libpcm_la_SOURCES += pcm_shm.c +endif +if BUILD_PCM_PLUGIN_FILE +libpcm_la_SOURCES += pcm_file.c +endif +if BUILD_PCM_PLUGIN_NULL +libpcm_la_SOURCES += pcm_null.c +endif +if BUILD_PCM_PLUGIN_SHARE +libpcm_la_SOURCES += pcm_share.c +endif +if BUILD_PCM_PLUGIN_METER +libpcm_la_SOURCES += pcm_meter.c +endif +if BUILD_PCM_PLUGIN_HOOKS +libpcm_la_SOURCES += pcm_hooks.c +endif +if BUILD_PCM_PLUGIN_LFLOAT +libpcm_la_SOURCES += pcm_lfloat.c +endif +if BUILD_PCM_PLUGIN_LADSPA +libpcm_la_SOURCES += pcm_ladspa.c +endif +if BUILD_PCM_PLUGIN_DMIX +libpcm_la_SOURCES += pcm_dmix.c +endif +if BUILD_PCM_PLUGIN_DSHARE +libpcm_la_SOURCES += pcm_dshare.c +endif +if BUILD_PCM_PLUGIN_DSNOOP +libpcm_la_SOURCES += pcm_dsnoop.c +endif +if BUILD_PCM_PLUGIN_DMIX +libpcm_la_SOURCES += pcm_direct.c +else +if BUILD_PCM_PLUGIN_DSHARE +libpcm_la_SOURCES += pcm_direct.c +else +if BUILD_PCM_PLUGIN_DSNOOP +libpcm_la_SOURCES += pcm_direct.c +endif +endif +endif +if BUILD_PCM_PLUGIN_ASYM +libpcm_la_SOURCES += pcm_asym.c +endif +if BUILD_PCM_PLUGIN_IEC958 +libpcm_la_SOURCES += pcm_iec958.c +endif +if BUILD_PCM_PLUGIN_SOFTVOL +libpcm_la_SOURCES += pcm_softvol.c +endif +if BUILD_PCM_PLUGIN_EXTPLUG +libpcm_la_SOURCES += pcm_extplug.c +endif +if BUILD_PCM_PLUGIN_IOPLUG +libpcm_la_SOURCES += pcm_ioplug.c +endif EXTRA_DIST = pcm_dmix_i386.c pcm_dmix_x86_64.c pcm_dmix_generic.c diff --git a/src/pcm/pcm_plug.c b/src/pcm/pcm_plug.c index c3d4f651..0f5264c6 100644 --- a/src/pcm/pcm_plug.c +++ b/src/pcm/pcm_plug.c @@ -172,12 +172,27 @@ static snd_pcm_format_t linear_preferred_formats[] = { #endif }; -static snd_pcm_format_t nonlinear_preferred_formats[] = { - SND_PCM_FORMAT_MU_LAW, - SND_PCM_FORMAT_A_LAW, - SND_PCM_FORMAT_IMA_ADPCM, -}; +#if defined(BUILD_PCM_PLUGIN_MULAW) || \ + defined(BUILD_PCM_PLUGIN_ALAW) || \ + defined(BUILD_PCM_PLUGIN_ADPCM) +#define BUILD_PCM_NONLINEAR +#endif +#ifdef BUILD_PCM_NONLINEAR +static snd_pcm_format_t nonlinear_preferred_formats[] = { +#ifdef BUILD_PCM_PLUGIN_MULAW + SND_PCM_FORMAT_MU_LAW, +#endif +#ifdef BUILD_PCM_PLUGIN_ALAW + SND_PCM_FORMAT_A_LAW, +#endif +#ifdef BUILD_PCM_PLUGIN_ADPCM + SND_PCM_FORMAT_IMA_ADPCM, +#endif +}; +#endif + +#ifdef BUILD_PCM_PLUGIN_LFLOAT static snd_pcm_format_t float_preferred_formats[] = { #ifdef SND_LITTLE_ENDIAN SND_PCM_FORMAT_FLOAT_LE, @@ -191,6 +206,7 @@ static snd_pcm_format_t float_preferred_formats[] = { SND_PCM_FORMAT_FLOAT64_LE, #endif }; +#endif static char linear_format_widths[32] = { 0, 0, 0, 0, 0, 0, 0, 1, @@ -226,16 +242,28 @@ static snd_pcm_format_t snd_pcm_plug_slave_format(snd_pcm_format_t format, const int w, w1, u, e; snd_pcm_format_t f; snd_pcm_format_mask_t lin = { SND_PCM_FMTBIT_LINEAR }; - snd_pcm_format_mask_t fl = { SND_PCM_FMTBIT_FLOAT }; + snd_pcm_format_mask_t fl = { +#ifdef BUILD_PCM_PLUGIN_LFLOAT + SND_PCM_FMTBIT_FLOAT +#else + { 0 } +#endif + }; if (snd_pcm_format_mask_test(format_mask, format)) return format; if (!snd_pcm_format_mask_test(&lin, format) && !snd_pcm_format_mask_test(&fl, format)) { unsigned int i; switch (format) { +#ifdef BUILD_PCM_PLUGIN_MULAW case SND_PCM_FORMAT_MU_LAW: +#endif +#ifdef BUILD_PCM_PLUGIN_ALAW case SND_PCM_FORMAT_A_LAW: +#endif +#ifdef BUILD_PCM_PLUGIN_ADPCM case SND_PCM_FORMAT_IMA_ADPCM: +#endif for (i = 0; i < sizeof(linear_preferred_formats) / sizeof(linear_preferred_formats[0]); ++i) { snd_pcm_format_t f = linear_preferred_formats[i]; if (snd_pcm_format_mask_test(format_mask, f)) @@ -250,14 +278,17 @@ static snd_pcm_format_t snd_pcm_plug_slave_format(snd_pcm_format_t format, const snd_mask_intersect(&lin, format_mask); snd_mask_intersect(&fl, format_mask); if (snd_mask_empty(&lin) && snd_mask_empty(&fl)) { +#ifdef BUILD_PCM_NONLINEAR unsigned int i; for (i = 0; i < sizeof(nonlinear_preferred_formats) / sizeof(nonlinear_preferred_formats[0]); ++i) { snd_pcm_format_t f = nonlinear_preferred_formats[i]; if (snd_pcm_format_mask_test(format_mask, f)) return f; } +#endif return SND_PCM_FORMAT_UNKNOWN; } +#ifdef BUILD_PCM_PLUGIN_LFLOAT if (snd_pcm_format_float(format)) { if (snd_pcm_format_mask_test(&fl, format)) { unsigned int i; @@ -270,13 +301,17 @@ static snd_pcm_format_t snd_pcm_plug_slave_format(snd_pcm_format_t format, const w = 32; u = 0; e = snd_pcm_format_big_endian(format); - } else if (snd_mask_empty(&lin)) { + } else +#endif + if (snd_mask_empty(&lin)) { +#ifdef BUILD_PCM_PLUGIN_LFLOAT unsigned int i; for (i = 0; i < sizeof(float_preferred_formats) / sizeof(float_preferred_formats[0]); ++i) { snd_pcm_format_t f = float_preferred_formats[i]; if (snd_pcm_format_mask_test(format_mask, f)) return f; } +#endif return SND_PCM_FORMAT_UNKNOWN; } else { w = snd_pcm_format_width(format); @@ -320,6 +355,7 @@ typedef struct { } snd_pcm_plug_params_t; #endif +#ifdef BUILD_PCM_PLUGIN_RATE static int snd_pcm_plug_change_rate(snd_pcm_t *pcm, snd_pcm_t **new, snd_pcm_plug_params_t *clt, snd_pcm_plug_params_t *slv) { snd_pcm_plug_t *plug = pcm->private_data; @@ -336,7 +372,9 @@ static int snd_pcm_plug_change_rate(snd_pcm_t *pcm, snd_pcm_t **new, snd_pcm_plu slv->format = clt->format; return 1; } +#endif +#ifdef BUILD_PCM_PLUGIN_ROUTE static int snd_pcm_plug_change_channels(snd_pcm_t *pcm, snd_pcm_t **new, snd_pcm_plug_params_t *clt, snd_pcm_plug_params_t *slv) { snd_pcm_plug_t *plug = pcm->private_data; @@ -437,6 +475,7 @@ static int snd_pcm_plug_change_channels(snd_pcm_t *pcm, snd_pcm_t **new, snd_pcm slv->format = clt->format; return 1; } +#endif static int snd_pcm_plug_change_format(snd_pcm_t *pcm, snd_pcm_t **new, snd_pcm_plug_params_t *clt, snd_pcm_plug_params_t *slv) { @@ -446,30 +485,47 @@ static int snd_pcm_plug_change_format(snd_pcm_t *pcm, snd_pcm_t **new, snd_pcm_p int (*f)(snd_pcm_t **_pcm, const char *name, snd_pcm_format_t sformat, snd_pcm_t *slave, int close_slave); if (snd_pcm_format_linear(slv->format)) { /* Conversion is done in another plugin */ - if (clt->format == slv->format || - clt->rate != slv->rate || - clt->channels != slv->channels) - return 0; + if (clt->format == slv->format) { +#ifdef BUILD_PCM_PLUGIN_RATE + if (clt->rate != slv->rate) + return 0; +#endif +#ifdef BUILD_PCM_PLUGIN_ROUTE + if (clt->channels != slv->channels) + return 0; +#endif + } cfmt = clt->format; switch (clt->format) { +#ifdef BUILD_PCM_PLUGIN_MULAW case SND_PCM_FORMAT_MU_LAW: f = snd_pcm_mulaw_open; break; +#endif +#ifdef BUILD_PCM_PLUGIN_ALAW case SND_PCM_FORMAT_A_LAW: f = snd_pcm_alaw_open; break; +#endif +#ifdef BUILD_PCM_PLUGIN_ADPCM case SND_PCM_FORMAT_IMA_ADPCM: f = snd_pcm_adpcm_open; break; +#endif default: - if (snd_pcm_format_float(clt->format)) { +#ifdef BUILD_PCM_PLUGIN_LFLOAT + if (snd_pcm_format_float(clt->format)) f = snd_pcm_lfloat_open; - } else { + + else +#endif + { assert(snd_pcm_format_linear(clt->format)); f = snd_pcm_linear_open; } break; } +#ifdef BUILD_PCM_PLUGIN_LFLOAT } else if (snd_pcm_format_float(slv->format)) { /* Conversion is done in another plugin */ if (clt->format == slv->format && @@ -483,6 +539,8 @@ static int snd_pcm_plug_change_format(snd_pcm_t *pcm, snd_pcm_t **new, snd_pcm_p assert(0); /* TODO */ return -EINVAL; } +#endif +#ifdef BUILD_PCM_NONLINEAR } else { /* No conversion is needed */ if (clt->format == slv->format && @@ -490,15 +548,21 @@ static int snd_pcm_plug_change_format(snd_pcm_t *pcm, snd_pcm_t **new, snd_pcm_p clt->channels == clt->channels) return 0; switch (slv->format) { +#ifdef BUILD_PCM_PLUGIN_MULAW case SND_PCM_FORMAT_MU_LAW: f = snd_pcm_mulaw_open; break; +#endif +#ifdef BUILD_PCM_PLUGIN_ALAW case SND_PCM_FORMAT_A_LAW: f = snd_pcm_alaw_open; break; +#endif +#ifdef BUILD_PCM_PLUGIN_ADPCM case SND_PCM_FORMAT_IMA_ADPCM: f = snd_pcm_adpcm_open; break; +#endif default: assert(0); return -EINVAL; @@ -507,6 +571,7 @@ static int snd_pcm_plug_change_format(snd_pcm_t *pcm, snd_pcm_t **new, snd_pcm_p cfmt = clt->format; else cfmt = SND_PCM_FORMAT_S16; +#endif /* NONLINEAR */ } err = f(new, NULL, slv->format, plug->gen.slave, plug->gen.slave != plug->req_slave); if (err < 0) @@ -536,9 +601,15 @@ static int snd_pcm_plug_insert_plugins(snd_pcm_t *pcm, snd_pcm_plug_t *plug = pcm->private_data; static int (*funcs[])(snd_pcm_t *_pcm, snd_pcm_t **new, snd_pcm_plug_params_t *s, snd_pcm_plug_params_t *d) = { snd_pcm_plug_change_format, +#ifdef BUILD_PCM_PLUGIN_ROUTE snd_pcm_plug_change_channels, +#endif +#ifdef BUILD_PCM_PLUGIN_RATE snd_pcm_plug_change_rate, +#endif +#ifdef BUILD_PCM_PLUGIN_ROUTE snd_pcm_plug_change_channels, +#endif snd_pcm_plug_change_format, snd_pcm_plug_change_access }; @@ -551,7 +622,8 @@ static int snd_pcm_plug_insert_plugins(snd_pcm_t *pcm, client->access != p.access) { snd_pcm_t *new; int err; - assert(k < sizeof(funcs)/sizeof(*funcs)); + if (k >= sizeof(funcs)/sizeof(*funcs)) + return -EINVAL; err = funcs[k](pcm, &new, client, &p); if (err < 0) { snd_pcm_plug_clear(pcm); @@ -564,6 +636,7 @@ static int snd_pcm_plug_insert_plugins(snd_pcm_t *pcm, } k++; } +#ifdef BUILD_PCM_PLUGIN_ROUTE /* it's exception, user specified ttable, but no reduction/expand */ if (plug->ttable && !plug->ttable_ok) { snd_pcm_t *new; @@ -580,6 +653,7 @@ static int snd_pcm_plug_insert_plugins(snd_pcm_t *pcm, pcm->fast_ops = new->fast_ops; pcm->fast_op_arg = new->fast_op_arg; } +#endif return 0; } @@ -1079,6 +1153,7 @@ int _snd_pcm_plug_open(snd_pcm_t **pcmp, const char *name, slave = n; continue; } +#ifdef BUILD_PCM_PLUGIN_ROUTE if (strcmp(id, "ttable") == 0) { route_policy = PLUG_ROUTE_POLICY_NONE; if (snd_config_get_type(n) != SND_CONFIG_TYPE_COMPOUND) { @@ -1106,6 +1181,7 @@ int _snd_pcm_plug_open(snd_pcm_t **pcmp, const char *name, route_policy = PLUG_ROUTE_POLICY_DUP; continue; } +#endif SNDERR("Unknown field %s", id); return -EINVAL; } @@ -1119,6 +1195,7 @@ int _snd_pcm_plug_open(snd_pcm_t **pcmp, const char *name, SND_PCM_HW_PARAM_RATE, SCONF_UNCHANGED, &srate); if (err < 0) return err; +#ifdef BUILD_PCM_PLUGIN_ROUTE if (tt) { err = snd_pcm_route_determine_ttable(tt, &csize, &ssize); if (err < 0) { @@ -1136,6 +1213,7 @@ int _snd_pcm_plug_open(snd_pcm_t **pcmp, const char *name, return err; } } +#endif err = snd_pcm_open_slave(&spcm, root, sconf, stream, mode); snd_config_delete(sconf); diff --git a/src/pcm/pcm_symbols.c b/src/pcm/pcm_symbols.c index b192ba2a..d4f5f1b9 100644 --- a/src/pcm/pcm_symbols.c +++ b/src/pcm/pcm_symbols.c @@ -46,32 +46,12 @@ extern const char *_snd_module_pcm_dshare; extern const char *_snd_module_pcm_asym; extern const char *_snd_module_pcm_iec958; extern const char *_snd_module_pcm_softvol; +extern const char *_snd_module_pcm_extplug; +extern const char *_snd_module_pcm_ioplug; static const char **snd_pcm_open_objects[] = { - &_snd_module_pcm_adpcm, - &_snd_module_pcm_alaw, - &_snd_module_pcm_copy, - &_snd_module_pcm_file, - &_snd_module_pcm_hooks, &_snd_module_pcm_hw, - &_snd_module_pcm_linear, - &_snd_module_pcm_meter, - &_snd_module_pcm_mulaw, - &_snd_module_pcm_multi, - &_snd_module_pcm_null, - &_snd_module_pcm_plug, - &_snd_module_pcm_rate, - &_snd_module_pcm_route, - &_snd_module_pcm_share, - &_snd_module_pcm_shm, - &_snd_module_pcm_lfloat, - &_snd_module_pcm_ladspa, - &_snd_module_pcm_dmix, - &_snd_module_pcm_dsnoop, - &_snd_module_pcm_dshare, - &_snd_module_pcm_asym, - &_snd_module_pcm_iec958, - &_snd_module_pcm_softvol +#include "pcm_symbols_list.c" }; void *snd_pcm_open_symbols(void) diff --git a/src/rawmidi/Makefile.am b/src/rawmidi/Makefile.am index 45cb83a3..2470c7ad 100644 --- a/src/rawmidi/Makefile.am +++ b/src/rawmidi/Makefile.am @@ -1,6 +1,9 @@ EXTRA_LTLIBRARIES=librawmidi.la -librawmidi_la_SOURCES = rawmidi.c rawmidi_hw.c rawmidi_symbols.c rawmidi_virt.c +librawmidi_la_SOURCES = rawmidi.c rawmidi_hw.c rawmidi_symbols.c +if BUILD_SEQ +librawmidi_la_SOURCES += rawmidi_virt.c +endif noinst_HEADERS = rawmidi_local.h all: librawmidi.la