diff options
author | Takashi Iwai <tiwai@suse.de> | 2008-09-30 15:23:57 +0200 |
---|---|---|
committer | Takashi Iwai <tiwai@suse.de> | 2008-09-30 15:23:57 +0200 |
commit | 02ba6a96d1268fec8a3cd7415df23c2b1cdb90e0 (patch) | |
tree | 88db1b598b401a94c677dbdfcac0631297d5236a | |
parent | 4de71dfea0d5d683e0311fb488e00485934c6821 (diff) | |
download | salsa-lib-02ba6a96d1268fec8a3cd7415df23c2b1cdb90e0.tar.gz |
Add new PCM functions for 1.0.18
Added new functions snd_pcm_avail() and snd_pcm_avail_delay() to be
compatible with alsa-lib 1.0.18.
Also, mark snd_pcm_hwsync() as deprecated.
-rw-r--r-- | src/pcm.c | 17 | ||||
-rw-r--r-- | src/pcm.h | 2 | ||||
-rw-r--r-- | src/pcm_macros.h | 20 |
3 files changed, 38 insertions, 1 deletions
@@ -961,6 +961,23 @@ snd_pcm_sframes_t snd_pcm_avail_update(snd_pcm_t *pcm) return avail; } +int snd_pcm_avail_delay(snd_pcm_t *pcm, + snd_pcm_sframes_t *availp, + snd_pcm_sframes_t *delayp) +{ + int err; + snd_pcm_sframes_t val; + + err = snd_pcm_delay(pcm, delayp); + if (err < 0) + return err; + val = snd_pcm_avail_update(pcm); + if (val < 0) + return (int)val; + *availp = val; + return 0; +} + int snd_pcm_mmap_begin(snd_pcm_t *pcm, const snd_pcm_channel_area_t **areas, snd_pcm_uframes_t *offset, @@ -38,6 +38,8 @@ int snd_pcm_hw_params_get_min_align(const snd_pcm_hw_params_t *params, int snd_pcm_sw_params(snd_pcm_t *pcm, snd_pcm_sw_params_t *params); snd_pcm_sframes_t snd_pcm_avail_update(snd_pcm_t *pcm); +int snd_pcm_avail_delay(snd_pcm_t *pcm, snd_pcm_sframes_t *availp, + snd_pcm_sframes_t *delayp); snd_pcm_sframes_t snd_pcm_writei(snd_pcm_t *pcm, const void *buffer, snd_pcm_uframes_t size); snd_pcm_sframes_t snd_pcm_readi(snd_pcm_t *pcm, void *buffer, diff --git a/src/pcm_macros.h b/src/pcm_macros.h index 0e12b71..4f5e4a2 100644 --- a/src/pcm_macros.h +++ b/src/pcm_macros.h @@ -163,8 +163,9 @@ snd_pcm_state_t snd_pcm_state(snd_pcm_t *pcm) return (snd_pcm_state_t) pcm->mmap_status->state; } +/* for internal use only */ static inline -int snd_pcm_hwsync(snd_pcm_t *pcm) +int _snd_pcm_hwsync(snd_pcm_t *pcm) { if (pcm->sync_ptr) return _snd_pcm_sync_ptr(pcm, SNDRV_PCM_SYNC_PTR_HWSYNC); @@ -173,6 +174,23 @@ int snd_pcm_hwsync(snd_pcm_t *pcm) return 0; } +/* exported: snd_pcm_hwsync() is now deprecated */ +static inline +__attribute__ ((deprecated)) +int snd_pcm_hwsync(snd_pcm_t *pcm) +{ + return _snd_pcm_hwsync(pcm); +} + +static inline +snd_pcm_sframes_t snd_pcm_avail(snd_pcm_t *pcm) +{ + int err = _snd_pcm_hwsync(pcm); + if (err < 0) + return err; + return snd_pcm_avail_update(pcm); +} + static inline int snd_pcm_delay(snd_pcm_t *pcm, snd_pcm_sframes_t *delayp) { |