alsa: Support ALSA without a use case manager

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.
This commit is contained in:
Pierre Ossman 2013-07-10 16:26:17 +02:00 committed by Tanu Kaskinen
parent d90d99bd38
commit e55f4edaad
3 changed files with 73 additions and 2 deletions

View 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) ####

View 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

View file

@ -24,7 +24,11 @@
USA.
***/
#ifdef HAVE_ALSA_UCM
#include <use-case.h>
#else
typedef void snd_use_case_mgr_t;
#endif
#include "alsa-mixer.h"