[alsa-devel] Patches for libasound to support upcoming Audacious 2.2

John Lindgren john.lindgren at tds.net
Mon Oct 26 03:21:09 CET 2009


I've been working on the ALSA output for the upcoming 2.2 release of
Audacious media player and have run into some problems in
snd_device_name_hint, which is now used to show the user a list of
possible output devices.  I've written patches which correct those

The biggest problem is that in several places, functions called by
snd_device_name_hint call snd_config_delete on sections of the config
returned by snd_config_search.  Once these sections are deleted, future
calls to snd_pcm_open fail miserably.

        ALSA lib conf.c:4600:(snd_config_expand) Unknown parameters CARD=ICH6,DEV=0
        ALSA lib pcm.c:2211:(snd_pcm_open_noupdate) Unknown PCM front:CARD=ICH6,DEV=0
        alsa-gapless: snd_pcm_open failed: Invalid argument.

        ALSA lib pcm.c:2211:(snd_pcm_open_noupdate) Unknown PCM pulse
        alsa-gapless: snd_pcm_open failed: No such file or directory.

A smaller but still annoying problem shows up only once the offending
snd_config_delete calls are taken out: software devices, such as "pulse"
and "null" are listed twice or three times depending on how many
hardware devices I have plugged in.

A third problem is that "ctl" seems to be arbitrarily left out of the
list of device types that snd_device_name_hint will search for.  I've
added it to the list in this patch, and it seems to work fine.

Finally, a performance issue: snd_device_name_hint indirectly calls
snd_dlopen frequently with the parameter name == NULL, meaning to open
libasound.so itself.  In this case, snd_dlopen calls dladdr every call
to find out the path to libasound.so.  Caching this path within
snd_dlopen so that dladdr is called only once speeds up the execution
time of snd_device_name_hint (a somewhat slow call) by 40%.

I am attaching three patches that fix these problems:
 - src/conf.c
 - src/dlmisc.c
 - src/control/namehint.c

John Lindgren
-------------- next part --------------
A non-text attachment was scrubbed...
Name: conf.c.diff
Type: text/x-patch
Size: 394 bytes
Desc: not available
Url : http://mailman.alsa-project.org/pipermail/alsa-devel/attachments/20091025/2781670a/attachment.diff 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: dlmisc.c.diff
Type: text/x-patch
Size: 453 bytes
Desc: not available
Url : http://mailman.alsa-project.org/pipermail/alsa-devel/attachments/20091025/2781670a/attachment-0001.diff 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: namehint.c.diff
Type: text/x-patch
Size: 1926 bytes
Desc: not available
Url : http://mailman.alsa-project.org/pipermail/alsa-devel/attachments/20091025/2781670a/attachment-0002.diff 

More information about the Alsa-devel mailing list