mirror of
https://github.com/alsa-project/alsa-lib.git
synced 2025-10-29 05:40:25 -04:00
Added snd_pcm_hwptr() and enhanced snd_pcm_mmap_begin() for no xrun mode.
This commit is contained in:
parent
a91efc0fe6
commit
fbd99fdec0
17 changed files with 231 additions and 13 deletions
|
|
@ -954,7 +954,6 @@ static int snd_pcm_dmix_delay(snd_pcm_t *pcm, snd_pcm_sframes_t *delayp)
|
|||
snd_pcm_dmix_t *dmix = pcm->private_data;
|
||||
int err;
|
||||
|
||||
assert(pcm && delayp);
|
||||
switch(dmix->state) {
|
||||
case SNDRV_PCM_STATE_DRAINING:
|
||||
case SNDRV_PCM_STATE_RUNNING:
|
||||
|
|
@ -990,6 +989,25 @@ static int snd_pcm_dmix_hwsync(snd_pcm_t *pcm)
|
|||
}
|
||||
}
|
||||
|
||||
static int snd_pcm_dmix_hwptr(snd_pcm_t *pcm, snd_pcm_uframes_t *hwptr)
|
||||
{
|
||||
snd_pcm_dmix_t *dmix = pcm->private_data;
|
||||
|
||||
switch(dmix->state) {
|
||||
case SNDRV_PCM_STATE_DRAINING:
|
||||
case SNDRV_PCM_STATE_RUNNING:
|
||||
case SNDRV_PCM_STATE_PREPARED:
|
||||
case SNDRV_PCM_STATE_PAUSED:
|
||||
case SNDRV_PCM_STATE_SUSPENDED:
|
||||
*hwptr = *pcm->hw.ptr;
|
||||
return 0;
|
||||
case SNDRV_PCM_STATE_XRUN:
|
||||
return -EPIPE;
|
||||
default:
|
||||
return -EBADFD;
|
||||
}
|
||||
}
|
||||
|
||||
static int snd_pcm_dmix_prepare(snd_pcm_t *pcm)
|
||||
{
|
||||
snd_pcm_dmix_t *dmix = pcm->private_data;
|
||||
|
|
@ -1206,6 +1224,7 @@ static snd_pcm_fast_ops_t snd_pcm_dmix_fast_ops = {
|
|||
status: snd_pcm_dmix_status,
|
||||
state: snd_pcm_dmix_state,
|
||||
hwsync: snd_pcm_dmix_hwsync,
|
||||
hwptr: snd_pcm_dmix_hwptr,
|
||||
delay: snd_pcm_dmix_delay,
|
||||
prepare: snd_pcm_dmix_prepare,
|
||||
reset: snd_pcm_dmix_reset,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue