OSDN Git Service

android-x86/external-alsa-lib.git
11 years agoseqmid: restore sequencer address prefix match feature
Clemens Ladisch [Mon, 13 May 2013 19:16:36 +0000 (21:16 +0200)]
seqmid: restore sequencer address prefix match feature

Commit 19892334499e (seq: Fix for snd_seq_parse_address()) removed the
ability to match sequencer client names by any of by their prefixes in
an attempt to avoid wrong matches when one client name is the prefix of
another.

However, the prefix match feature was documented and actually used.

Allow prefixes to match, but only if there is no exact match.

Signed-off-by: Clemens Ladisch <clemens@ladisch.de>
11 years agoconf - Add Scarlett 2i2 USB to S/PDIF blacklist
David Henningsson [Thu, 25 Apr 2013 12:44:06 +0000 (14:44 +0200)]
conf - Add Scarlett 2i2 USB to S/PDIF blacklist

The Scarlett 2i2 USB interface does not have any S/PDIF connections.

Signed-off-by: David Henningsson <david.henningsson@canonical.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
11 years agoAdd definition of __inline__ for non-GCC
Takashi Iwai [Thu, 25 Apr 2013 07:55:49 +0000 (09:55 +0200)]
Add definition of __inline__ for non-GCC

Signed-off-by: Takashi Iwai <tiwai@suse.de>
11 years agoUse __inline__ for exported headers
Takashi Iwai [Thu, 25 Apr 2013 07:52:33 +0000 (09:52 +0200)]
Use __inline__ for exported headers

Some programs are still using C90.

Bugzilla: https://bugzilla.novell.com/show_bug.cgi?id=817077
Signed-off-by: Takashi Iwai <tiwai@suse.de>
11 years agobring pcm.h and pcm.c in sync with the kernel list
Daniel Mack [Thu, 18 Apr 2013 08:37:50 +0000 (10:37 +0200)]
bring pcm.h and pcm.c in sync with the kernel list

In particular, this adds definitions and descriptions for G.723 and
DSD types.

Signed-off-by: Daniel Mack <zonque@gmail.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
11 years agopcm.c: fix indentation
Daniel Mack [Thu, 18 Apr 2013 08:37:49 +0000 (10:37 +0200)]
pcm.c: fix indentation

Signed-off-by: Daniel Mack <zonque@gmail.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
11 years agoFix doubly call of dlclose() in dlobj caching code
Takashi Iwai [Mon, 15 Apr 2013 16:12:17 +0000 (18:12 +0200)]
Fix doubly call of dlclose() in dlobj caching code

When multiple dlobj_cache items point to the same dlobj, dlclose() may
be called wrongly multiple times when these items are cleared, because
we manage the dlobj_cache list as a flat list.  This results in a bad
segfault we've seen in openal-soft, for example.

For fixing this, we need the refcounting of dlobj itself.  But, in
this case, we don't have to manage yet another list,  since dlopen()
does a proper refcounting by itself.  That is, we can just call always
dlopen() at each time a new function is assigned, and also call
dlclose() for each released dlobj_cache item at cleanup.

Bugzilla: https://bugzilla.novell.com/show_bug.cgi?id=814250

Signed-off-by: Takashi Iwai <tiwai@suse.de>
11 years agoRelease v1.0.27
Jaroslav Kysela [Thu, 11 Apr 2013 11:43:05 +0000 (13:43 +0200)]
Release v1.0.27

Signed-off-by: Jaroslav Kysela <perex@perex.cz>
11 years agocontrol: enhance doc for snd_ctl_ascii_value_parse() function
Jaroslav Kysela [Thu, 11 Apr 2013 11:36:56 +0000 (13:36 +0200)]
control: enhance doc for snd_ctl_ascii_value_parse() function

Signed-off-by: Jaroslav Kysela <perex@perex.cz>
11 years agoOptimize NULL check in snd_dlobj_cache_put()
Takashi Iwai [Tue, 9 Apr 2013 12:58:52 +0000 (14:58 +0200)]
Optimize NULL check in snd_dlobj_cache_put()

Signed-off-by: Takashi Iwai <tiwai@suse.de>
11 years agoClean up dlobj cache only when no user is present
Takashi Iwai [Tue, 9 Apr 2013 12:55:46 +0000 (14:55 +0200)]
Clean up dlobj cache only when no user is present

Cleaning up the dlobj cache seems crashing some cases when the library
is used from another plugin like openal-soft.  A simple workaround is
to do the cleanup only when really no user is left, i.e. after all
close calls.

Bugzilla: https://bugzilla.novell.com/show_bug.cgi?id=814250

Signed-off-by: Takashi Iwai <tiwai@suse.de>
11 years agopcm: direct plugins: do more safe IPC semaphore handling
Jaroslav Kysela [Tue, 9 Apr 2013 12:31:20 +0000 (14:31 +0200)]
pcm: direct plugins: do more safe IPC semaphore handling

As reported dead-lock, do local lock counting and invoke abort() when
the lock counts do not match at close() time.

Reported-by: <mateen abdulmateen.shaikh@gmail.com>
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
11 years agoall places: doxygen cleanups
Jaroslav Kysela [Mon, 8 Apr 2013 14:42:24 +0000 (16:42 +0200)]
all places: doxygen cleanups

I see no errors with these changes using doxygen 1.8.1.1 .

Signed-off-by: Jaroslav Kysela <perex@perex.cz>
11 years agocontrol, pcm: implement snd_ctl_abort() and snd_pcm_abort() functions
Jaroslav Kysela [Mon, 8 Apr 2013 11:28:03 +0000 (13:28 +0200)]
control, pcm: implement snd_ctl_abort() and snd_pcm_abort() functions

Upon an interrupt, it is necessary to abort the wait loops with the EINTR
error code. Introduce snd_*_abort() functions to handle this case.

Signed-off-by: Jaroslav Kysela <perex@perex.cz>
11 years agopcm: fix typo, should be SND_PCM_STATE_PREPARED.
Daniel Svensson [Thu, 4 Apr 2013 21:47:19 +0000 (23:47 +0200)]
pcm: fix typo, should be SND_PCM_STATE_PREPARED.

Signed-off-by: Daniel Svensson <dsvensson@gmail.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
11 years agoUSB-audio: Add "HP Digital Stereo Headset" to SPDIF blacklist
David Henningsson [Mon, 25 Mar 2013 05:41:57 +0000 (06:41 +0100)]
USB-audio: Add "HP Digital Stereo Headset" to SPDIF blacklist

Yet another headset without digital I/O.

Signed-off-by: David Henningsson <david.henningsson@canonical.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
11 years agopcm: fix and optimize snd_pcm_areas_copy function
Jaroslav Kysela [Wed, 20 Mar 2013 19:37:50 +0000 (20:37 +0100)]
pcm: fix and optimize snd_pcm_areas_copy function

The memcpy() function in snd_pcm_area_copy() should not be called
with the overlapped areas. Alex discovered - using own LD_PRELOAD checked
for memcpy() input - that the memcpy() is called with src == dst.

For some special plugin combos (rate+softvol+hw for example), the same
areas with same offsets can be asked to be copied (softvol). The collapse
check uses own areas created on heap, causing dst_area == src_area &&
dst_offset == src_offset check bypassed.

Two fixes are in this patch:

- use assert to check the memcpy() input for future triggers
- bypass the snd_pcm_area_copy() call for collapsed identical areas

Reported-by: Alexander Kruppa <akruppa@gmail.com>
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
11 years agosnd_mixer_poll_descriptors_revents should loop over pollfd
Sander Jansen [Mon, 25 Feb 2013 16:41:40 +0000 (10:41 -0600)]
snd_mixer_poll_descriptors_revents should loop over pollfd

Signed-off-by: Sander Jansen <s.jansen@gmail.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
11 years agoAdd workaround for conflicting IEC958 controls for HD-audio
Takashi Iwai [Mon, 11 Feb 2013 11:28:45 +0000 (12:28 +0100)]
Add workaround for conflicting IEC958 controls for HD-audio

When both an SPDIF and an HDMI output are present on HD-audio, both
try to access IEC958 controls with index=0 although one of them must
be wrong.  For avoiding this conflict, the recent kernel code (3.9 and
3.8 stable) moves the IEC958 controls of an SPDIF with index=16 once
when the conflict happens.

In this patch, the corresponding support is added in alsa-lib side.
The new "skip_rest" boolean flag is added to the hooked element
definition which indicates that the rest of element array will be
ignored once when this element is present and evaluated.  With this
new flag, the HD-audio config takes index=16 primarily, then take
index=0 as fallback.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
11 years agocontrol: Simplify using snd_config_get_bool()
Takashi Iwai [Fri, 12 Oct 2012 10:22:53 +0000 (12:22 +0200)]
control: Simplify using snd_config_get_bool()

snd_config_get_bool() was improved to parse also ASCII strings now,
so we don't have to open-code the boolean parser in
src/control/setup.c any longer.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
11 years agoAdd sys/types.h to include list
David Henningsson [Tue, 12 Feb 2013 09:06:11 +0000 (10:06 +0100)]
Add sys/types.h to include list

This is needed by snd_pcm_format_silence* functions which
return u_int*_t. It was discovered while trying to compile ALSA
programs with eglibc 2.17.

Credits to Richard Shaw, Gary Buhrmaster, Matthieu Baerts and
 Adam Conrad for this fix.

BugLink: https://bugs.launchpad.net/bugs/1109298
BugLink: https://bugzilla.redhat.com/show_bug.cgi?id=885306
Signed-off-by: David Henningsson <david.henningsson@canonical.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
11 years agoconf: Fix a memory access violation resulting from improper error propogation
Allan Wirth [Thu, 31 Jan 2013 18:55:33 +0000 (13:55 -0500)]
conf: Fix a memory access violation resulting from improper error propogation

Fixes an issue where a variable is used undeclared, which can cause seg
faults on some systems if the configuration file is not formatted
properly.

Signed-off-by: Allan Wirth <allan@allanwirth.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
11 years agosnd_device_name_hint(): do not use global snd_config.
Jerome Forissier [Thu, 31 Jan 2013 14:47:25 +0000 (15:47 +0100)]
snd_device_name_hint(): do not use global snd_config.

This commit and its parent make the function reentrant.

Signed-off-by: Jerome Forissier <jerome@taodyne.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
11 years agosnd_device_name_hint(): do not change the global error handler.
Jerome Forissier [Thu, 31 Jan 2013 14:47:24 +0000 (15:47 +0100)]
snd_device_name_hint(): do not change the global error handler.

This is the first step towards making this function reentrant.

Signed-off-by: Jerome Forissier <jerome@taodyne.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
11 years agoAdd snd_lib_error_set_local() to install a thread-local error handler.
Jerome Forissier [Thu, 31 Jan 2013 14:47:23 +0000 (15:47 +0100)]
Add snd_lib_error_set_local() to install a thread-local error handler.

