[pulseaudio-discuss] sink/source automatic switching policy between different devices

Erik Slagter erik at slagter.name
Wed Oct 15 01:18:39 PDT 2008


Zhang, Xing Z wrote:

> I am thinking about how to implement sink/source automatic switching
> policy in PA. For mobile device, it may have several output devices
> such as speaker, wired headset, Bluetooth headset and so on. People
> may want to audio stream automatically re-direct to new device they
> plug in. For example, while I play a MP3 with embedded speaker I want
> to the music automatically output through Bluetooth headset once I
> plug it in. After a rough looking into the source, I think the
> mechanism used by module-hal-detect.so, module-bluetooth-discover.so
> and "move-sink-input" could help me to achieve the goal. That means a
> new module may be written. But, the problem is different users may
> want different policies. For instance, somebody may want to speaker
> automatically muted when wired headset plugged in, while others may
> want speaker go on playing. So a new module is hard to provide
> dynamic policy for different people because once it complied all
> things are hard coding. A feasible way is the module reads in a
> configure file to decide to provide what policy. I am afraid the
> configure file may make things complicated so I consult you is there
> an easier way? Many thanks in advance :)

This is more less exactly what I wanted to do about a year ago. I just
cannot believe there is nobody else who want's this.

I have achieved my goal using udev. When a certain device is plugged in
or plugged out, the udev scripts use specific pa commands to set up and
take down devices and also change the default output. This works, but it
is also complicated and sometimes apparently it generates a race
condition and it simply doesn't work.



-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/x-pkcs7-signature
Size: 3328 bytes
Desc: S/MIME Cryptographic Signature
URL: <http://lists.freedesktop.org/archives/pulseaudio-discuss/attachments/20081015/bb26f49f/attachment.bin>


More information about the pulseaudio-discuss mailing list