Some io plug-ins might want to adjust the reported delay value and not strictly follow the current buffer usage (that's why we have two calls after all). Allow them to specify a delay() callback and use the previous behaviour if they don't. Signed-off-by: Pierre Ossman <ossman@xxxxxxxxx>
? ioplug-delay.patch Index: include/pcm_ioplug.h =================================================================== RCS file: /cvsroot/alsa/alsa-lib/include/pcm_ioplug.h,v retrieving revision 1.5 diff -u -r1.5 pcm_ioplug.h --- include/pcm_ioplug.h 24 May 2005 09:42:01 -0000 1.5 +++ include/pcm_ioplug.h 25 May 2006 19:05:23 -0000 @@ -130,6 +130,10 @@ */ snd_pcm_sframes_t (*pointer)(snd_pcm_ioplug_t *io); /** + * get the delay for the running PCM; optional + */ + int (*delay)(snd_pcm_ioplug_t *io, snd_pcm_sframes_t *delayp); + /** * transfer the data; optional */ snd_pcm_sframes_t (*transfer)(snd_pcm_ioplug_t *io, Index: src/pcm/pcm_ioplug.c =================================================================== RCS file: /cvsroot/alsa/alsa-lib/src/pcm/pcm_ioplug.c,v retrieving revision 1.10 diff -u -r1.10 pcm_ioplug.c --- src/pcm/pcm_ioplug.c 28 Jun 2005 10:24:45 -0000 1.10 +++ src/pcm/pcm_ioplug.c 25 May 2006 19:05:24 -0000 @@ -106,8 +106,14 @@ static int snd_pcm_ioplug_delay(snd_pcm_t *pcm, snd_pcm_sframes_t *delayp) { - snd_pcm_ioplug_hw_ptr_update(pcm); - *delayp = snd_pcm_mmap_hw_avail(pcm); + ioplug_priv_t *io = pcm->private_data; + + if (io->data->callback->delay) + return io->data->callback->delay(io->data, delayp); + else { + snd_pcm_ioplug_hw_ptr_update(pcm); + *delayp = snd_pcm_mmap_hw_avail(pcm); + } return 0; }
Attachment:
signature.asc
Description: OpenPGP digital signature
_______________________________________________ Alsa-devel mailing list Alsa-devel@xxxxxxxxxxxxxxxxxxxxx https://lists.sourceforge.net/lists/listinfo/alsa-devel