This is required so we can make other functions reentrant (such as
snd_device_name_hint()).
The default error handling function snd_lib_error_default() now checks
if a local handler exists, and if so, calls it. Otherwise, the previous
behavior is unchanged.

Signed-off-by: Jerome Forissier <jerome@taodyne.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
11 years agosnd_pcm_direct_parse_open_conf(): use thread-safe getgrnam_r()
Jerome Forissier [Wed, 30 Jan 2013 15:22:17 +0000 (16:22 +0100)]
snd_pcm_direct_parse_open_conf(): use thread-safe getgrnam_r()

Fixes a thread safety issue with snd_pcm_open().

Signed-off-by: Jerome Forissier <jerome@taodyne.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
11 years agoucm: Set uc_mgr->ctl to NULL after closing it.
Tanu Kaskinen [Sat, 26 Jan 2013 12:20:20 +0000 (14:20 +0200)]
ucm: Set uc_mgr->ctl to NULL after closing it.

Fixes a double-free bug.

Signed-off-by: Tanu Kaskinen <tanuk@iki.fi>
Acked-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
11 years agoconfigure: do not detect incorrect cross-compiler
Olivier Blin [Sat, 15 Dec 2012 00:58:59 +0000 (01:58 +0100)]
configure: do not detect incorrect cross-compiler

On Ubuntu 11.04, configuring with --build=x86_64-unknown-linux-gnu
--host=x86_64-linux-gnu finds a wrong cross-compiler:
checking for cross-compiler... x86_64-x86_64-pc-linux-gnu-gcc

This happens because of a dash vs underscore inconsistency in configure.in:
host=x86_64-pc-linux-gnu
host_cpu=x86_64
host_os=linux-gnu
which ${host_cpu}-${host_os}-gcc >/dev/null 2>&1 && echo ${host_cpu}-${host-os}-gcc

This bug has been introduced in the initial --with-host support from
2002, commit eb267ade29c9a49c07b1c33dc9bf7a6790217400

This configure command is about "cross-compiling for i586", where the
system compiler is used, which just -m32 additional options.
The --build value comes from config.guess.

11 years agoFix endian check in local.h
Takashi Iwai [Thu, 13 Dec 2012 08:55:44 +0000 (09:55 +0100)]
Fix endian check in local.h

SNDRV_LITTLE_ENDIAN and SNDRV_BIG_ENDIAN checks have been removed from
sound/asound.h during UAPI header move, and this resulted in a wrong
detected endian.

Move together with the similar check for SND_*_ENDIAN at the earlier
place in local.h.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
11 years agomixer: Don't build simple_abst when no libdl is available
Takashi Iwai [Fri, 7 Dec 2012 08:28:06 +0000 (09:28 +0100)]
mixer: Don't build simple_abst when no libdl is available

Check BUILD_MODULES conditional not to compile simple_abst.c.
Also return -ENXIO to caller statically in that case.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
11 years agoconfigure: Quite AM_CONDITIONAL() arguments
Takashi Iwai [Fri, 7 Dec 2012 08:27:11 +0000 (09:27 +0100)]
configure: Quite AM_CONDITIONAL() arguments

Otherwise it won't be processed properly with the recent automake.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
11 years agoPCM: Fix conflict of _snd_pcm_hw_params definitions
Takashi Iwai [Tue, 4 Dec 2012 11:17:00 +0000 (12:17 +0100)]
PCM: Fix conflict of _snd_pcm_hw_params definitions

Fix the call of _snd_pcm_hw_params() to _snd_pcm_hw_params_internal().
The build passed wrongly because of _snd_pcm_hw_params define.
Having the same function name as the struct name is is simply
confusing...

Also, to be sure, _snd_pcm_hw_params is undef'ed in pcm_local.h, too.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
11 years agoAdd workaround for conflicting snd_seq_event_t definitions
Takashi Iwai [Fri, 30 Nov 2012 13:33:54 +0000 (14:33 +0100)]
Add workaround for conflicting snd_seq_event_t definitions

Signed-off-by: Takashi Iwai <tiwai@suse.de>
11 years agoPCM: shut up a compile "unused parameter" compile warning in pcm_multi.c
Takashi Iwai [Mon, 26 Nov 2012 17:13:01 +0000 (18:13 +0100)]
PCM: shut up a compile "unused parameter" compile warning in pcm_multi.c

Signed-off-by: Takashi Iwai <tiwai@suse.de>
11 years agoPCM: Add more chmap definitions for UAC2
Takashi Iwai [Mon, 26 Nov 2012 17:10:26 +0000 (18:10 +0100)]
PCM: Add more chmap definitions for UAC2

The new PCM chmap positions have been added in (to be) 3.8-rc1 kernel,
and now updated alsa-lib, too.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
11 years agoMerge kernel uapi/sound/asound.h and asequencer.h
Takashi Iwai [Mon, 26 Nov 2012 16:54:29 +0000 (17:54 +0100)]
Merge kernel uapi/sound/asound.h and asequencer.h

Instead of keeping modified asound.h and asequencer.h, copy the files
in the kernel include/uapi/sound as is, and give some renames for
avoiding conflicts with alsa-lib's definitions.

Some structs, unions and typedefs in asound.h and asequencer.h are
once renamed in local.h before inclusion, then renamed back again.

