mirror of
https://github.com/alsa-project/alsa-lib.git
synced 2025-10-31 22:25:35 -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
|
|
@ -382,10 +382,7 @@ static int snd_pcm_dmix_status(snd_pcm_t *pcm, snd_pcm_status_t * status)
|
|||
memset(status, 0, sizeof(*status));
|
||||
status->state = snd_pcm_dmix_state(pcm);
|
||||
status->trigger_tstamp = dmix->trigger_tstamp;
|
||||
if (pcm->tstamp_mode == SND_PCM_TSTAMP_MMAP)
|
||||
status->tstamp = snd_pcm_hw_fast_tstamp(dmix->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 > dmix->avail_max ? status->avail : dmix->avail_max;
|
||||
dmix->avail_max = 0;
|
||||
|
|
@ -671,6 +668,27 @@ static snd_pcm_sframes_t snd_pcm_dmix_avail_update(snd_pcm_t *pcm)
|
|||
return snd_pcm_mmap_playback_avail(pcm);
|
||||
}
|
||||
|
||||
static int snd_pcm_dmix_htimestamp(snd_pcm_t *pcm,
|
||||
snd_pcm_uframes_t *avail,
|
||||
snd_htimestamp_t *tstamp)
|
||||
{
|
||||
snd_pcm_direct_t *dmix = pcm->private_data;
|
||||
snd_pcm_uframes_t avail1;
|
||||
int ok = 0;
|
||||
|
||||
while (1) {
|
||||
if (dmix->state == SND_PCM_STATE_RUNNING ||
|
||||
dmix->state == SND_PCM_STATE_DRAINING)
|
||||
snd_pcm_dmix_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 int snd_pcm_dmix_poll_revents(snd_pcm_t *pcm, struct pollfd *pfds, unsigned int nfds, unsigned short *revents)
|
||||
{
|
||||
snd_pcm_direct_t *dmix = pcm->private_data;
|
||||
|
|
@ -731,6 +749,7 @@ static snd_pcm_fast_ops_t snd_pcm_dmix_fast_ops = {
|
|||
.readn = snd_pcm_dmix_readn,
|
||||
.avail_update = snd_pcm_dmix_avail_update,
|
||||
.mmap_commit = snd_pcm_dmix_mmap_commit,
|
||||
.htimestamp = snd_pcm_dmix_htimestamp,
|
||||
.poll_descriptors = NULL,
|
||||
.poll_descriptors_count = NULL,
|
||||
.poll_revents = snd_pcm_dmix_poll_revents,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue