* [PATCH] Allow ioplugins to override snd_pcm_delay()
@ 2006-05-26 9:38 Pierre Ossman
2006-05-26 12:24 ` Takashi Iwai
2006-05-26 12:41 ` James Courtier-Dutton
0 siblings, 2 replies; 9+ messages in thread
From: Pierre Ossman @ 2006-05-26 9:38 UTC (permalink / raw)
To: alsa-devel, Takashi Iwai
[-- Attachment #1.1.1: Type: text/plain, Size: 301 bytes --]
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@cendio.se>
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1.1.2: ioplug-delay.patch --]
[-- Type: text/x-patch; name="ioplug-delay.patch", Size: 1415 bytes --]
? 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 #1.2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 251 bytes --]
[-- Attachment #2: Type: text/plain, Size: 0 bytes --]
[-- Attachment #3: Type: text/plain, Size: 161 bytes --]
_______________________________________________
Alsa-devel mailing list
Alsa-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/alsa-devel
^ permalink raw reply [flat|nested] 9+ messages in thread* Re: [PATCH] Allow ioplugins to override snd_pcm_delay()
2006-05-26 9:38 [PATCH] Allow ioplugins to override snd_pcm_delay() Pierre Ossman
@ 2006-05-26 12:24 ` Takashi Iwai
2006-05-26 12:31 ` Pierre Ossman
2006-05-26 12:35 ` Pierre Ossman
2006-05-26 12:41 ` James Courtier-Dutton
1 sibling, 2 replies; 9+ messages in thread
From: Takashi Iwai @ 2006-05-26 12:24 UTC (permalink / raw)
To: Pierre Ossman; +Cc: alsa-devel
At Fri, 26 May 2006 11:38:11 +0200,
Pierre Ossman wrote:
>
> 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@cendio.se>
>
> ? 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,
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
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH] Allow ioplugins to override snd_pcm_delay()
2006-05-26 12:24 ` Takashi Iwai
@ 2006-05-26 12:31 ` Pierre Ossman
2006-05-26 12:35 ` Pierre Ossman
1 sibling, 0 replies; 9+ messages in thread
From: Pierre Ossman @ 2006-05-26 12:31 UTC (permalink / raw)
To: Takashi Iwai; +Cc: alsa-devel
[-- Attachment #1.1: Type: text/plain, Size: 846 bytes --]
Takashi Iwai wrote:
>
> 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?
>
No problem. I'll have it fixed later this afternoon.
--
Rgds
Pierre Ossman Telephone: +46-13-21 46 00
Cendio AB Web: http://www.cendio.com
[-- Attachment #1.2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 251 bytes --]
[-- Attachment #2: Type: text/plain, Size: 0 bytes --]
[-- Attachment #3: Type: text/plain, Size: 161 bytes --]
_______________________________________________
Alsa-devel mailing list
Alsa-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/alsa-devel
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH] Allow ioplugins to override snd_pcm_delay()
2006-05-26 12:24 ` Takashi Iwai
2006-05-26 12:31 ` Pierre Ossman
@ 2006-05-26 12:35 ` Pierre Ossman
2006-05-26 12:41 ` Takashi Iwai
1 sibling, 1 reply; 9+ messages in thread
From: Pierre Ossman @ 2006-05-26 12:35 UTC (permalink / raw)
To: Takashi Iwai; +Cc: alsa-devel
[-- Attachment #1.1: Type: text/plain, Size: 455 bytes --]
Takashi Iwai wrote:
>
> 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?
--
Rgds
Pierre Ossman Telephone: +46-13-21 46 00
Cendio AB Web: http://www.cendio.com
[-- Attachment #1.2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 251 bytes --]
[-- Attachment #2: Type: text/plain, Size: 0 bytes --]
[-- Attachment #3: Type: text/plain, Size: 161 bytes --]
_______________________________________________
Alsa-devel mailing list
Alsa-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/alsa-devel
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH] Allow ioplugins to override snd_pcm_delay()
2006-05-26 12:35 ` Pierre Ossman
@ 2006-05-26 12:41 ` Takashi Iwai
0 siblings, 0 replies; 9+ messages in thread
From: Takashi Iwai @ 2006-05-26 12:41 UTC (permalink / raw)
To: Pierre Ossman; +Cc: alsa-devel
At Fri, 26 May 2006 14:35:20 +0200,
Pierre Ossman wrote:
>
> Takashi Iwai wrote:
> >
> > 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
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH] Allow ioplugins to override snd_pcm_delay()
2006-05-26 9:38 [PATCH] Allow ioplugins to override snd_pcm_delay() Pierre Ossman
2006-05-26 12:24 ` Takashi Iwai
@ 2006-05-26 12:41 ` James Courtier-Dutton
2006-05-26 12:46 ` Pierre Ossman
1 sibling, 1 reply; 9+ messages in thread
From: James Courtier-Dutton @ 2006-05-26 12:41 UTC (permalink / raw)
To: Pierre Ossman; +Cc: Takashi Iwai, alsa-devel
Pierre Ossman wrote:
> 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@cendio.se>
>
Can you give an example of a plugin that would want to adjust the delay
value?
James
^ permalink raw reply [flat|nested] 9+ messages in thread
* [PATCH] Allow ioplugins to override snd_pcm_delay()
@ 2006-05-26 14:01 Pierre Ossman
2006-05-26 15:10 ` Takashi Iwai
0 siblings, 1 reply; 9+ messages in thread
From: Pierre Ossman @ 2006-05-26 14:01 UTC (permalink / raw)
To: alsa-devel, Takashi Iwai
[-- Attachment #1.1.1: Type: text/plain, Size: 299 bytes --]
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@cendio.se>
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1.1.2: ioplug-delay.patch --]
[-- Type: text/x-patch; name="ioplug-delay.patch", Size: 2068 bytes --]
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 26 May 2006 13:59:14 -0000
@@ -106,8 +106,15 @@
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->version >= 0x010001) &&
+ (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;
}
@@ -872,7 +879,9 @@
ioplug->callback->stop &&
ioplug->callback->pointer);
- if (ioplug->version != SND_PCM_IOPLUG_VERSION) {
+ /* We support 1.0.0 to current */
+ if ((ioplug->version < 0x010000) ||
+ (ioplug->version > SND_PCM_IOPLUG_VERSION)) {
SNDERR("ioplug: Plugin version mismatch\n");
return -ENXIO;
}
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 26 May 2006 13:59:14 -0000
@@ -65,7 +65,7 @@
*/
#define SND_PCM_IOPLUG_VERSION_MAJOR 1 /**< Protocol major version */
#define SND_PCM_IOPLUG_VERSION_MINOR 0 /**< Protocol minor version */
-#define SND_PCM_IOPLUG_VERSION_TINY 0 /**< Protocol tiny version */
+#define SND_PCM_IOPLUG_VERSION_TINY 1 /**< Protocol tiny version */
/**
* IO-plugin protocol version
*/
@@ -184,6 +184,10 @@
* dump; optional
*/
void (*dump)(snd_pcm_ioplug_t *io, snd_output_t *out);
+ /**
+ * get the delay for the running PCM; optional
+ */
+ int (*delay)(snd_pcm_ioplug_t *io, snd_pcm_sframes_t *delayp);
};
[-- Attachment #1.2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 251 bytes --]
[-- Attachment #2: Type: text/plain, Size: 0 bytes --]
[-- Attachment #3: Type: text/plain, Size: 161 bytes --]
_______________________________________________
Alsa-devel mailing list
Alsa-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/alsa-devel
^ permalink raw reply [flat|nested] 9+ messages in thread* Re: [PATCH] Allow ioplugins to override snd_pcm_delay()
2006-05-26 14:01 Pierre Ossman
@ 2006-05-26 15:10 ` Takashi Iwai
0 siblings, 0 replies; 9+ messages in thread
From: Takashi Iwai @ 2006-05-26 15:10 UTC (permalink / raw)
To: Pierre Ossman; +Cc: alsa-devel
At Fri, 26 May 2006 16:01:16 +0200,
Pierre Ossman wrote:
>
> 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@cendio.se>
Thanks, applied to HG repo with minor space fixes.
Takashi
^ permalink raw reply [flat|nested] 9+ messages in thread
end of thread, other threads:[~2006-05-26 15:10 UTC | newest]
Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2006-05-26 9:38 [PATCH] Allow ioplugins to override snd_pcm_delay() Pierre Ossman
2006-05-26 12:24 ` Takashi Iwai
2006-05-26 12:31 ` Pierre Ossman
2006-05-26 12:35 ` Pierre Ossman
2006-05-26 12:41 ` Takashi Iwai
2006-05-26 12:41 ` James Courtier-Dutton
2006-05-26 12:46 ` Pierre Ossman
-- strict thread matches above, loose matches on Subject: below --
2006-05-26 14:01 Pierre Ossman
2006-05-26 15:10 ` Takashi Iwai
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.