diff --git a/0024-Define-sysdefault-PCM-and-control.patch b/0024-Define-sysdefault-PCM-and-control.patch new file mode 100644 index 0000000..c9c5b4f --- /dev/null +++ b/0024-Define-sysdefault-PCM-and-control.patch @@ -0,0 +1,50 @@ +From e6f990e5c9be5cac6f36924d20a75d0f69d27297 Mon Sep 17 00:00:00 2001 +From: Takashi Iwai +Date: Tue, 26 Jul 2011 13:05:53 +0200 +Subject: [PATCH 1/2] Define "sysdefault" PCM and control + +When "default" PCM and control definitions are overwritten by others +like PulseAudio setup, the original system-default defition is lost. +This is a problem when PA is temporarily (or intentionally) disabled +and user wants to use the default dmix. + +This patch adds a new standard definition for the system-default, +"sysdefault". This can be used for fallbacks. + +Signed-off-by: Takashi Iwai +--- + src/conf/alsa.conf | 4 +++- + 1 files changed, 3 insertions(+), 1 deletions(-) + +diff --git a/src/conf/alsa.conf b/src/conf/alsa.conf +index 1889f01..a33c24e 100644 +--- a/src/conf/alsa.conf ++++ b/src/conf/alsa.conf +@@ -119,6 +119,7 @@ defaults.timer.subdevice 0 + pcm.cards cards.pcm + + pcm.default cards.pcm.default ++pcm.sysdefault cards.pcm.default + pcm.front cards.pcm.front + pcm.rear cards.pcm.rear + pcm.center_lfe cards.pcm.center_lfe +@@ -321,7 +322,7 @@ pcm.null { + # Control interface + # + +-ctl.default { ++ctl.sysdefault { + type hw + card { + @func getenv +@@ -335,6 +336,7 @@ ctl.default { + } + } + } ++ctl.default ctl.sysdefault + + ctl.hw { + @args [ CARD ] +-- +1.7.6 + diff --git a/0025-Add-snd_-ctl-pcm-_open_fallback-functions.patch b/0025-Add-snd_-ctl-pcm-_open_fallback-functions.patch new file mode 100644 index 0000000..20e9972 --- /dev/null +++ b/0025-Add-snd_-ctl-pcm-_open_fallback-functions.patch @@ -0,0 +1,116 @@ +From acb423d937111d682706169bcdcb58c70fdfa84d Mon Sep 17 00:00:00 2001 +From: Takashi Iwai +Date: Tue, 26 Jul 2011 13:10:24 +0200 +Subject: [PATCH 2/2] Add snd_{ctl|pcm}_open_fallback() functions + +This patch adds new API functions, snd_ctl_open_fallback() and +snd_pcm_open_fallback(). These are just like snd_*_open_lconf() but +used to open a fallback PCM/control. The difference is that it replaces +the name string with the given original name, so that hctl and other +upper-layers will recognize it as an alias. + +Signed-off-by: Takashi Iwai +--- + include/control.h | 1 + + include/pcm.h | 3 +++ + src/control/control.c | 22 ++++++++++++++++++++++ + src/pcm/pcm.c | 24 ++++++++++++++++++++++++ + 4 files changed, 50 insertions(+), 0 deletions(-) + +diff --git a/include/control.h b/include/control.h +index e8f38bb..f265e34 100644 +--- a/include/control.h ++++ b/include/control.h +@@ -224,6 +224,7 @@ char *snd_device_name_get_hint(const void *hint, const char *id); + + int snd_ctl_open(snd_ctl_t **ctl, const char *name, int mode); + int snd_ctl_open_lconf(snd_ctl_t **ctl, const char *name, int mode, snd_config_t *lconf); ++int snd_ctl_open_fallback(snd_ctl_t **ctl, snd_config_t *root, const char *name, const char *orig_name, int mode); + int snd_ctl_close(snd_ctl_t *ctl); + int snd_ctl_nonblock(snd_ctl_t *ctl, int nonblock); + int snd_async_add_ctl_handler(snd_async_handler_t **handler, snd_ctl_t *ctl, +diff --git a/include/pcm.h b/include/pcm.h +index 7243ffb..be355a9 100644 +--- a/include/pcm.h ++++ b/include/pcm.h +@@ -410,6 +410,9 @@ int snd_pcm_open(snd_pcm_t **pcm, const char *name, + int snd_pcm_open_lconf(snd_pcm_t **pcm, const char *name, + snd_pcm_stream_t stream, int mode, + snd_config_t *lconf); ++int snd_pcm_open_fallback(snd_pcm_t **pcm, snd_config_t *root, ++ const char *name, const char *orig_name, ++ snd_pcm_stream_t stream, int mode); + + int snd_pcm_close(snd_pcm_t *pcm); + const char *snd_pcm_name(snd_pcm_t *pcm); +diff --git a/src/control/control.c b/src/control/control.c +index 19e9389..cd17c6f 100644 +--- a/src/control/control.c ++++ b/src/control/control.c +@@ -919,6 +919,28 @@ int snd_ctl_open_lconf(snd_ctl_t **ctlp, const char *name, + return snd_ctl_open_noupdate(ctlp, lconf, name, mode); + } + ++/** ++ * \brief Opens a fallback CTL ++ * \param ctlp Returned CTL handle ++ * \param root Configuration root ++ * \param name ASCII identifier of the CTL handle used as fallback ++ * \param orig_name The original ASCII name ++ * \param mode Open mode (see #SND_CTL_NONBLOCK, #SND_CTL_ASYNC) ++ * \return 0 on success otherwise a negative error code ++ */ ++int snd_ctl_open_fallback(snd_ctl_t **ctlp, snd_config_t *root, ++ const char *name, const char *orig_name, int mode) ++{ ++ int err; ++ assert(ctlp && name && root); ++ err = snd_ctl_open_noupdate(ctlp, root, name, mode); ++ if (err >= 0) { ++ free((*ctlp)->name); ++ (*ctlp)->name = orig_name ? strdup(orig_name) : NULL; ++ } ++ return err; ++} ++ + #ifndef DOC_HIDDEN + #define TYPE(v) [SND_CTL_ELEM_TYPE_##v] = #v + #define IFACE(v) [SND_CTL_ELEM_IFACE_##v] = #v +diff --git a/src/pcm/pcm.c b/src/pcm/pcm.c +index 02dea0d..12f8cd0 100644 +--- a/src/pcm/pcm.c ++++ b/src/pcm/pcm.c +@@ -2259,6 +2259,30 @@ int snd_pcm_open_lconf(snd_pcm_t **pcmp, const char *name, + return snd_pcm_open_noupdate(pcmp, lconf, name, stream, mode, 0); + } + ++/** ++ * \brief Opens a fallback PCM ++ * \param pcmp Returned PCM handle ++ * \param root Configuration root ++ * \param name ASCII identifier of the PCM handle ++ * \param orig_name The original ASCII name ++ * \param stream Wanted stream ++ * \param mode Open mode (see #SND_PCM_NONBLOCK, #SND_PCM_ASYNC) ++ * \return 0 on success otherwise a negative error code ++ */ ++int snd_pcm_open_fallback(snd_pcm_t **pcmp, snd_config_t *root, ++ const char *name, const char *orig_name, ++ snd_pcm_stream_t stream, int mode) ++{ ++ int err; ++ assert(pcmp && name && root); ++ err = snd_pcm_open_noupdate(pcmp, root, name, stream, mode, 0); ++ if (err >= 0) { ++ free((*pcmp)->name); ++ (*pcmp)->name = orig_name ? strdup(orig_name) : NULL; ++ } ++ return err; ++} ++ + #ifndef DOC_HIDDEN + int snd_pcm_new(snd_pcm_t **pcmp, snd_pcm_type_t type, const char *name, + snd_pcm_stream_t stream, int mode) +-- +1.7.6 + diff --git a/alsa.changes b/alsa.changes index 9f7cb9d..88da3dd 100644 --- a/alsa.changes +++ b/alsa.changes @@ -1,3 +1,13 @@ +------------------------------------------------------------------- +Wed Jul 27 15:25:23 CEST 2011 - tiwai@suse.de + +- Fix enumeration of default PCM in addition to sysdefault + +------------------------------------------------------------------- +Tue Jul 26 15:42:37 CEST 2011 - tiwai@suse.de + +- Add fallback PCM/control support (for pulse plugin) + ------------------------------------------------------------------- Mon Jul 11 10:57:25 CEST 2011 - tiwai@suse.de diff --git a/alsa.spec b/alsa.spec index 95b75e5..b009b2e 100644 --- a/alsa.spec +++ b/alsa.spec @@ -74,6 +74,8 @@ Patch20: 0020-emu10k1.conf-Fix-no-sound-problem-when-using-SB-Live.patch Patch21: 0021-ctlparse-Respect-softfloat-configure-option.patch Patch22: 0022-UCM-Fix-typo-in-error-message.patch Patch23: 0023-UCM-Fix-deadlock-following-failed-get-_verb.patch +Patch24: 0024-Define-sysdefault-PCM-and-control.patch +Patch25: 0025-Add-snd_-ctl-pcm-_open_fallback-functions.patch Patch99: alsa-lib-doxygen-avoid-crash-for-11.3.diff Url: http://www.alsa-project.org/ BuildRoot: %{_tmppath}/%{name}-%{version}-build @@ -172,6 +174,8 @@ Authors: %patch21 -p1 %patch22 -p1 %patch23 -p1 +%patch24 -p1 +%patch25 -p1 %if %suse_version == 1130 %patch99 -p1 %endif