A bonus by this action is that some local codes don't have to refer to
sndrv_xxx any longer.  However, some codes like src/seq/seq.c need
explicit cast because of unavoidable conflicts of struct types.

Another significant change is that now snd_pcm_sw_params.period_event
field is removed.  Instead, try to access the last reserved field
internally.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
11 years agoPCM: Avoid busy loop in snd_pcm_write_areas() with rate plugin
Takashi Iwai [Tue, 13 Nov 2012 15:16:26 +0000 (16:16 +0100)]
PCM: Avoid busy loop in snd_pcm_write_areas() with rate plugin

snd_pcm_write_areas() tries to wait until avail >= avail_min condition
is satisfied.  This doesn't work always well when a rate plugin is in
the play.

When a partial data with a smaller size than a period is written, the
rate plugin doesn't transfer the data immediately to the slave PCM,
but kept in an internal buffer and it changes only the hwptr of the
plugin.  Thus, the condition "avail < avail_min" is triggered for a
wait check although the underlying slave PCM has enough room.  This
results in a call of snd_pcm_wait() which returns immediately after
poll() call, and the snd_pcm_write_areas() loop continues.  As a
consequence, it falls into a CPU hog.

This patch fixes that busy loop by introducing a new fast_ops to check
the availability for wait of avail_min.  Then a plugin can ask the
slave PCM whether the wait is required (or possible).

A few plugins like multi plugin need a special handling.  Otherwise a
generic plugin function can be used.

Reported-by: Trent Piepho <tpiepho@gmail.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
11 years agoReduce compilation warnings
Jaroslav Kysela [Tue, 30 Oct 2012 12:07:48 +0000 (13:07 +0100)]
Reduce compilation warnings

Signed-off-by: Jaroslav Kysela <perex@perex.cz>
11 years agoPCM: Fix memory leak for pcm empty and asym plugins
Jaroslav Kysela [Tue, 30 Oct 2012 10:43:07 +0000 (11:43 +0100)]
PCM: Fix memory leak for pcm empty and asym plugins

The init-only plugins do not have own pcm handle, so free the references
to open function immediately after open.

Signed-off-by: Jaroslav Kysela <perex@perex.cz>
11 years agopcm: fix 64-bit SNDRV_PCM_IOCTL_STATUS ABI breakage
Clemens Ladisch [Sun, 28 Oct 2012 11:30:29 +0000 (12:30 +0100)]
pcm: fix 64-bit SNDRV_PCM_IOCTL_STATUS ABI breakage

Commit cf40ea169aad (pcm: support for audio timestamps) added the new
audio_tstamp field to struct sndrv_pcm_status.  However, struct timespec
requires 64-bit alignment, so the 64-bit compiler would insert
32 bits of padding before this field, which broke SNDRV_PCM_IOCTL_STATUS
with error messages like this:

      kernel: unknown ioctl = 0x80984120

To solve this, insert the padding explicitly so that it can be taken
into account when calculating the ABI structure size.

Signed-off-by: Clemens Ladisch <clemens@ladisch.de>
11 years agopcm: support for audio timestamps
Pierre-Louis Bossart [Tue, 12 Jun 2012 19:36:40 +0000 (14:36 -0500)]
pcm: support for audio timestamps

add new snd_pcm_status_get_audio_htstamp() routine to
query the audio timestamps provided by the kernel.

This change provides applications with better ways
to track elapsed time. Before this patch, applications
would subtract queued samples (delay) from written samples,
resulting in a 1-2 sample error.

Also add snd_pcm_hw_params_supports_audio_wallclock_ts()
to query what the hardware supports.

TODO: check protocol compatibility?

Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
11 years agoPCM: Fix the invalid snd_pcm_close() calls in rate plugin
Takashi Iwai [Wed, 10 Oct 2012 08:22:54 +0000 (10:22 +0200)]
PCM: Fix the invalid snd_pcm_close() calls in rate plugin

It happens in the error path, should call snd_pcm_free() instead.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
11 years agoUpdate .gitignore
Takashi Iwai [Sat, 22 Sep 2012 07:38:28 +0000 (09:38 +0200)]
Update .gitignore

Signed-off-by: Takashi Iwai <tiwai@suse.de>
11 years agotest: add audio_time
Pierre-Louis Bossart [Sat, 22 Sep 2012 01:05:18 +0000 (20:05 -0500)]
test: add audio_time

Simple test to create playback and capture streams, and
check elapsed time vs. sample counts reported by driver.
This should be helpful for driver developers and anyone
interested in system/audio time drift.

tested only on HDAudio

[added Makefile.am change by tiwai]

TODO:
- make period configurable
- better output messages
- support for wall clock when it's in the mainline

Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
11 years agoPCM: Fix infinite loop in htimestamp of dmix, dsnoop and dshare plugins
Takashi Iwai [Fri, 21 Sep 2012 15:59:42 +0000 (17:59 +0200)]
PCM: Fix infinite loop in htimestamp of dmix, dsnoop and dshare plugins

Signed-off-by: Takashi Iwai <tiwai@suse.de>
11 years agoPCM: Fill SND_CHMAP_NA to silent channels in route plugin
Takashi Iwai [Thu, 20 Sep 2012 11:43:12 +0000 (13:43 +0200)]
PCM: Fill SND_CHMAP_NA to silent channels in route plugin

Instead of SND_CHMAP_UNKNOWN, fill SND_CHMAP_NA to the silent channels.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
11 years agoPCM: A few doxygen fixes for chmap stuff
Takashi Iwai [Thu, 13 Sep 2012 06:38:59 +0000 (08:38 +0200)]
PCM: A few doxygen fixes for chmap stuff

