mirror of
https://github.com/alsa-project/alsa-lib.git
synced 2025-11-01 22:58:49 -04:00
Impemented snd_pcm_htimestamp() function.
This commit is contained in:
parent
309a274454
commit
2c1318803f
19 changed files with 182 additions and 14 deletions
|
|
@ -846,6 +846,26 @@ static snd_pcm_sframes_t snd_pcm_hw_avail_update(snd_pcm_t *pcm)
|
|||
return avail;
|
||||
}
|
||||
|
||||
static int snd_pcm_hw_htimestamp(snd_pcm_t *pcm, snd_pcm_uframes_t *avail,
|
||||
snd_htimestamp_t *tstamp)
|
||||
{
|
||||
snd_pcm_sframes_t avail1;
|
||||
int ok = 0;
|
||||
|
||||
/* unfortunately, loop is necessary to ensure valid timestamp */
|
||||
while (1) {
|
||||
avail1 = snd_pcm_hw_avail_update(pcm);
|
||||
if (avail1 < 0)
|
||||
return avail1;
|
||||
if (ok && (snd_pcm_uframes_t)avail1 == *avail)
|
||||
break;
|
||||
*avail = avail1;
|
||||
*tstamp = snd_pcm_hw_fast_tstamp(pcm);
|
||||
ok = 1;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void snd_pcm_hw_dump(snd_pcm_t *pcm, snd_output_t *out)
|
||||
{
|
||||
snd_pcm_hw_t *hw = pcm->private_data;
|
||||
|
|
@ -902,6 +922,7 @@ static snd_pcm_fast_ops_t snd_pcm_hw_fast_ops = {
|
|||
.readn = snd_pcm_hw_readn,
|
||||
.avail_update = snd_pcm_hw_avail_update,
|
||||
.mmap_commit = snd_pcm_hw_mmap_commit,
|
||||
.htimestamp = snd_pcm_hw_htimestamp,
|
||||
.poll_descriptors = NULL,
|
||||
.poll_descriptors_count = NULL,
|
||||
.poll_revents = NULL,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue