Commit graph

180 commits

Author SHA1 Message Date
Takashi Iwai
3c4a22ea49 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>
2012-09-11 11:34:50 +02:00
Jaroslav Kysela
a55e1ded99 pcm_hw - show errno codes
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2010-03-10 09:40:02 +01:00
Jaroslav Kysela
f171347508 Fix snd_pcm_sw_params_set_period_event() implementation
Fix the PCM timer open subdevice number in the pcm_hw plugin.

Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2010-02-23 10:58:00 +01:00
Jaroslav Kysela
a256766c10 pcm: Close event timer in pcm_hw plugin
Dan McCombs discovered that snd_pcm_close() invocations are not leading
to associated timers being closed, which results in successively more
timers being created but not freed.

Original patch from Daniel T Chen <crimsun@ubuntu.com>.

BugLink: https://bugs.launchpad.net/bugs/451893

Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2009-12-21 09:09:42 +01:00
Rémi Denis-Courmont
57ce918928 Remove old commented-out FD_CLOEXEC code
Signed-off-by: Rémi Denis-Courmont <remi@remlab.net>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2009-11-08 09:23:22 +01:00
Kai Vehmanen
ecf4b5af86 pcm_hw: Always use delay ioctl in snd_pcm_delay()
As the result of snd_pcm_delay() is affected not only by hw_ptr
and appl_ptr, but also by 'runtime->delay' property,
either SNDRV_PCM_IOCTL_DELAY or SNDRV_PCM_IOCTL_STATUS ioctl
must be used to get the correct result.

Previously 'runtime->delay' was ignored in case 'hw->sync_ptr'
was used.

Signed-off-by: Kai Vehmanen <kvehmanen@eca.cx>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2009-09-11 09:18:36 +02:00
Jaroslav Kysela
a987a692bf pcm_hw plugin: show appl_ptr and hw_ptr in dump() callback
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2009-04-09 10:49:57 +02:00
Jaroslav Kysela
fb12b89453 pcm_hw plugin: preserve monotonic flag also after snd_pcm_hw_params() call
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2009-04-08 09:29:35 +02:00
Diego E. 'Flameeyes' Pettenò
8b14625cc3 Make all the PCM plugins ops structure constant.
This ensures they are emitted in .data.rel.ro rather than .data.rel,
which should make a nice difference when using prelink.

Signed-off-by: Diego E. 'Flameeyes' Pettenò <flameeyes@gmail.com>
2008-11-21 20:38:49 +01:00
Lennart Poettering
73d20069e0 alsa-lib: Make sure SND_PCM_NO_xxx flags don't get lost when nonblocking mode is enabled
The plug PCM copies the 'mode' field from the slave PCM. If blocking mode is
enabled for the plug PCM the mode is subsequently overwritten with the original
requested 'mode'. If non-blocking mode is requested this does not happen.

Because the hw PCM synthesizes the 'mode' from the actual file descriptor flags
no SND_PCM_NO_xxx will ever be set for it. This has the effect that the 'mode'
of the plug PCM will also not include those flags anymore -- unless they are
overwritten as mentioned above. This basically means SND_PCM_NO_xxx is ignored
for plug:hw:4711 style device strings opened in non-blocking mode.

You can easily test this with "aplay --channels 7 --disable-channels -f S16_LE
-r 44100 -D plug:hw:0" on a device that cannot do 7 channels. Normally this
call should fail, however if you add "-N" to the command line this call will
succeed.

This patch simply copies the SND_PCM_NO_xxx flags back into the 'mode' field in
case we don't overwrite it with the original anyway.

Probably closes bug 3571 for good.

From: Lennart Poettering <mznyfn@0pointer.de>
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2008-08-31 15:45:18 +02:00
Takashi Iwai
b6af5e1822 Fix compile warnings in pcm_hw.c
Two trivial compile warning fixes:

- Add a missing return to snd_pcm_hw_clear_timer_queue()
- params->info is no long but int

