From: Sjoerd Simons <sjoerd@luon.net>
To: Takashi Iwai <tiwai@suse.de>
Cc: pulseaudio-discuss@mail.0pointer.de, alsa-devel@alsa-project.org
Subject: Re: [alsa-devel] Pulseaudio alsa configure hook
Date: Sat, 10 May 2008 21:46:25 +0200 [thread overview]
Message-ID: <20080510194625.GA5558@spring.luon.net> (raw)
In-Reply-To: <s5hiqxzuxev.wl%tiwai@suse.de>
[-- Attachment #1: Type: text/plain, Size: 1531 bytes --]
On Wed, Apr 30, 2008 at 06:20:40PM +0200, Takashi Iwai wrote:
> At Sun, 27 Apr 2008 22:37:09 +0200,
> > The attached patch extends the alsa pulse plugin set with a alsa
> > configuration hook. Allowing one to specify some configuration parameters
> > that only come into effect when pulseaudio is running.
> >
> > For example a configution file like:
> >
> > @hooks [ {
> > func on_pulse_is_running
> > pcm.!default { type pulse }
> > ctl.!default { type pulse }
> > }
> > ]
> >
> > will redirect the default alsa pcm and ctl to pulse iff pulse is running.
> > (Assuming you defined the hook function correctly ofcourse)
> This looks pretty interesting.
> I forgot that this kind of stuff can be also a plugin :)
>
> Applied to HG tree now.
Thanks :).. Unfortunately some more testing revealed some issues with it,
specifically if pulse is running your complete config is replaced the bits in
the on_pulse_is_running directive. Which might not be what one actually wants :)
I couldn't find a proper solution for this. So i've changed the code to
optionally load config files. Just like the load hook does. Actually i just
optionally call the snd_config_hook_load function, but that's not actually in
the alsa API....
Also it now decides pulse is running as soon as the authorizing step begins
(just after the actually connection is setup), which should save some
round-trips and overhead.
Updated patch attached :)
Sjoerd
--
For fast-acting relief, try slowing down.
[-- Attachment #2: alsa-pulse-conf.patch --]
[-- Type: text/x-diff, Size: 1503 bytes --]
diff -r 8b8cd8912f67 pulse/conf_pulse.c
--- a/pulse/conf_pulse.c Wed Apr 30 20:18:15 2008 +0200
+++ b/pulse/conf_pulse.c Sat May 10 21:28:23 2008 +0200
@@ -26,14 +26,19 @@
#include <pulse/pulseaudio.h>
+/* Not actually part of the alsa api.... */
+extern int
+snd_config_hook_load (snd_config_t *root, snd_config_t *config,
+ snd_config_t **dst, snd_config_t *private_data);
+
int
-conf_pulse_hook_on_is_running (snd_config_t *root, snd_config_t *config,
+conf_pulse_hook_load_if_running (snd_config_t *root, snd_config_t *config,
snd_config_t **dst, snd_config_t *private_data) {
- snd_config_t *n = NULL;
pa_mainloop *loop = NULL;
pa_context *context = NULL;
int ret = 0, err, state;
+ *dst = NULL;
/* Defined if we're called inside the pulsedaemon itself */
if (getenv("PULSE_INTERNAL") != NULL)
@@ -65,12 +70,12 @@
goto out;
state = pa_context_get_state(context);
- } while (state < PA_CONTEXT_READY);
+ } while (state < PA_CONTEXT_AUTHORIZING);
- if (state != PA_CONTEXT_READY)
+ if (state > PA_CONTEXT_READY)
goto out;
- ret = snd_config_expand(config, root, NULL, private_data, &n);
+ ret = snd_config_hook_load(root, config, dst, private_data);
out:
if (context != NULL)
@@ -79,10 +84,8 @@
if (loop != NULL)
pa_mainloop_free(loop);
- *dst = n;
-
return ret;
}
-SND_DLSYM_BUILD_VERSION(conf_pulse_hook_on_is_running,
+SND_DLSYM_BUILD_VERSION(conf_pulse_hook_load_if_running,
SND_CONFIG_DLSYM_VERSION_HOOK);
[-- Attachment #3: Type: text/plain, Size: 178 bytes --]
_______________________________________________
pulseaudio-discuss mailing list
pulseaudio-discuss@mail.0pointer.de
https://tango.0pointer.de/mailman/listinfo/pulseaudio-discuss
next prev parent reply other threads:[~2008-05-10 19:46 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-04-27 20:37 Pulseaudio alsa configure hook Sjoerd Simons
2008-04-28 8:53 ` Colin Guthrie
2008-04-30 16:20 ` Takashi Iwai
2008-05-10 19:46 ` Sjoerd Simons [this message]
2008-05-13 13:35 ` [alsa-devel] " Takashi Iwai
2008-05-01 13:58 ` Colin Guthrie
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20080510194625.GA5558@spring.luon.net \
--to=sjoerd@luon.net \
--cc=alsa-devel@alsa-project.org \
--cc=pulseaudio-discuss@mail.0pointer.de \
--cc=tiwai@suse.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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.