]> code.delx.au - pulseaudio/commitdiff
alsa: Support ALSA without a use case manager
authorPierre Ossman <ossman@cendio.se>
Wed, 10 Jul 2013 14:26:17 +0000 (16:26 +0200)
committerTanu Kaskinen <tanu.kaskinen@linux.intel.com>
Thu, 11 Jul 2013 11:30:06 +0000 (14:30 +0300)
The ALSA use case manager is a fairly recent addition,
so make sure the ALSA modules can be used on systems that
have an older version of ALSA.

configure.ac
src/modules/alsa/alsa-ucm.c
src/modules/alsa/alsa-ucm.h

index 9cbcb6d7ed40da5916595db652d846088b33fdda..1d8e40a2eb41ada4c3f3a28fccf7e3560494fe98 100644 (file)
@@ -762,15 +762,24 @@ AC_ARG_ENABLE([alsa],
     AS_HELP_STRING([--disable-alsa],[Disable optional ALSA support]))
 
 AS_IF([test "x$enable_alsa" != "xno"],
-    [PKG_CHECK_MODULES(ASOUNDLIB, [ alsa >= 1.0.24 ], HAVE_ALSA=1, HAVE_ALSA=0)],
+    [PKG_CHECK_MODULES(ASOUNDLIB, [ alsa >= 1.0.19 ], HAVE_ALSA=1, HAVE_ALSA=0)],
     HAVE_ALSA=0)
 
 AS_IF([test "x$enable_alsa" = "xyes" && test "x$HAVE_ALSA" = "x0"],
-    [AC_MSG_ERROR([*** Needed alsa >= 1.0.24 support not found])])
+    [AC_MSG_ERROR([*** Needed alsa >= 1.0.19 support not found])])
+
+AS_IF([test "x$HAVE_ALSA" = "x1"],
+    [
+        save_CFLAGS="$CFLAGS"; CFLAGS="$CFLAGS $ASOUNDLIB_CFLAGS"
+        AC_CHECK_HEADERS([use-case.h], HAVE_ALSA_UCM=1, HAVE_ALSA_UCM=0)
+        CFLAGS="$save_CFLAGS"
+    ],
+    HAVE_ALSA_UCM=0)
 
 AC_SUBST(HAVE_ALSA)
 AM_CONDITIONAL([HAVE_ALSA], [test "x$HAVE_ALSA" = x1])
 AS_IF([test "x$HAVE_ALSA" = "x1"], AC_DEFINE([HAVE_ALSA], 1, [Have ALSA?]))
+AS_IF([test "x$HAVE_ALSA_UCM" = "x1"], AC_DEFINE([HAVE_ALSA_UCM], 1, [Have ALSA UCM?]))
 
 #### EsounD support (optional) ####
 
index 677db9947a3ee4c925a157fc71b51fd6aaa95add..be3ac74dcf10a6a18ae7f27cafb032fe0275771f 100644 (file)
@@ -66,6 +66,8 @@
     } while (0)
 #define PA_UCM_IS_MODIFIER_MAPPING(m) ((pa_proplist_gets((m)->proplist, PA_ALSA_PROP_UCM_MODIFIER)) != NULL)
 
+#ifdef HAVE_ALSA_UCM
+
 struct ucm_items {
     const char *id;
     const char *property;
@@ -1618,3 +1620,59 @@ void pa_alsa_ucm_roled_stream_end(pa_alsa_ucm_config *ucm, const char *role, pa_
         }
     }
 }
+
+#else /* HAVE_ALSA_UCM */
+
+/* Dummy functions for systems without UCM support */
+
+int pa_alsa_ucm_query_profiles(pa_alsa_ucm_config *ucm, int card_index) {
+        pa_log_info("UCM not available.");
+        return -1;
+}
+
+pa_alsa_profile_set* pa_alsa_ucm_add_profile_set(pa_alsa_ucm_config *ucm, pa_channel_map *default_channel_map) {
+    return NULL;
+}
+
+int pa_alsa_ucm_set_profile(pa_alsa_ucm_config *ucm, const char *new_profile, const char *old_profile) {
+    return -1;
+}
+
+int pa_alsa_ucm_get_verb(snd_use_case_mgr_t *uc_mgr, const char *verb_name, const char *verb_desc, pa_alsa_ucm_verb **p_verb) {
+    return -1;
+}
+
+void pa_alsa_ucm_add_ports(
+        pa_hashmap **hash,
+        pa_proplist *proplist,
+        pa_alsa_ucm_mapping_context *context,
+        bool is_sink,
+        pa_card *card) {
+}
+
+void pa_alsa_ucm_add_ports_combination(
+        pa_hashmap *hash,
+        pa_alsa_ucm_mapping_context *context,
+        bool is_sink,
+        pa_hashmap *ports,
+        pa_card_profile *cp,
+        pa_core *core) {
+}
+
+int pa_alsa_ucm_set_port(pa_alsa_ucm_mapping_context *context, pa_device_port *port, bool is_sink) {
+    return -1;
+}
+
+void pa_alsa_ucm_free(pa_alsa_ucm_config *ucm) {
+}
+
+void pa_alsa_ucm_mapping_context_free(pa_alsa_ucm_mapping_context *context) {
+}
+
+void pa_alsa_ucm_roled_stream_begin(pa_alsa_ucm_config *ucm, const char *role, pa_direction_t dir) {
+}
+
+void pa_alsa_ucm_roled_stream_end(pa_alsa_ucm_config *ucm, const char *role, pa_direction_t dir) {
+}
+
+#endif
index cdeb469e602579b1f7e5b3439036de83d2bcd78c..c31e5b19a8c325ed4d31aca49a3949788b4c4057 100644 (file)
   USA.
 ***/
 
+#ifdef HAVE_ALSA_UCM
 #include <use-case.h>
+#else
+typedef void snd_use_case_mgr_t;
+#endif
 
 #include "alsa-mixer.h"