Tinyalsa: add pcm_delay()

ALSA supports reporting of pcm_delay, make that availble to the users of
tinyalsa too

Change-Id: Ic460f5c55137d263fdf7b142503d3bd52c4b7ebd
Signed-off-by: Hardik T Shah <hardik.t.shah@intel.com>
Signed-off-by: Apelete Seketeli <apeletex.seketeli@intel.com>
Signed-off-by: Vinod Koul <vinod.koul@intel.com>
This commit is contained in:
Hardik T Shah
2014-04-10 18:03:52 +05:30
committed by Vinod Koul
parent 84889d0fa6
commit 9ecb93fb6b
2 changed files with 12 additions and 0 deletions
+3
View File
@@ -205,6 +205,9 @@ int pcm_stop(struct pcm *pcm);
int pcm_wait(struct pcm *pcm, int timeout);
/* Get the pcm delay */
long pcm_get_delay(struct pcm *pcm);
/*
* MIXER API
*/
+9
View File
@@ -170,6 +170,7 @@ struct pcm {
struct snd_pcm_sync_ptr *sync_ptr;
void *mmap_buffer;
unsigned int noirq_frames_per_msec;
long pcm_delay;
};
unsigned int pcm_get_buffer_size(struct pcm *pcm)
@@ -1046,3 +1047,11 @@ int pcm_mmap_read(struct pcm *pcm, void *data, unsigned int count)
return pcm_mmap_transfer(pcm, data, count);
}
long pcm_get_delay(struct pcm *pcm)
{
if (ioctl(pcm->fd, SNDRV_PCM_IOCTL_DELAY, &pcm->pcm_delay) < 0)
return -1;
return pcm->pcm_delay;
}