Signed-off-by: Takashi Iwai <tiwai@suse.de>
11 years agoPCM: Fix the conversion from string to chmap position
Takashi Iwai [Wed, 12 Sep 2012 16:44:42 +0000 (18:44 +0200)]
PCM: Fix the conversion from string to chmap position

Use strncasecmp() to allow lower cases, and also evaluate the inverted
phase suffix, too.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
11 years agoPCM: Define MONO and other channel map positions
Takashi Iwai [Wed, 12 Sep 2012 16:43:59 +0000 (18:43 +0200)]
PCM: Define MONO and other channel map positions

Follow the new definitions in the kernel side.  MONO and others have
been added, and the order of position table was changed again.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
11 years agotest/chmap: Fix wrong malloc size
Takashi Iwai [Thu, 13 Sep 2012 06:06:26 +0000 (08:06 +0200)]
test/chmap: Fix wrong malloc size

Signed-off-by: Takashi Iwai <tiwai@suse.de>
11 years agoconf: Add chmap definitions to TRIDENT and SI7018 configurations
Takashi Iwai [Wed, 12 Sep 2012 15:34:49 +0000 (17:34 +0200)]
conf: Add chmap definitions to TRIDENT and SI7018 configurations

Manually add the channel map definitions as the channel front/rear is
determined dynamically.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
11 years agoPCM: Use compounds for overriding / enhancing chmaps
Takashi Iwai [Wed, 12 Sep 2012 15:13:22 +0000 (17:13 +0200)]
PCM: Use compounds for overriding / enhancing chmaps

Instead of a single channel map, multiple channel maps can be provided
in a form of compound (array) to hw and null plugins.  In null
get_chmap, the channel map corresponding to the current channels is
copied from the given channel maps.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
11 years agoAdd chmap override definitions for Emu10k1, Audigy and Audigy2 cards
Takashi Iwai [Wed, 12 Sep 2012 13:15:32 +0000 (15:15 +0200)]
Add chmap override definitions for Emu10k1, Audigy and Audigy2 cards

These cards won't provide the channel maps from the driver itself
because of the dynamic routing.  For simplicity, define chmaps in the
configurations, so that chmap querying of individual stereo streams
and combined multi streams works properly.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
11 years agoPCM: Add the missing query_chmaps for route plugin
Takashi Iwai [Wed, 12 Sep 2012 13:09:57 +0000 (15:09 +0200)]
PCM: Add the missing query_chmaps for route plugin

Also fix the channel count in get_chmap for route plugin.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
11 years agoPCM: Add chmap options to hw and null plugins
Takashi Iwai [Wed, 12 Sep 2012 12:47:17 +0000 (14:47 +0200)]
PCM: Add chmap options to hw and null plugins

Add a config definition "chmap" to override (or enhance) the channel
maps.  So far, only a single channel map can be provided, and the
channel count consistency isn't strictly tested at all.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
11 years agoPCM: Add query_chmaps support to multi plugin
Takashi Iwai [Wed, 12 Sep 2012 10:56:14 +0000 (12:56 +0200)]
PCM: Add query_chmaps support to multi plugin

Also fix some bugs in get_chmap().

Signed-off-by: Takashi Iwai <tiwai@suse.de>
11 years agoPCM: Add snd_pcm_chmap_long_name()
Takashi Iwai [Tue, 11 Sep 2012 10:48:46 +0000 (12:48 +0200)]
PCM: Add snd_pcm_chmap_long_name()

Just return a more verbose name than snd_pcm_chmap_name(), but
including white spaces.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
11 years agoPCM: Add SND_CHMAP_API_VERSION definition
Takashi Iwai [Tue, 11 Sep 2012 09:33:31 +0000 (11:33 +0200)]
PCM: Add SND_CHMAP_API_VERSION definition

Just to make it easier for apps to support chmap conditionally via
simple ifdefs.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
11 years agoPCM: Add string conversion helper functions for chmap
Takashi Iwai [Mon, 10 Sep 2012 16:07:36 +0000 (18:07 +0200)]
PCM: Add string conversion helper functions for chmap

Added a few helper functions between chmap and string.
  snd_pcm_chmap_type_name() -- a string of the given chmap type
  snd_pcm_chmap_name() -- a string of the given channel position
  snd_pcm_chmap_print() -- print channel map on the given buffer
  snd_pcm_chmap_from_string() -- get a channel position from string
  snd_pcm_parse_string() -- parse the whole channel map from string

Signed-off-by: Takashi Iwai <tiwai@suse.de>
11 years agoPCM: Fix prefix for snd_pcm_chmap_type enum members
Takashi Iwai [Mon, 10 Sep 2012 14:59:36 +0000 (16:59 +0200)]
PCM: Fix prefix for snd_pcm_chmap_type enum members

Add _TYPE prefix to distinguish from the channel position.
Also add SND_CHMAP_TYPE_LAST entry pointing the last one like other
enums.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
11 years agoFix duplicated channel entry in test/chmap.c
Takashi Iwai [Fri, 7 Sep 2012 12:31:39 +0000 (14:31 +0200)]
Fix duplicated channel entry in test/chmap.c

Signed-off-by: Takashi Iwai <tiwai@suse.de>
11 years agoPCM: Implement snd_pcm_query_chmaps_from_hw()
Takashi Iwai [Fri, 7 Sep 2012 12:15:04 +0000 (14:15 +0200)]
PCM: Implement snd_pcm_query_chmaps_from_hw()

This is a function similar like snd_pcm_query_chmaps() but performs
the query without a PCM handle.  The card, device and substream
numbers are passed as well as stream direction.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
11 years agoPCM: Introduce snd_pcm_chmap_t and snd_pcm_chmap_query_t
Takashi Iwai [Tue, 4 Sep 2012 15:26:43 +0000 (17:26 +0200)]
PCM: Introduce snd_pcm_chmap_t and snd_pcm_chmap_query_t

Instead of passing ambiguous integer array, define snd_pcm_chmap_t and
snd_pcm_chmap_query_t so that user can understand more easily which
element is for what.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
11 years agoAdd SND_CHMAP_NA and bit flag definitions
Takashi Iwai [Fri, 31 Aug 2012 20:53:22 +0000 (13:53 -0700)]
Add SND_CHMAP_NA and bit flag definitions

Signed-off-by: Takashi Iwai <tiwai@suse.de>
11 years agoFollow channel position definitions to mixer channel in mixer.h
Takashi Iwai [Tue, 21 Aug 2012 13:07:44 +0000 (15:07 +0200)]
Follow channel position definitions to mixer channel in mixer.h

mixer.h already contains some channel position definitions.
To be more consistent over all systems, better to follow the same
order for the new channel map, too.  But since UNKNOWN channel must be
zero but the definition in mixer.h contains -1 as UNKNOWN, simply
shift the value with 1.

If the conversion is required between SND_CHMAP and SND_MIXER_SCHN,
just increment/decrement 1.  Eventually I'll provide helper functions
for that...

Signed-off-by: Takashi Iwai <tiwai@suse.de>
11 years agoDefine channel map position enum in pcm.h
Takashi Iwai [Tue, 21 Aug 2012 10:16:39 +0000 (12:16 +0200)]
Define channel map position enum in pcm.h

The original definition is in sound/asound.h, but we need to export to
alsa-lib users, too.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
11 years agoCache the chmap operation errors
Takashi Iwai [Mon, 30 Jul 2012 16:21:43 +0000 (18:21 +0200)]
Cache the chmap operation errors

... not to retry the same error again.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
11 years agoAdd test/chmap program
Takashi Iwai [Mon, 30 Jul 2012 13:50:44 +0000 (15:50 +0200)]
Add test/chmap program

Signed-off-by: Takashi Iwai <tiwai@suse.de>
11 years agoImplement get_chmap/set_chmap for PCM extplug/ioplug plugins
Takashi Iwai [Wed, 25 Jul 2012 13:54:45 +0000 (15:54 +0200)]
Implement get_chmap/set_chmap for PCM extplug/ioplug plugins

Added the new ops for both external plugins, so the protocol numbers
are incremented.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
11 years agoImplement get_chmap/set_chmap for PCM plug, route and multi plugins
Takashi Iwai [Wed, 25 Jul 2012 13:36:16 +0000 (15:36 +0200)]
Implement get_chmap/set_chmap for PCM plug, route and multi plugins

Still incomplete implementations.  The query and set ops are missing
for route and multi plugins.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
11 years agoImplement the channel mapping API
Takashi Iwai [Wed, 25 Jul 2012 13:05:15 +0000 (15:05 +0200)]
Implement the channel mapping API

Added new channel-mapping API functions.
Not all plugins are covered, especially the route, multi and external
plugins don't work yet.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
11 years agoRelease v1.0.26
Jaroslav Kysela [Thu, 6 Sep 2012 08:55:14 +0000 (10:55 +0200)]
Release v1.0.26

Signed-off-by: Jaroslav Kysela <perex@perex.cz>
11 years agodoc: Use 'rm -rf' for the html doxygen tree (it contains search/ dir now)
Jaroslav Kysela [Thu, 6 Sep 2012 08:53:14 +0000 (10:53 +0200)]
doc: Use 'rm -rf' for the html doxygen tree (it contains search/ dir now)

Signed-off-by: Jaroslav Kysela <perex@perex.cz>
11 years agoPCM: plug: Move fast_ops copy after slave configuration.
Reilly Grant [Tue, 6 Dec 2011 02:05:42 +0000 (18:05 -0800)]
PCM: plug: Move fast_ops copy after slave configuration.

This is an OpenPGP/MIME signed message (RFC 2440 and 3156)
The plug plugin copies the fast_ops structure and fast_op_arg from its
slave PCM on initialization and after inserting a new plugin. This works
unless the slave PCM is also an instance of the plug plugin because plug
can change its fast_ops structure during _snd_pcm_hw_params.

Instead of copying fast_ops in snd_pcm_plug_insert_plugins wait until
the end of snd_pcm_plug_hw_params when the slave has been fully
initialized.

This fixes a crash when two instances of plug are instantiated back to
back and the format conversion plugin inserted by the second is skipped
by the first because the fast_ops pointer is not properly updated.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
11 years agoPCM: Allow to run older version of extplug plugin
Takashi Iwai [Wed, 15 Aug 2012 15:05:37 +0000 (17:05 +0200)]
PCM: Allow to run older version of extplug plugin

Also show the incompatible plugin version number in error messages.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
11 years agoIgnore .* files in general
Takashi Iwai [Fri, 10 Aug 2012 12:24:59 +0000 (14:24 +0200)]
Ignore .* files in general