The second one might have hit already on 64bit machine, but alas,
no one didn't notice it.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
2008-06-06 16:59:47 +02:00
Jaroslav Kysela
8aaccc9484 Implemented snd_pcm_sw_params_(set|get)_period_event for interrupt wakeup like behaviour
Actually, PCM timer is used as source for poll(). It might be optimized
in the kernel code later.
2008-05-09 16:02:02 +02:00
Jaroslav Kysela
c88672d86f implemented snd_pcm_rewindable() and snd_pcm_forwardable(), removed can_rewind and can_forward 2008-04-21 12:46:50 +02:00
Jaroslav Kysela
82af1df465 added snd_pcm_hw_params_is_monotonic/can_forward/can_rewind functions 2008-04-11 14:11:04 +02:00
Jaroslav Kysela
d555b15914 fix compilation in pcm/pcm_hw.c - monotonic clock 2008-04-10 09:08:08 +02:00
Takashi Iwai
91726ddf83 Fix the build with old glibc
The old systems don't support CLOCK_MONOTONIC although clock_gettime() API
itself exists.  This causes compile errors.
2008-03-07 14:35:25 +01:00
Clemens Ladisch
0e8a259914 check availability of CLOCK_MONOTONIC
Use monotonic timestamps only after checking that CLOCK_MONOTONIC is
actually supported by the C library.
2008-01-14 08:51:45 +01:00
Clemens Ladisch
07e1341548 pcm hw plugin: use TSTAMP only with old drivers
There is no need to call the TSTAMP ioctl with newer driver versions.
2008-01-14 08:50:46 +01:00
Clemens Ladisch
6f751a923d pcm hw plugin: fix TTSTAMP version check
Fix the version check that determines the availability of the TTSTAMP
ioctl.
2008-01-14 08:50:18 +01:00
Jaroslav Kysela
2c1318803f Impemented snd_pcm_htimestamp() function. 2008-01-09 13:50:45 +01:00
Jaroslav Kysela
309a274454 Add support for monotonic timestamps 2008-01-09 11:13:34 +01:00
Takashi Iwai
679cea4125 Remove sleep_min and tick
The sleep_min and tick are removed features from the kernel.
This patch cleans the corresponding part in alsa-lib.
2008-01-08 18:36:18 +01:00
Takashi Iwai
cf15e49d84 Remove PCM xfer_align
The PCM xfer_align is a removed feature from the kernel.
This patch cleans up the corresponding part in alsa-lib.
2008-01-08 18:35:29 +01:00
Jaroslav Kysela
7562320e3b Added SNDRV_PCM_IOCTL_TTSTAMP and updated PCM API version to 2.0.9 2007-12-17 09:04:42 +01:00
Jaroslav Kysela
d25e281230 Changed Jaroslav Kysela's e-mail from perex@suse.cz to perex@perex.cz 2007-10-15 10:24:55 +02:00
Takashi Iwai
c7e1676dcd Don't set PCM pointer at error in snd_pcm_hw_open()
snd_pcm_hw_open() may set a non-NULL to pcmp even if it returns an error.
Some codes like dmix expects it's NULL, and cause the double free().
2007-08-06 16:09:27 +02:00
Clemens Ladisch
fca29a6172 remove unused variables
Remove some unused variables that the compiler warned about.
2007-07-13 12:44:43 +02:00
Takashi Iwai
4cdb17c601 Split mmap-emulation code from hw layer
Move out mmap-emulation code from hw layer to its own plugin.
This cleans up the mess in pcm_hw.c.
2007-07-11 17:44:09 +02:00
Takashi Iwai
845d9222b2 fix mmap emulation bug of recording doesn't work
From: Roy Huang <royhuang9@gmail.com>

Record doesn't work if enabling mmap emulation and rate conversion
needed, this patch fix this bug.
2007-07-05 12:15:16 +02:00
Takashi Iwai
8048321c76 More better fix for linked start/stop
Instead of link_fd, more generic callback link_slaves is introduced.
This is called for linking the slave streams as the source to the
given master stream.
2007-03-13 02:52:33 +01:00
Takashi Iwai
eafb7ae5d8 Use O_APPEND mode with dmix & co plugins
Use O_APPEND mode (only if available) with dmix, dsnoop and dshare
plugins.  Using this mode, the plugin requires no resource server
any more.
2006-04-28 15:55:32 +02:00
Takashi Iwai
a2ee8e20e8 Fix 32/64bit problem with multi plugin
Fix the problems of multi plugin with 32bit apps on 64bit kernel.
The forward/backward of hw plugin are fixed, too.
2006-04-06 18:55:59 +02:00
Takashi Iwai
18a6132a66 Fix PCM without control/status mmap
Fix the update of appl_ptr via mmap_commit when control/status structs
are not mmapped (e.g. 32bit compatible mode on 64bit kernel).
2006-03-29 09:32:18 +00:00
Takashi Iwai
38a3aa096c Fix restoration of PCM open mode
The original PCM open mode was lost by the change of default non-blocking
open.  The patch fix the restoration of the original open mode.
2006-03-20 11:22:23 +00:00
Takashi Iwai
90112fff1e Add restriction parameters to pcm hw layer
Add restriction parameters to pcm hw layer.

