Commit graph

18 commits

Author SHA1 Message Date
Andre Guedes
fd13267637 ioplug: Fix comment in struct snd_pcm_ioplug
This patch fixes the comment about 'pcm' field in 'struct
snd_pcm_ioplug' which wrongly refers to snd_pcm_extplug_create().

Signed-off-by: Andre Guedes <andre.guedes@intel.com>
Reviewed-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2018-10-02 17:56:51 +02:00
Timo Wischer
2972f2f966 pcm: ioplug: Provide avail helper function for plugins
This function can be called without calling snd_pcm_avail_update().

The call to snd_pcm_avail_update() can take some time.
Therefore some developers would not like to call it from a real-time
context (e.g. from JACK client context).

Signed-off-by: Timo Wischer <twischer@de.adit-jv.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2018-07-03 16:36:34 +02:00
Timo Wischer
df2452cc6a pcm: ioplug: Provide hw_avail helper function for plugins
This function can be called without calling snd_pcm_avail_update().

The call to snd_pcm_avail_update() can take some time.
Therefore some developers would not like to call it from a real-time
context (e.g. from JACK client context).

Signed-off-by: Timo Wischer <twischer@de.adit-jv.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2018-03-13 22:12:02 +01:00
Timo Wischer
543a9eac5d pcm: ioplug: Use boundary for wrap around
if requested by the IO plugin

Without this changes an IO plugin is not able to report
that buffer_size frames were read from the buffer.
When the buffer was full this is a valid action and
has not to be handled as an under run.

For example when the hw_ptr will be updated with
hw_ptr += buffer_size
and it is using the buffer_size as wrap around
hw_ptr %= buffer_size
would result in the same value as before the add operation.

Signed-off-by: Timo Wischer <twischer@de.adit-jv.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2018-02-24 11:41:22 +01:00
Jaroslav Kysela
5b9041bced Change FSF address (Franklin Street)
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2017-11-14 14:29:26 +01:00
Takashi Iwai
54931e5a54 pcm: Add thread-safety to PCM API
Traditionally, many of ALSA library functions are supposed to be
thread-unsafe, and applications are required to take care of thread
safety by themselves.  However, people never be careful enough, and
almost all applications fail in this regard.

This patch is an attempt to harden the thread safety in exported PCM
functions in a simplistic way: just wrap some of exported functions
with the pthread mutex of each PCM object.  Not all API functions are
wrapped by the mutex since it doesn't make sense.  Instead, the
patchset covers only the functions that may be likely called
concurrently.  The supposedly thread-safe API functions are marked in
the document.

For achieving the feature, two new fields are added snd_pcm_t when the
option is enabled: thread_safe and lock.  The former indicates that
the plugin is thread-safe that doesn't need this workaround and the
latter is the pthread mutex.  Currently only hw plugin have
thread_safe=1.  So, the most of real-time sensitive apps won't be
influenced by this patchset.

Although the patch covers most of PCM ops, a few snd_pcm_fast_ops are
left without the extra mutex locking: namely, the ones that may have
blocking behavior, i.e. resume, drain, readi, writei, readn and
writen.  These are supposed to handle own locking in the callbacks.

Also, if anyone wants to disable this new thread-safe API feature, it
can be still turned off via --disable-thread-safety configure option.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
2016-07-11 15:25:30 +02:00
Jaroslav Kysela
b6eb0f9bfd 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>
2013-04-08 16:42:24 +02:00
Takashi Iwai
9c1a0ce72d 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>
2012-09-13 08:24:58 +02:00
Takashi Iwai
662f79d4ec 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>
2012-09-11 11:34:50 +02:00
Clemens Ladisch
5332d74a67 fix doc errors
Fix various errors in the documentation that make doxygen complain.

Signed-off-by: Clemens Ladisch <clemens@ladisch.de>
2009-08-04 09:17:20 +02:00
Jaroslav Kysela
309a274454 Add support for monotonic timestamps 2008-01-09 11:13:34 +01:00
Takashi Iwai
ce64f433a6 Add snd_pcm_ioplug_set_state() function
Added an exported function snd_pcm_ioplug_set_state() to change
the PCM state of ioplug from the plugin side (e.g. from another
thread).
2007-12-14 15:19:03 +01:00
Pierre Ossman
3fd9369990 Allow ioplugins to override snd_pcm_delay()
Some io plug-ins might want to adjust the reported delay value and not
strictly follow the current buffer usage (that's why we have two calls
after all).

Allow them to specify a delay() callback and use the previous behaviour
if they don't.

Signed-off-by: Pierre Ossman <ossman@cendio.se>
2006-05-26 17:08:18 +02:00
Takashi Iwai
7651690858 Fix documentation of external PCM plugin SDK
Fix documentation of external PCM plugin SDK.
2005-05-24 09:42:01 +00:00
Takashi Iwai
e61d385993 Add protocl version check
- Added protocl version check.  The caller of snd_pcm_{io|ext}plug_create()
  must fill version field with SND_PCM_{IO|EXT}PLUG_VERSION beforehand.

- Added poll_descriptors and poll_descriptors_count callbacks for ioplug.
2005-05-18 10:47:52 +00:00
Takashi Iwai
227441b2c8 More doxygen comments
Added more doxygen comments in pcm_extplug and pcm_ioplug codes.
2005-03-09 11:54:58 +00:00
Takashi Iwai
d8f7de1b16 Support dl-object cache
Added the support of dl-object caches for PCM plugins.
2005-02-14 15:09:09 +00:00
Takashi Iwai
94c4cdcd30 Add external PCM plugin SDK (draft version)
Added the external PCM plugin SDK (draft version).
This can be used to create external PCM plugins.
Example codes are found in alsa-plugins directory.
2005-02-08 20:57:51 +00:00