aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTakashi Iwai <tiwai@suse.de>2012-01-26 10:59:02 +0100
committerTakashi Iwai <tiwai@suse.de>2012-01-26 11:00:46 +0100
commit7beefe00090663a29e1aeddfa23bc4155abbd98f (patch)
treeb547c00b47863ec51828a93314d1bb764ded7fe7
parente474e7c17da8842c572237b21f5d13ae4a7e7bf7 (diff)
downloadsalsa-lib-7beefe00090663a29e1aeddfa23bc4155abbd98f.tar.gz
Add --disable-user-elem configure option
-rw-r--r--README4
-rw-r--r--configure.ac15
-rw-r--r--src/control.c3
-rw-r--r--src/ctl_func.h2
-rw-r--r--src/ctl_macros.h44
-rw-r--r--src/recipe.h.in3
6 files changed, 70 insertions, 1 deletions
diff --git a/README b/README
index 39b7233..89907fa 100644
--- a/README
+++ b/README
@@ -96,6 +96,10 @@ disabled as default. For enabling the floating-point math calculation
used in dB <-> linear conversion for the mixer, pass --enable-float
option as well.
+The support for user-space control elements is enabled as default
+to keep the compatibility with the older salsa-lib releases. But now
+it can be disabled via --disable-user-elem configure option, too.
+
The async handler support can be enabled via --enable-async option.
It's disabled as default.
diff --git a/configure.ac b/configure.ac
index d56bc9c..8735957 100644
--- a/configure.ac
+++ b/configure.ac
@@ -81,6 +81,12 @@ AC_ARG_ENABLE(tlv,
AS_HELP_STRING([--enable-tlv],
[enable TLV (dB) support]),
tlv="$enableval", tlv="no")
+
+AC_ARG_ENABLE(user-elem,
+ AS_HELP_STRING([--disable-user-elem],
+ [disable user-space control element support]),
+ user_elem="$enableval", user_elem="yes")
+
AC_ARG_ENABLE(async,
AS_HELP_STRING([--enable-async],
[enable async handler support]),
@@ -140,6 +146,7 @@ if test "$everything" = "yes"; then
sndconf="yes"
sndseq="yes"
tlv="yes"
+ user_elem="yes"
async="yes"
libasound="yes"
symfuncs="yes"
@@ -167,6 +174,13 @@ else
fi
AC_SUBST(SALSA_HAS_TLV_SUPPORT)
+if test "$user_elem" = "yes"; then
+ SALSA_HAS_USER_ELEM_SUPPORT=1
+else
+ SALSA_HAS_USER_ELEM_SUPPORT=0
+fi
+AC_SUBST(SALSA_HAS_USER_ELEM_SUPPORT)
+
if test "$async" = "yes"; then
SALSA_HAS_ASYNC_SUPPORT=1
else
@@ -270,6 +284,7 @@ echo " - Timer interface: $timer"
echo " - ALSA-config dummy interface: $sndconf"
echo " - ALSA-sequencer dummy interface: $sndseq"
echo " - TLV (dB) support: $tlv"
+echo " - User-space control element support: $user_elem"
echo " - Async handler support: $async"
echo " - Make ABI-compatible libasound.so: $libasound"
echo " - Mark deprecated attribute: $markdeprecated"
diff --git a/src/control.c b/src/control.c
index ea12f54..2047438 100644
--- a/src/control.c
+++ b/src/control.c
@@ -104,7 +104,7 @@ int snd_ctl_close(snd_ctl_t *ctl)
return 0;
}
-
+#if SALSA_HAS_USER_ELEM_SUPPORT
/*
* add/remove user-defined controls
*/
@@ -219,6 +219,7 @@ int snd_ctl_elem_add_enumerated(snd_ctl_t *ctl, const snd_ctl_elem_id_t *id,
info.value.enumerated.names_length = len;
return snd_ctl_elem_add(ctl, &info);
}
+#endif /* USER_ELEM_SUPPORT */
#if SALSA_HAS_TLV_SUPPORT
/*
diff --git a/src/ctl_func.h b/src/ctl_func.h
index 9cbe131..c9e8001 100644
--- a/src/ctl_func.h
+++ b/src/ctl_func.h
@@ -51,6 +51,7 @@ int snd_async_add_ctl_handler(snd_async_handler_t **handler, snd_ctl_t *ctl,
void *private_data);
#endif
+#if SALSA_HAS_USER_ELEM_SUPPORT
int snd_ctl_elem_add_integer(snd_ctl_t *ctl, const snd_ctl_elem_id_t *id,
unsigned int count, long min, long max, long step);
int snd_ctl_elem_add_integer64(snd_ctl_t *ctl, const snd_ctl_elem_id_t *id,
@@ -62,6 +63,7 @@ int snd_ctl_elem_add_iec958(snd_ctl_t *ctl, const snd_ctl_elem_id_t *id);
int snd_ctl_elem_add_enumerated(snd_ctl_t *ctl, const snd_ctl_elem_id_t *id,
unsigned int count, unsigned int items,
const char *const names[]);
+#endif
#if SALSA_HAS_TLV_SUPPORT
int snd_tlv_parse_dB_info(unsigned int *tlv,
diff --git a/src/ctl_macros.h b/src/ctl_macros.h
index 737cfd0..2bfd3a4 100644
--- a/src/ctl_macros.h
+++ b/src/ctl_macros.h
@@ -112,9 +112,13 @@ int snd_ctl_elem_info(snd_ctl_t *ctl, snd_ctl_elem_info_t *info)
__SALSA_EXPORT_FUNC
int snd_ctl_elem_add(snd_ctl_t *ctl, snd_ctl_elem_info_t *info)
{
+#if SALSA_HAS_USER_ELEM_SUPPORT
if (ioctl(ctl->fd, SNDRV_CTL_IOCTL_ELEM_ADD, info) < 0)
return -errno;
return 0;
+#else
+ return -ENXIO;
+#endif
}
__SALSA_EXPORT_FUNC
@@ -1020,6 +1024,46 @@ int snd_ctl_convert_from_dB(snd_ctl_t *ctl, const snd_ctl_elem_id_t *id,
#endif /* !SALSA_HAS_TLV_SUPPORT */
/*
+ */
+#if !SALSA_HAS_USER_ELEM_SUPPORT
+__SALSA_EXPORT_FUNC __SALSA_NOT_IMPLEMENTED
+int snd_ctl_elem_add_integer(snd_ctl_t *ctl, const snd_ctl_elem_id_t *id,
+ unsigned int count, long min, long max, long step)
+{
+ return -ENXIO;
+}
+
+__SALSA_EXPORT_FUNC __SALSA_NOT_IMPLEMENTED
+int snd_ctl_elem_add_integer64(snd_ctl_t *ctl, const snd_ctl_elem_id_t *id,
+ unsigned int count, long long min, long long max,
+ long long step)
+{
+ return -ENXIO;
+}
+
+__SALSA_EXPORT_FUNC __SALSA_NOT_IMPLEMENTED
+int snd_ctl_elem_add_boolean(snd_ctl_t *ctl, const snd_ctl_elem_id_t *id,
+ unsigned int count)
+{
+ return -ENXIO;
+}
+
+__SALSA_EXPORT_FUNC __SALSA_NOT_IMPLEMENTED
+int snd_ctl_elem_add_iec958(snd_ctl_t *ctl, const snd_ctl_elem_id_t *id)
+{
+ return -ENXIO;
+}
+
+__SALSA_EXPORT_FUNC __SALSA_NOT_IMPLEMENTED
+int snd_ctl_elem_add_enumerated(snd_ctl_t *ctl, const snd_ctl_elem_id_t *id,
+ unsigned int count, unsigned int items,
+ const char *const names[])
+{
+ return -ENXIO;
+}
+#endif /* !SALSA_HAS_USER_ELEM_SUPPORT */
+
+/*
* not implemented yet
*/
diff --git a/src/recipe.h.in b/src/recipe.h.in
index 9a99150..c444f13 100644
--- a/src/recipe.h.in
+++ b/src/recipe.h.in
@@ -7,6 +7,9 @@
/* Build with async support */
#define SALSA_HAS_ASYNC_SUPPORT @SALSA_HAS_ASYNC_SUPPORT@
+/* Build with user-space control element support */
+#define SALSA_HAS_USER_ELEM_SUPPORT @SALSA_HAS_USER_ELEM_SUPPORT@
+
/* Build with dummy conf support */
#define SALSA_HAS_DUMMY_CONF @SALSA_HAS_DUMMY_CONF@