The PCM hw has optional parameters, format, rate and channels, to restrict
the configuration.  This is useful for definition of surround slave PCMs,
for example.
2006-03-17 18:09:07 +00:00
Clemens Ladisch
09f598e57c allow changing of device directory path
Add configuration options to change the default device path from the
default /dev/snd.  This is useful for embedded systems that do not want
subdirectories in /dev.
2006-02-27 10:03:19 +00:00
Clemens Ladisch
4433248bf3 remove superfluous free() checks
free() correctly handles NULL pointers, so we can omit explicit checks
for that condition.
2006-02-27 09:58:32 +00:00
Clemens Ladisch
45850439b3 Do not abort in snd_xxx_close() functions
Remove several memory leaks by not aborting prematurely from a
snd_xxx_close() function when some operation fails.
This can happen when a USB device was unplugged.
2006-02-27 09:54:57 +00:00
Takashi Iwai
67868a886f Fix check of nonblock option
Fix the check of nonblock option for all hw layer.
Instead of passing in asound.conf, check the option in snd_pcm_hw_open()
so that the nonblock option is referred in the case of "type hw ..." style
definition, too.
2006-02-17 20:49:21 +00:00
Takashi Iwai
3d0e3e2517 Add "nonblock" option for hw layer
Added a new "nonblock" option for hw layer.  This controls the non-blocking
"open" mode as default.

This option is set to TRUE as the default configuration.  If the old behavior
is preferred, set "defaults.pcm.nonblock" to 0 in /etc/asound.conf.
2006-01-13 11:52:01 +00:00
Jaroslav Kysela
bdfbbed5ca pcm dump() routines update: use spaces to indent texts 2005-12-11 08:24:13 +00:00
Takashi Iwai
087184b0f9 Fix doxygen documents
Fix the warnings of doxygen parsing.
Add some missing documentation.
2005-05-24 14:14:28 +00:00
Takashi Iwai
dd37bb20ee Move poll_* callbacks to fast_ops
Moved poll_* callbacks to fast_ops.
These callbacks may be called frequently indeed.
2005-05-23 09:03:16 +00:00
Takashi Iwai
a6d3b9e4e0 Remove poll_ask callback
Removed poll_ask callbacks.
poll_ask function is merged to poll_descriptors callbacks.
2005-05-18 10:50:09 +00:00
Takashi Iwai
10557ca6b9 Fix playback start with sync_ptr mode
Fix by Istvan Varadi <ivaradi@gmail.com>

- start the playback with snd_pcm_hw_start failed with -EPIPE, because
 some pointers were not updated. I attached a patch for alsa-lib 1.0.8,
 in which sync_ptr is called before SNDRV_PCM_IOCTL_START. It seems to
 solve the problem, though I don't know alsa-lib enough to be sure that
 this is the right solution...
2005-05-13 14:14:10 +00:00
Takashi Iwai
809e31561a Initialize structs for ioctls
Initialize the argument structs before calling ioctls to make
valgrind happy.
2005-02-24 20:57:56 +00:00
Takashi Iwai
f9b9015245 Fix resmgr support
Call normal open() before trying with res_open_device().
snd_open_device() is defined to do this procedure.
2005-02-11 16:35:24 +00:00
Takashi Iwai
77c925a71f Add resmgr support
Added the support for resmgr.  A new configure option --with-resmgr is added
to enable the resmgr support.
2005-01-26 10:50:28 +00:00
Jaroslav Kysela
a5831c7300 The stream linking problem for pcm_multi.c should be fixed now
- extended link_fd callback
- added snd_pcm_generic_link2()
- added _snd_pcm_link_descriptors()
2005-01-20 18:37:13 +00:00
Jaroslav Kysela
836987aa99 improved stream linking and plugin code cleanups
- added link/unlink/link_fd fast_ops callbacks
- moved code from snd_pcm_link to pcm_hw.c
- moved "empty" routines pointing to slave to pcm_generic.c
- introduced snd_pcm_generic_t
2005-01-20 15:07:51 +00:00