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

Zhang, Xing Z xing.z.zhang at intel.com
Wed Oct 15 01:41:58 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.

[Zhang, Xing Z]
Yeah. I ever considered to do it through PA commands by script. After having a look at module-hal-detect.c and module-bluetooth-discover.c, I think there is enough stuff for us to do things internal. IMO, script is not an elegant way in comparison to HAL and DBUS.
Ennnn, anyway I am still in thinking stage, as described in previous mail dynamic policies for different people is a problem.

>
>




More information about the pulseaudio-discuss mailing list