[pulseaudio-discuss] PA_SUBSCRIPTION_EVENT_REMOVE in PulseAudio

Lennart Poettering lennart at poettering.net
Sun Jul 27 08:01:48 PDT 2008


On Wed, 23.07.08 16:27, Stanley Cai (stanley.w.cai at gmail.com) wrote:

> Hi,
> 
> I tried to implement a PA module, which includes the function such as moving
> all the sink inputs from one sink to another active sink when the former is
> removed/unloaded. When I used pa_subscription to insert my hook function, I
> found in all EVENT_REMOVE callback functions (no matter sink, sink input and
> client) I can do little. When the event callback is invoked, the sink has
> been unlinked already and I can not find any clue via the index number.
> Specially before sink removal event, all the sink inputs were
> killed. :(

The subscription logic is for asynchronous notification. It's purely
informational, you may not use it to interfere with the normal state
logic of the core.

I think you are looking for the hooks defined in
pa_core->hooks[]. They allow you to install hook functions at several
places that can be used to modify the normal behaviour of the core.

See modules/module-rescue-streams.c for an example how to use that.

Lennart

-- 
Lennart Poettering                        Red Hat, Inc.
lennart [at] poettering [dot] net         ICQ# 11060553
http://0pointer.net/lennart/           GnuPG 0x1A015CC4



More information about the pulseaudio-discuss mailing list