mirror of
https://github.com/alsa-project/alsa-lib.git
synced 2025-10-31 22:25:35 -04:00
Removed snd_pcm_hwptr().
Added snd_pcm_hwdiff() and snd_pcm_forward(). Returned the behaviour for snd_pcm_mmap_begin().
This commit is contained in:
parent
fbd99fdec0
commit
2dab1dfbc3
17 changed files with 327 additions and 246 deletions
|
|
@ -345,9 +345,6 @@ static int snd_pcm_hw_sw_params(snd_pcm_t *pcm, snd_pcm_sw_params_t * params)
|
|||
hw->mmap_control->avail_min = params->avail_min;
|
||||
return 0;
|
||||
}
|
||||
/* FIXME */
|
||||
if (hw->mmap_shm && params->stop_threshold >= params->boundary)
|
||||
return -EINVAL;
|
||||
if (ioctl(fd, SNDRV_PCM_IOCTL_SW_PARAMS, params) < 0) {
|
||||
SYSERR("SNDRV_PCM_IOCTL_SW_PARAMS failed");
|
||||
return -errno;
|
||||
|
|
@ -431,23 +428,6 @@ static int snd_pcm_hw_hwsync(snd_pcm_t *pcm)
|
|||
return 0;
|
||||
}
|
||||
|
||||
static int snd_pcm_hw_hwptr(snd_pcm_t *pcm, snd_pcm_uframes_t *hwptr)
|
||||
{
|
||||
switch (snd_pcm_state(pcm)) {
|
||||
case SND_PCM_STATE_RUNNING:
|
||||
case SND_PCM_STATE_DRAINING:
|
||||
case SND_PCM_STATE_PREPARED:
|
||||
case SND_PCM_STATE_PAUSED:
|
||||
case SND_PCM_STATE_SUSPENDED:
|
||||
*hwptr = *pcm->hw.ptr;
|
||||
return 0;
|
||||
case SND_PCM_STATE_XRUN:
|
||||
return -EPIPE;
|
||||
default:
|
||||
return -EBADFD;
|
||||
}
|
||||
}
|
||||
|
||||
static int snd_pcm_hw_prepare(snd_pcm_t *pcm)
|
||||
{
|
||||
snd_pcm_hw_t *hw = pcm->private_data;
|
||||
|
|
@ -534,6 +514,31 @@ static snd_pcm_sframes_t snd_pcm_hw_rewind(snd_pcm_t *pcm, snd_pcm_uframes_t fra
|
|||
return frames;
|
||||
}
|
||||
|
||||
static snd_pcm_sframes_t snd_pcm_hw_forward(snd_pcm_t *pcm, snd_pcm_uframes_t frames)
|
||||
{
|
||||
snd_pcm_hw_t *hw = pcm->private_data;
|
||||
snd_pcm_sframes_t avail;
|
||||
|
||||
switch (FAST_PCM_STATE(hw)) {
|
||||
case SNDRV_PCM_STATE_RUNNING:
|
||||
case SNDRV_PCM_STATE_DRAINING:
|
||||
case SNDRV_PCM_STATE_PAUSED:
|
||||
case SNDRV_PCM_STATE_PREPARED:
|
||||
break;
|
||||
case SNDRV_PCM_STATE_XRUN:
|
||||
return -EPIPE;
|
||||
default:
|
||||
return -EBADFD;
|
||||
}
|
||||
avail = snd_pcm_mmap_avail(pcm);
|
||||
if (avail < 0)
|
||||
return 0;
|
||||
if (frames > avail)
|
||||
frames = avail;
|
||||
snd_pcm_mmap_appl_forward(pcm, frames);
|
||||
return frames;
|
||||
}
|
||||
|
||||
static int snd_pcm_hw_resume(snd_pcm_t *pcm)
|
||||
{
|
||||
snd_pcm_hw_t *hw = pcm->private_data;
|
||||
|
|
@ -718,12 +723,6 @@ static snd_pcm_sframes_t snd_pcm_hw_mmap_commit(snd_pcm_t *pcm,
|
|||
if (hw->mmap_shm) {
|
||||
if (pcm->stream == SND_PCM_STREAM_PLAYBACK) {
|
||||
snd_pcm_sframes_t result = 0, res;
|
||||
snd_pcm_uframes_t last_offset;
|
||||
|
||||
/* FIXME */
|
||||
last_offset = *pcm->appl.ptr - offset;
|
||||
if (last_offset != offset)
|
||||
return -EINVAL;
|
||||
|
||||
do {
|
||||
res = snd_pcm_write_mmap(pcm, size);
|
||||
|
|
@ -819,7 +818,6 @@ static snd_pcm_fast_ops_t snd_pcm_hw_fast_ops = {
|
|||
status: snd_pcm_hw_status,
|
||||
state: snd_pcm_hw_state,
|
||||
hwsync: snd_pcm_hw_hwsync,
|
||||
hwptr: snd_pcm_hw_hwptr,
|
||||
delay: snd_pcm_hw_delay,
|
||||
prepare: snd_pcm_hw_prepare,
|
||||
reset: snd_pcm_hw_reset,
|
||||
|
|
@ -828,6 +826,7 @@ static snd_pcm_fast_ops_t snd_pcm_hw_fast_ops = {
|
|||
drain: snd_pcm_hw_drain,
|
||||
pause: snd_pcm_hw_pause,
|
||||
rewind: snd_pcm_hw_rewind,
|
||||
forward: snd_pcm_hw_forward,
|
||||
resume: snd_pcm_hw_resume,
|
||||
writei: snd_pcm_hw_writei,
|
||||
writen: snd_pcm_hw_writen,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue