Many thanks Colin, this helped me.<br><br>Best Regards,<br>Himanshu<br><br><div class="gmail_quote">On Tue, Jun 7, 2011 at 5:17 PM, Colin Guthrie <span dir="ltr"><<a href="mailto:gmane@colin.guthr.ie">gmane@colin.guthr.ie</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;">Hello!<br>
<br>
'Twas brillig, and Himanshu Chug at 06/06/11 17:22 did gyre and gimble:<br>
<div class="im">> I am going through module-cork-music-on-phone.c<br>
><br>
> To understand the code , I need some information about these functions:<br>
<br>
</div>Yes, our internal developer docs don't really exist! :s I generally just<br>
read through the code to see when these call backs are called. It's not<br>
ideal, but it's pretty straight forward too. That said we really should<br>
get an effort to provide better internal developer docs (e.g. internal<br>
APIs within the server).<br>
<div class="im"><br>
> 1. when each of these calls backs gets executed/called ?<br>
<br>
</div>> sink_input_put_cb<br>
<br>
Note that for all these questions you've asked about the function as<br>
called in module-cork-music-on-phone.c. In reality these functions can<br>
be called anything you like. The more important question is the HOOK<br>
that you're attaching them to for which you need to look at the<br>
pa__init() function in module-cork-music-on-phone.c<br>
<br>
PA_CORE_HOOK_SINK_INPUT_PUT<br>
<br>
So this hook is called when the sink input (playback stream) is<br>
physically created. There is an earlier hook that runs called<br>
PA_CORE_HOOK_SINK_INPUT_NEW which is run before the actual sink input<br>
object is created.<br>
<br>
> sink_input_unlink_cb<br>
<br>
PA_CORE_HOOK_SINK_INPUT_UNLINK<br>
<br>
This is called when a sink input disappears (e.g. the client application<br>
closes it's stream (user presses "Stop") or exits.<br>
<div class="im"><br>
> sink_input_move_start_cb<br>
<br>
</div>PA_CORE_HOOK_SINK_INPUT_MOVE_START<br>
<br>
This is called when we start to move a sink input to a new sink. At this<br>
point the sink input is still attached the sink it is moving from.<br>
<div class="im"><br>
> sink_input_move_finish_cb<br>
<br>
</div>PA_CORE_HOOK_SINK_INPUT_MOVE_FINISH<br>
<br>
This is called when we're done moving a sink input to a new sink and<br>
thus the sink input is now attached to the sink it was moved to.<br>
<div class="im"><br>
<br>
> 2. these callbacks are internally calling to process() function (given<br>
> below) , I am interested to understand the last argument pa_bool_t<br>
> create of process(struct userdata *u, pa_sink_input *i, pa_bool_t create)<br>
> ,how to decide when to pass TRUE and FALSE to process? any reference<br>
> (if available) will be helpful.<br>
<br>
</div>You can work this out from the semantics of the descriptions above and<br>
the code in the process() function itself.<br>
<br>
Ultimately it's telling the process method that it should be corking or<br>
uncorking the streams.<br>
<br>
So when we've got a new sink input appearing on our sink (which happens<br>
in the PUT or MOVE_FINISH hooks), we need to look at (potentially)<br>
creating a cork on the other sink inputs on that sink, hence a TRUE value.<br>
<br>
But when a stream is disappearing (which can happen when it's moved off<br>
our sink to another one, or when it's just no longer present - i.e.<br>
UNLINK and MOVE_START hooks), we want to look at uncorking things we<br>
have previously corked, hence a FALSE value.<br>
<br>
> Thanks in advance<br>
<br>
Hope that helps.<br>
<br>
Col<br>
<br>
PS Documentation patches or similar efforts are as welcome as any other<br>
contribution!<br>
<br>
Col<br>
--<br>
<br>
Colin Guthrie<br>
gmane(at)<a href="http://colin.guthr.ie" target="_blank">colin.guthr.ie</a><br>
<a href="http://colin.guthr.ie/" target="_blank">http://colin.guthr.ie/</a><br>
<br>
Day Job:<br>
Tribalogic Limited [<a href="http://www.tribalogic.net/" target="_blank">http://www.tribalogic.net/</a>]<br>
Open Source:<br>
Mageia Contributor [<a href="http://www.mageia.org/" target="_blank">http://www.mageia.org/</a>]<br>
PulseAudio Hacker [<a href="http://www.pulseaudio.org/" target="_blank">http://www.pulseaudio.org/</a>]<br>
Trac Hacker [<a href="http://trac.edgewall.org/" target="_blank">http://trac.edgewall.org/</a>]<br>
<br>
_______________________________________________<br>
pulseaudio-discuss mailing list<br>
<a href="mailto:pulseaudio-discuss@lists.freedesktop.org">pulseaudio-discuss@lists.freedesktop.org</a><br>
<a href="http://lists.freedesktop.org/mailman/listinfo/pulseaudio-discuss" target="_blank">http://lists.freedesktop.org/mailman/listinfo/pulseaudio-discuss</a><br>
</blockquote></div><br>