Signed-off-by: Takashi Iwai <tiwai@suse.de>
11 years agoucm: Add const to execute_cset() argument
Takashi Iwai [Fri, 10 Aug 2012 12:19:17 +0000 (14:19 +0200)]
ucm: Add const to execute_cset() argument

Now with the previous rewrite of execute_cset(), the cset string is no
longer modified, thus we can pass const safely.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
11 years agoucm: Improve cset command parsing
Takashi Iwai [Fri, 10 Aug 2012 12:14:28 +0000 (14:14 +0200)]
ucm: Improve cset command parsing

The cset command parsing in ucm/main.c assumes implicitly that the
argument contains no space, thus an example below wouldn't work:
    cset "name='Input Select' Digital Mic"

This patch introduces a new internal API function
__snd_ctl_ascii_elem_id_parse() to improve the cset parser.

Reported-by: Tanu Kaskinen <tanu.kaskinen@digia.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
11 years agotest/latency.c: Fix string argument to getopt_long, so now it handles -E and -B
Mario Domenech Goulart [Wed, 8 Aug 2012 14:03:19 +0000 (11:03 -0300)]
test/latency.c: Fix string argument to getopt_long, so now it handles -E and -B

Signed-off-by: Takashi Iwai <tiwai@suse.de>
11 years agoucm: Return NULL from get_list0() and get_list20() in case of empty lists.
Tanu Kaskinen [Wed, 1 Aug 2012 13:06:16 +0000 (16:06 +0300)]
ucm: Return NULL from get_list0() and get_list20() in case of empty lists.

alloc_str_list() sets the result to NULL too, so this patch
makes the behavior more consistent. This also fixes a crash
in PulseAudio, because PulseAudio assumes that
snd_use_case_get_list() always initializes the result, and
since snd_use_case_get_list() uses get_list20(), this
assumption didn't hold.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
12 years agobuild: Disable another compile chack with --disable-alsatest
Arun Raghavan [Tue, 17 Jul 2012 10:00:17 +0000 (15:30 +0530)]
build: Disable another compile chack with --disable-alsatest

Signed-off-by: Arun Raghavan <arun.raghavan@collabora.co.uk>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
12 years agoucm: Add missing pthread.h include
Arun Raghavan [Tue, 17 Jul 2012 10:00:16 +0000 (15:30 +0530)]
ucm: Add missing pthread.h include

Needed for the use of pthread_mutex_t

Signed-off-by: Arun Raghavan <arun.raghavan@collabora.co.uk>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
12 years agobuild: Fallback to alphasort() if versionsort() isn't available
Arun Raghavan [Tue, 17 Jul 2012 10:00:15 +0000 (15:30 +0530)]
build: Fallback to alphasort() if versionsort() isn't available

versionsort() is a GNU-ism and can't be relied on for non-GNU systems.

[modified to define SORTFUNC instead of copying lines by tiwai]

Signed-off-by: Arun Raghavan <arun.raghavan@collabora.co.uk>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
12 years agocontrol: Use strcpy() instead of stpcpy()
Arun Raghavan [Tue, 17 Jul 2012 10:00:14 +0000 (15:30 +0530)]
control: Use strcpy() instead of stpcpy()

This allows us to build in environments that don't provide stpcpy().
This makes it necessary to traverse the string twice, but should not be
noticeable in clients since this function is very unlikely to be part of
a performance-critical path.

[coding style fixed by tiwai]

Signed-off-by: Arun Raghavan <arun.raghavan@collabora.co.uk>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
12 years agohctl: Remove a useless assert
Martin Sandsmark [Thu, 5 Jul 2012 07:40:07 +0000 (09:40 +0200)]
hctl: Remove a useless assert

The case where the element is unavailable (for example gone away since
the event was created) is handled beneath.

See also bug 5471.
https://bugtrack.alsa-project.org/alsa-bug/view.php?id=5471

Signed-off-by: Takashi Iwai <tiwai@suse.de>
12 years agoFix the binary compatibility of ext-ctl plugin with protocol 1.0.0
Takashi Iwai [Mon, 25 Jun 2012 21:16:14 +0000 (23:16 +0200)]
Fix the binary compatibility of ext-ctl plugin with protocol 1.0.0

Signed-off-by: Takashi Iwai <tiwai@suse.de>
12 years agoucm: Handle repeat device and modifier enables/disables
Arun Raghavan [Wed, 23 May 2012 12:46:33 +0000 (18:16 +0530)]
ucm: Handle repeat device and modifier enables/disables

Currently, enabling a device twice can cause it to be added to
snd_use_case_mgr_t->active_devices twice, causing the list to become a
loop and subsequent uses to result in an infinite loop.

This patch makes sure we don't enable/disable a device twice, and avoid
doing the same for modifiers.

Signed-off-by: Arun Raghavan <arun.raghavan@collabora.co.uk>
Acked-by: Liam Girdwood <lrg@ti.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
12 years agoconf: Add more USB devices to S/PDIF blacklist
David Henningsson [Wed, 23 May 2012 07:59:50 +0000 (09:59 +0200)]
conf: Add more USB devices to S/PDIF blacklist

These devices don't have digital in/out, so prevent them from being
opened.

Signed-off-by: David Henningsson <david.henningsson@canonical.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
12 years agotlv: improve robustness of raw value ranges
Benoît Thébaudeau [Tue, 22 May 2012 23:53:01 +0000 (01:53 +0200)]
tlv: improve robustness of raw value ranges

snd_tlv_convert_from_dB() relies on rangemin/max blindly.
Since this function is exported, it is better for robustness and
consistency to parse the range properly, which this patch does.

Signed-off-by: Benoît Thébaudeau <benoit.thebaudeau@advansee.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
12 years agopcm_dsnoop: comment fall-through in next "case"
Antonio Borneo [Mon, 14 May 2012 15:56:34 +0000 (23:56 +0800)]
pcm_dsnoop: comment fall-through in next "case"

Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
12 years agopcm: add missing "break" in "switch"
Antonio Borneo [Sat, 12 May 2012 16:06:23 +0000 (00:06 +0800)]
pcm: add missing "break" in "switch"

A missing "break" in procedure snd_pcm_write_mmap() causes
execution of "case SND_PCM_ACCESS_MMAP_NONINTERLEAVED" to
fall through next "default" case of the "switch" statement.
Since "default" handles error cases, the procedure returns
error.

The error fixed by this patch blocks transfer of capture
data from kernel to application. Execution get stuck in
alsa-lib, that discards all received data.

Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
12 years agoFix invalid long long format specifier
John Spencer [Tue, 24 Apr 2012 10:58:48 +0000 (12:58 +0200)]
Fix invalid long long format specifier

Per POSIX:

       L      Specifies that a following a, A, e, E, f, F, g, or G  conversion
              specifier applies to a long double argument.

L is only intended to be used with long doubles, not long long ints.

the proper way is to use "ll" instead.

Signed-off-by: John Spencer <maillist-alsa@barfooze.de>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
12 years agoalsa-lib conf: Add two more USB devices to iec958 blacklist
David Henningsson [Mon, 23 Apr 2012 08:39:13 +0000 (10:39 +0200)]
alsa-lib conf: Add two more USB devices to iec958 blacklist

Add "Logitech Wireless Headset" and "Logitech Speaker Lapdesk N700" to
the iec958 blacklist.
Also reorder the list in alphabetic order.

BugLink: https://bugs.launchpad.net/bugs/987163
Reported-by: Jean-Baptiste Lallement <jean-baptiste@ubuntu.com>
Signed-off-by: David Henningsson <david.henningsson@canonical.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
12 years agocontrol_external: Add ability to specify TLV data.
Dylan Reid [Sun, 15 Apr 2012 23:59:55 +0000 (16:59 -0700)]
control_external: Add ability to specify TLV data.

Allow external control plugins to provide TLV data.  This allows
user-space pcms to specify dB ranges for controls.

This follows the same model as the ALSA drivers for accessing the
data.  The code is based on that implementation.  The control can
provide static data or a callback.  The data is accessed or modified
in the new snd_ctl_ext_elem_tlv callback.

Rev bump the protocol version to enable checking if an external
control supports TLV.

Signed-off-by: Dylan Reid <dgreid@chromium.org>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
12 years agoalsa-lib conf: block S/PDIF access for Sennheiser USB headset
David Henningsson [Fri, 13 Apr 2012 23:14:09 +0000 (01:14 +0200)]
alsa-lib conf: block S/PDIF access for Sennheiser USB headset

The Sennheiser USB headset has no S/PDIF input or output, so make
sure we can't open it that way.

Signed-off-by: David Henningsson <david.henningsson@canonical.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
12 years agodoc: Fix typo in PCM formats
Adrian Knoth [Tue, 27 Mar 2012 15:54:47 +0000 (17:54 +0200)]
doc: Fix typo in PCM formats

Of course, 24bit samples are not stored in three bits, but bytes.

Signed-off-by: Adrian Knoth <adi@drcomp.erfurt.thur.de>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
12 years agoseqmid - more descriptions on snd_seq_parse_address() behavior
Henning Thielemann [Wed, 14 Mar 2012 17:45:02 +0000 (18:45 +0100)]
seqmid - more descriptions on snd_seq_parse_address() behavior

Signed-off-by: Takashi Iwai <tiwai@suse.de>
12 years agomixer: Remove redundant CHECK_ENUM() from snd_mixer_selem_is_enum*()
Takashi Iwai [Tue, 13 Mar 2012 13:30:22 +0000 (14:30 +0100)]
mixer: Remove redundant CHECK_ENUM() from snd_mixer_selem_is_enum*()

The functions to check whether the element is an enum don't need the
extra check of the type.  It should return simply 0 or 1 without error.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
12 years agoUSB-Audio: Fixup card name for Logitech web camera
David Henningsson [Fri, 9 Mar 2012 13:06:04 +0000 (14:06 +0100)]
USB-Audio: Fixup card name for Logitech web camera

Reported-by: Raymond Yau <superquad.vortex2@gmail.com>
Signed-off-by: David Henningsson <david.henningsson@canonical.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
12 years agoUSB-Audio: Blacklist iec958 for some USB devices
David Henningsson [Fri, 9 Mar 2012 10:46:06 +0000 (11:46 +0100)]
USB-Audio: Blacklist iec958 for some USB devices

Some common USB devices are analog only, so prevent the digital
devices from being opened. This simplifies probing the device
in PulseAudio.

I have a "Logitech USB Headset" myself, the "Logitech Web Camera"
was reported by Raymond Yau, and the "Blue Snowball" was reported by
Andy Whitcroft.

Cc: Andy Whitcroft <andy.whitcroft@canonical.com>
Cc: Raymond Yau <superquad.vortex2@gmail.com>
BugLink: https://bugs.launchpad.net/bugs/940145
Signed-off-by: David Henningsson <david.henningsson@canonical.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>