Hi, I posted yesterday, and whilst I didn't figure out an answer the question about the sequencing of the _put call, I did find another way to get what I need. I wanted to get the index of a sink input after creation, but before it plays, so that I can implement sink-input switching and other stream manipulation (volume changes, etc.) in response to audio policy changes, on an embedded system. I can't explain why _put is called after the stream completes playback, but I did discover a different way to be notified of sink- input creation with the completely filled sink input, using pa_subscription. Recall that neither sink-input new hook or the sink- input fixate hook will call back with a complete sink-input (the index of the sink-input has not been set with either) and that I was not seeing the sink-input put hook being called until after a stream had completed playback. So the method I came across (modified from one of the existing module sources) is as follows. Install a subscription routine using in the module init routine: u->subscription = pa_subscription_new(m->core, PA_SUBSCRIPTION_MASK_SINK_INPUT, subscribe_callback, u); This allows us to get notifications on sink-input creations. When this routine is called back, it will be passed the index of the created sink input which makes getting at the actual sink-input to inspect it's fields really easy. Here is a subscribe callback to do this: static void subscribe_callback(pa_core *c, pa_subscription_event_type_t t, uint32_t idx, void *userdata) { struct userdata *u = userdata; pa_sink_input *si = NULL; pa_assert(c); pa_assert(u); pa_log("> pa__init"); /* we are only interested in sink-input creation events */ if (t != PA_SUBSCRIPTION_EVENT_SINK_INPUT| PA_SUBSCRIPTION_EVENT_NEW) { pa_log("< pa__init - not a new sink input"); return; } else { if (!(si = pa_idxset_get_by_index(c->sink_inputs, idx))) { pa_log("< pa__init - can't get index"); return; } } pa_log("new event received on sink-input with index %d",si->index); } Regards Nick -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.freedesktop.org/archives/pulseaudio-discuss/attachments/20080620/e120906c/attachment.htm>