mirror of
https://github.com/alsa-project/alsa-lib.git
synced 2025-11-06 13:29:59 -05:00
Impemented snd_pcm_htimestamp() function.
This commit is contained in:
parent
309a274454
commit
2c1318803f
19 changed files with 182 additions and 14 deletions
|
|
@ -226,10 +226,7 @@ static int snd_pcm_dshare_status(snd_pcm_t *pcm, snd_pcm_status_t * status)
|
|||
memset(status, 0, sizeof(*status));
|
||||
status->state = snd_pcm_state(dshare->spcm);
|
||||
status->trigger_tstamp = dshare->trigger_tstamp;
|
||||
if (pcm->tstamp_mode == SND_PCM_TSTAMP_MMAP)
|
||||
status->tstamp = snd_pcm_hw_fast_tstamp(dshare->spcm);
|
||||
else
|
||||
gettimestamp(&status->tstamp, pcm->monotonic);
|
||||
gettimestamp(&status->tstamp, pcm->monotonic);
|
||||
status->avail = snd_pcm_mmap_playback_avail(pcm);
|
||||
status->avail_max = status->avail > dshare->avail_max ? status->avail : dshare->avail_max;
|
||||
dshare->avail_max = 0;
|
||||
|
|
@ -517,6 +514,27 @@ static snd_pcm_sframes_t snd_pcm_dshare_avail_update(snd_pcm_t *pcm)
|
|||
return snd_pcm_mmap_playback_avail(pcm);
|
||||
}
|
||||
|
||||
static int snd_pcm_dshare_htimestamp(snd_pcm_t *pcm,
|
||||
snd_pcm_uframes_t *avail,
|
||||
snd_htimestamp_t *tstamp)
|
||||
{
|
||||
snd_pcm_direct_t *dshare = pcm->private_data;
|
||||
snd_pcm_uframes_t avail1;
|
||||
int ok = 0;
|
||||
|
||||
while (1) {
|
||||
if (dshare->state == SND_PCM_STATE_RUNNING ||
|
||||
dshare->state == SND_PCM_STATE_DRAINING)
|
||||
snd_pcm_dshare_sync_ptr(pcm);
|
||||
avail1 = snd_pcm_mmap_playback_avail(pcm);
|
||||
if (ok && *avail == avail1)
|
||||
break;
|
||||
*avail = avail1;
|
||||
*tstamp = snd_pcm_hw_fast_tstamp(pcm);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void snd_pcm_dshare_dump(snd_pcm_t *pcm, snd_output_t *out)
|
||||
{
|
||||
snd_pcm_direct_t *dshare = pcm->private_data;
|
||||
|
|
@ -568,6 +586,7 @@ static snd_pcm_fast_ops_t snd_pcm_dshare_fast_ops = {
|
|||
.readn = snd_pcm_dshare_readn,
|
||||
.avail_update = snd_pcm_dshare_avail_update,
|
||||
.mmap_commit = snd_pcm_dshare_mmap_commit,
|
||||
.htimestamp = snd_pcm_dshare_htimestamp,
|
||||
.poll_descriptors = NULL,
|
||||
.poll_descriptors_count = NULL,
|
||||
.poll_revents = snd_pcm_direct_poll_revents,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue