Allow ioplugins to override snd_pcm_delay()
PATCH 1/1 Allow ioplugins to override snd_pcm_delay()
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.
? ioplug-delay.patch
Index: include/pcm_ioplug.h
===================================================================
RCS file: /cvsroot/alsa/alsa-lib/include/pcm_ioplug.h,v retrieving revision 1.5
pcm_ioplug.h +4 -0
@@ -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
pcm/pcm_ioplug.c +8 -2
@@ -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 ; }
_______________________________________________
Alsa-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/alsa-devel
At Fri, 26 May 2006 11:38:11 +0200,
Quoted 19 lines · Pierre Ossman
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 <[email protected]>? 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.5pcm_ioplug.h
pcm_ioplug.h line 139
Quoted 10 lines
pcm_ioplug.h +4
-0@@ -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,
The change is OK, but please remind that the API has been already public, so we need to keep the compatibility as much as possible. This addition will break the binary compatibility.
First, we need the increase of version number (SND_PCM_IOPLUG_VERSION) if we modify API. If the version of the object is older, either reject or allow it as compatible.
One way to keep it binary-compatible is to append the new method to the end of the callback table, and check the version before accessing the new method (and handle as NULL for older version).
Could you rewrite the patch in that manner?
Thanks,
Takashi
Quoted 9 lines · Takashi Iwai
The change is OK, but please remind that the API has been already public, so we need to keep the compatibility as much as possible. This addition will break the binary compatibility.
First, we need the increase of version number (
SND_PCM_IOPLUG_VERSION) if we modify API. If the version of the object is older, either reject or allow it as compatible.
Quoted 6 lines
One way to keep it binary-compatible is to append the new method to the end of the callback table, and check the version before accessing the new method (and handle as NULL for older version).
Could you rewrite the patch in that manner?
No problem. I'll have it fixed later this afternoon.
Signature · 3 lines
Rgds Pierre Ossman Telephone: +46-13-21 46 00 Cendio AB Web: http://www.cendio.com
_______________________________________________
Alsa-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/alsa-devel
Quoted 5 lines · Takashi Iwai
First, we need the increase of version number (
SND_PCM_IOPLUG_VERSION) if we modify API. If the version of the object is older, either reject or allow it as compatible.
The headers do not detail how versions are managed here. Which component of the version number should I increase?
Signature · 3 lines
Rgds Pierre Ossman Telephone: +46-13-21 46 00 Cendio AB Web: http://www.cendio.com
_______________________________________________
Alsa-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/alsa-devel
At Fri, 26 May 2006 14:35:20 +0200,
Quoted 10 lines · Pierre Ossman
Quoted 5 lines · Takashi Iwai
First, we need the increase of version number (
SND_PCM_IOPLUG_VERSION) if we modify API. If the version of the object is older, either reject or allow it as compatible.The headers do not detail how versions are managed here. Which component of the version number should I increase?
I think TINY should suffice in this case.
It's just a minor addition.
Takashi
Quoted 9 lines · Pierre Ossman
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 <[email protected]>
Can you give an example of a plugin that would want to adjust the delay value?
James
Quoted 5 lines · James Courtier-Dutton
Quoted 4 lines · Pierre Ossman
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).
Quoted 8 lines
Quoted 5 lines
Allow them to specify a
delay()callback and use the previous behaviour if they don't.Signed-off-by Pierre Ossman <[email protected]>Can you give an example of a plugin that would want to adjust the delay value?
The polypaudio backend, which is why I submitted this patch.
The recently released padsp (esddsp-equivalent) has much better latency reporting than the ALSA to polypaudio plug-in. And we just can't have OSS applications outperforming ALSA ones. ;)
Signature · 2 lines
Pierre Ossman Telephone: +46-13-21 46 00 Cendio AB Web: http://www.cendio.com
_______________________________________________
Alsa-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/alsa-devel