OSDN Git Service
Andrey Mazo [Sat, 16 Nov 2013 21:11:55 +0000 (01:11 +0400)]
pcm_file: fixed memory leak.
Valgrind report for this leak was:
Command: aplay -Dfile:'/tmp/qqq',raw qqq.wav
14 bytes in 1 blocks are definitely lost in loss record 1 of 2
at 0x402BF5C: malloc (in /usr/lib/valgrind/vgpreload_memcheck-x86-linux.so)
by 0x40D7557: snd_pcm_file_hw_params (in /usr/lib/libasound.so.2.0.0)
by 0x40BA093: _snd_pcm_hw_params_internal (in /usr/lib/libasound.so.2.0.0)
by 0x40AB831: snd_pcm_hw_params (in /usr/lib/libasound.so.2.0.0)
by 0x804C523: ??? (in /usr/bin/aplay)
by 0x804E5B7: ??? (in /usr/bin/aplay)
by 0x804FC8C: ??? (in /usr/bin/aplay)
by 0x80520FB: ??? (in /usr/bin/aplay)
by 0x4184942: (below main) (libc-start.c:226)
Signed-off-by: Andrey Mazo <mazo@telum.ru>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Andrey Mazo [Sat, 16 Nov 2013 21:11:54 +0000 (01:11 +0400)]
pcm_file: fix SEGFAULT if file option is missing while infile is not.
Commit
5c5f1358123af69155267463a0b6254ad9cbecc4 requires both file and
infile options to be missing to report a failure.
In fact, only file option is mandatory and should be checked there.
Otherwise, NULL file triggers segfault in
snd_pcm_file_replace_fname() called from
snd_pcm_file_open_output_file().
infile option is optional, so don't report fatal error if it's missing.
Signed-off-by: Andrey Mazo <mazo@telum.ru>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Timo Teräs [Fri, 8 Nov 2013 12:17:58 +0000 (13:17 +0100)]
conf.c: use portable way to initialize recursive mutex
PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP is not in POSIX, as _NP
(non-portable) suggests.
exposing such a symbol in musl libc would lock in the ABI for all
times and makes it impossible to do future changes to the under-
lying struct without hideous symbol versioning hacks.
use the portable way instead: pthread_once was designed for such
cases.
Signed-off-by: Timo Teräs <timo.teras@iki.fi>
Tested-by: John Spencer <maillist-alsa@barfooze.de>
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
Jaroslav Kysela [Fri, 8 Nov 2013 11:30:04 +0000 (12:30 +0100)]
include/global.h - don't define timeval and timespec structures for !glibc
On request from John Spencer <maillist-alsa@barfooze.de> .
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
Takashi Iwai [Mon, 4 Nov 2013 13:19:03 +0000 (14:19 +0100)]
test/chmap: Add missing usage text for -s option
Signed-off-by: Takashi Iwai <tiwai@suse.de>
John Spencer [Thu, 10 Oct 2013 16:56:22 +0000 (18:56 +0200)]
local.h: include sys/types.h to fix issues with pcm.h
sys/types.h is required for the u_int_XX types used by pcm.h.
since a change in pcm.h is not desired, we add the inclusion
to the header that includes pcm.h during build.
Signed-off-by: John Spencer <maillist-alsa@barfooze.de>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Waldemar Brodkorb [Wed, 2 Oct 2013 19:00:51 +0000 (21:00 +0200)]
remove unnecessary/obsolete compat/hsearch_r.c
The usage of hsearch functions where removed long time
ago in commit
273d115de05574251bdd661747ecb68449a5cf1d.
This patch highly increases portability for non-glibc systems.
Remove the complete compat directory as requested by
Takashi Iwai.
Signed-off-by: Waldemar Brodkorb <wbx@openadk.org>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Stephen Warren [Mon, 30 Sep 2013 21:25:49 +0000 (15:25 -0600)]
snd_tlv_convert_from_dB: fix decreasing gain across entries
Currently, for a TLV consisting of TLV_DB_SCALE_ITEMs, if e.g. alsamixer
calls snd_mixer_selem_set_playback_dB() with a value that is in-between
two TLV_DB_SCALE_ITEMs, and xdir is negative, the selected raw hardware
value is the minimum in the first range above that value, rather than the
maximum in the last range below that value.
The user-visible symptom is that in alsamixer, pressing the down key to
reduce the value sticks at certain points, and cannot be incrementally
reduced any further, although directly selecting a much lower value (e.g.
by pressing 0..9) works as expected. This is triggered e.g. by
sound/soc/codec/max98090.c's max98090_hp_tlv[].
Fix this by checking whether xdir is positive or not, rather than
checking whether it has a non-zero value. The code to select the previous
range's max value is already present. This matches how xdir is used in
other parts of the code.
Signed-off-by: Stephen Warren <swarren@nvidia.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Anssi Hannula [Sun, 22 Sep 2013 21:41:50 +0000 (00:41 +0300)]
HDA-Intel: present up to 8 HDMI/DP outputs via "hdmi" device
Some new AMD cards have HDA codecs presenting 6 connected HDMI/DP pin
nodes (plus 1 unconnected pin node) according to the ALSA card database.
Example:
http://www.alsa-project.org/db/?f=
de3ced7af41de0ed54d218650e5e2f16c511787b
Bump the maximum number of presented HDMI outputs per card via the
"hdmi" PCM from 4 to 8 (so that the last possible device is DEV=7).
Note that HDMI PCM devices DEV=4..7 use shared PCM device numbers, so
HDA cards that have over 4 audio PCM devices or multiple S/PDIF or modem
devices will have their remaining PCM devices misrepresented as HDMI
devices.
Signed-off-by: Anssi Hannula <anssi.hannula@iki.fi>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
David Henningsson [Fri, 13 Sep 2013 17:21:44 +0000 (13:21 -0400)]
Fix access of freed memory in namehints
Sometimes a hook manipulates the config tree, which makes currently
running iterators point to freed memory. As a workaround, make two
copies, one for the iterators and another for the hooks.
BugLink: https://bugs.launchpad.net/bugs/1008600
Signed-off-by: David Henningsson <david.henningsson@canonical.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Kai Kang [Thu, 15 Aug 2013 09:17:19 +0000 (17:17 +0800)]
Update iatomic.h functions definitions for mips
Functions atomic_add(s) and atomic_sub(s) are defined with 'extern
__inline__' that may cause compile fails when cross compile for mips.
The error message looks like:
| pcm/.libs/libpcm.a(pcm_meter.o): In function `snd_pcm_meter_update_scope':
| .../alsa-lib-1.0.27.2/src/pcm/pcm_meter.c:139: undefined reference to `atomic_sub'
Replace the 'extern __inline__' with 'static __inline__' to fix this
issue.
Signed-off-by: Kai Kang <jiashuo.kang at gmail.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Adrian Knoth [Mon, 19 Aug 2013 15:31:37 +0000 (17:31 +0200)]
hdspm.h: Update LTC ioctl to use struct hdspm_ltc
Use struct hdspm_ltc to query the LTC, using a mixer struct was just
plain wrong.
Due to the wrong struct, this ioctl was never working, so we're free to
fix it without breaking userspace compatibility.
Signed-off-by: Adrian Knoth <adi@drcomp.erfurt.thur.de>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Arun Raghavan [Wed, 7 Aug 2013 17:56:31 +0000 (23:26 +0530)]
UCM: Document some standard values
Playback/CaptureChannels has been around for a bit. Playback/CaptureRate
is new and is intended to be used to specify the sample rate at which
the Playback/CapturePCM should be opened.
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Laurentiu Nicola [Thu, 8 Aug 2013 10:29:09 +0000 (12:29 +0200)]
pcm: Fix a wrong value shown in the error message in rate plugin
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Przemek Rudy [Tue, 30 Jul 2013 20:31:44 +0000 (22:31 +0200)]
conf/cards: add Audio Advantage Micro II
With related kernel chnages add extended suport for:
- AES bits controls (via device suffix AESn= or tools like iecset)
- SPDIF switch control, turning on/off the optical transmitter (via alsamixer tool)
Signed-off-by: Przemek Rudy <prudy1@o2.pl>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Jaroslav Kysela [Tue, 23 Jul 2013 12:50:41 +0000 (14:50 +0200)]
local.h: use __kernel_off_t from <linux/types.h>
Also, make the empty definitions __user and __force conditional.
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
Jaroslav Kysela [Mon, 8 Jul 2013 12:31:36 +0000 (14:31 +0200)]
Release v1.0.27.2
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
Krzysztof Hałasa [Fri, 14 Jun 2013 11:59:38 +0000 (13:59 +0200)]
pcm_direct: fix SEGFAULT when getgrnam_r() returns 0 and pgrp is NULL
Signed-off-by: Krzysztof Halasa <khalasa@piap.pl>
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
David Henningsson [Mon, 10 Jun 2013 14:42:47 +0000 (16:42 +0200)]
pcm_hw: Fix buffer overflow in chmap
We can't calculate memory storage in bytes, when we're supposed
to store ints in it!
Signed-off-by: David Henningsson <david.henningsson@canonical.com>
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
David Henningsson [Wed, 5 Jun 2013 14:52:10 +0000 (16:52 +0200)]
chmap: Always succeed setting the map to what it already is
If we try to set the channel map to what it already is, this should
always succeed. E g, speaker-test can do this sometimes.
Signed-off-by: David Henningsson <david.henningsson@canonical.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Jaroslav Kysela [Tue, 4 Jun 2013 13:58:34 +0000 (15:58 +0200)]
pcm_direct: fix the memory leak when parsing the slave definitions
Reported-by: <bolsunov@telum.ru>
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
David Henningsson [Thu, 30 May 2013 10:26:34 +0000 (12:26 +0200)]
pcm_plugin: Fix return value of snd_pcm_rewind
In case the rewind did not rewind as much as expected, e g due to
time delay between the latest avail update and the rewind, we must
properly account for that in the plugin layer.
Otherwise, the plugin's appl ptr and the hw's appl ptr become
unsynchronised, which is very bad, especially in mmap_shadow plugins,
e g, this could cause the overlapping memcpy in the softvol plugin
as seen here:
https://bugs.freedesktop.org/show_bug.cgi?id=64299
Signed-off-by: David Henningsson <david.henningsson@canonical.com>
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
David Henningsson [Thu, 30 May 2013 10:26:33 +0000 (12:26 +0200)]
pcm_hw: Remove unused fields in struct
These fields are not used, and their name similarity to other
fields are quite confusing when trying to debug alsa-lib.
Signed-off-by: David Henningsson <david.henningsson@canonical.com>
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
Takashi Iwai [Fri, 24 May 2013 15:21:15 +0000 (17:21 +0200)]
Allow specifying the max number of cards
Add --with-max-cards option to specify the max number of cards in
configure script, when the support for more than 32 cards is
required.
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Juho Hämäläinen [Fri, 24 May 2013 11:01:25 +0000 (14:01 +0300)]
ucm: Fix segfault when device argument is missing from _sw{dev, mod}
Signed-off-by: Juho Hämäläinen <juho.hamalainen@tieto.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Jordi Mallach [Fri, 17 May 2013 16:25:51 +0000 (18:25 +0200)]
pcm: Fix typo in documentation: PREPARE → PREPARED.
Signed-off-by: Jordi Mallach <jordi@debian.org>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Jaroslav Kysela [Tue, 21 May 2013 08:48:28 +0000 (10:48 +0200)]
Release v1.0.27.1
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
Olivier Langlois [Thu, 16 May 2013 08:32:58 +0000 (04:32 -0400)]
Remove an obsolete macro in configure.in
Replaced AM_CONFIG_HEADER with AC_CONFIG_HEADERS
lano1106@whippet2 ~/dev/alsa-lib $ ./gitcompile
aclocal: warning: autoconf input should be named 'configure.ac', not 'configure.in'
configure.in:56: error: 'AM_CONFIG_HEADER': this macro is obsolete.
You should use the 'AC_CONFIG_HEADERS' macro instead.
/usr/share/aclocal-1.13/obsolete-err.m4:12: AM_CONFIG_HEADER is expanded from...
configure.in:56: the top level
autom4te: /usr/bin/m4 failed with exit status: 1
aclocal: error: echo failed with exit status: 1
Signed-off-by: Olivier Langlois <olivier@trillion01.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Jordi Mallach [Wed, 15 May 2013 17:06:00 +0000 (19:06 +0200)]
Fix several spelling errors for “writable” and derivatives.
Signed-off-by: Jordi Mallach <jordi@debian.org>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Steve Langasek [Wed, 15 May 2013 17:05:59 +0000 (19:05 +0200)]
Compile in the ALSA search path instead of relying on ld.so.conf.
The Ubuntu package currently uses ld.so.conf.d fragments to add
/usr/lib/alsa-lib and /usr/lib{32,64}/alsa-lib to the dlopen search path.
These don't *belong* on the global search path, and it becomes much more
problematic to put them there with the advent of multiarch because each
architecture then needs its own distinct config file to add the separate
path... which is then also put in the global library namespace. Instead,
let ALSA make use of the already defined ALSA_PLUGIN_DIR to look up
plugins.
Signed-off-by: Jordi Mallach <jordi@debian.org>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Jordi Mallach [Wed, 15 May 2013 17:05:58 +0000 (19:05 +0200)]
Add AM_MAINTAINER_MODE.
Add AM_MAINTAINER_MODE([enable]) to configure.in.
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Dylan Reid [Tue, 14 May 2013 16:47:58 +0000 (09:47 -0700)]
conf/ucm: DAISY-I2S: Set default filter mode for HiFi.
Default to music mode filter for the HiFi use case on the Samsung ARM
Chromebook. This mode is better at 44.1k and 48k audio than the
"Voice" setting.
Signed-off-by: Dylan Reid <dgreid@chromium.org>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Takashi Iwai [Tue, 14 May 2013 16:11:01 +0000 (18:11 +0200)]
conf/ucm: Set up for installation
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Marcin Juszkiewicz [Fri, 10 May 2013 12:51:10 +0000 (14:51 +0200)]
conf/ucm: tegraalc5632: add UCM config from Ubuntu
Signed-off-by: Marcin Juszkiewicz <marcin@juszkiewicz.com.pl>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Marcin Juszkiewicz [Fri, 10 May 2013 12:51:09 +0000 (14:51 +0200)]
conf/ucm: SDP4430: add UCM config from Ubuntu
Signed-off-by: Marcin Juszkiewicz <marcin@juszkiewicz.com.pl>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Marcin Juszkiewicz [Fri, 10 May 2013 12:51:08 +0000 (14:51 +0200)]
conf/ucm: PandaBoardES: add UCM config from Ubuntu
Signed-off-by: Marcin Juszkiewicz <marcin@juszkiewicz.com.pl>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Marcin Juszkiewicz [Fri, 10 May 2013 12:51:07 +0000 (14:51 +0200)]
conf/ucm: PandaBoard: add UCM config from Ubuntu
Signed-off-by: Marcin Juszkiewicz <marcin@juszkiewicz.com.pl>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Marcin Juszkiewicz [Fri, 10 May 2013 12:51:06 +0000 (14:51 +0200)]
conf/ucm: DAISY-I2S: add Samsung ARM Chromebook UCM config from ChromeOS
Signed-off-by: Marcin Juszkiewicz <marcin@juszkiewicz.com.pl>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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.
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>
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>
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>
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>
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>
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>
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>
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>
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>
Jaroslav Kysela [Tue, 30 Oct 2012 12:07:48 +0000 (13:07 +0100)]
Reduce compilation warnings
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
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>
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>
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>
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>
Takashi Iwai [Sat, 22 Sep 2012 07:38:28 +0000 (09:38 +0200)]
Update .gitignore
Signed-off-by: Takashi Iwai <tiwai@suse.de>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>