Thanks Lennart for the explanation of the need to use the native protocol hooks only if you need to change the database.<br>On the problem with the unlink hook, you replied to me in a private email, I am copying the answer for the group. <br>
<br>&gt;Here&#39;s your problem: at the time the UNLINK hook is called the<br>
&gt;pa_sink_input object is already fully initialized. Hence we don&#39;t have<br>
&gt;to use tha pa_sink_input_new_data structure but instead can pass the<br>
&gt;sink input object itself. Hence your prototype should look like this:<br>
&gt;<br>
&gt;static pa_hook_result_t siuhc(pa_core *c, pa_sink_input *si, struct<br>
&gt;userdata *u);<br>
&gt;<br>
&gt;or similar.<br><br>In short, hooks don&#39;t necessarily have the same prototype. The callbacks for SINK_INPUT_NEW and SINK_INPUT_FIXATE rely on a pa_sink_input_new_data struct while the SINK_INPUT_UNLINK relies on a pa_sink_input structure.<br>
<br>Regards<br>Pierre<br><br><div class="gmail_quote">On Sun, Jan 18, 2009 at 9:23 AM, Lennart Poettering <span dir="ltr">&lt;<a href="mailto:lennart@poettering.net">lennart@poettering.net</a>&gt;</span> wrote:<br><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
<div><div></div><div class="Wj3C7c">On Thu, 15.01.09 17:47, pl bossart (<a href="mailto:bossart.nospam@gmail.com">bossart.nospam@gmail.com</a>) wrote:<br>
<br>
&gt; Hi all,<br>
&gt; I am trying to write a module that keeps track of all connections to a sink.<br>
&gt; I started from the code in module-stream-restore.c, read detailed<br>
&gt; explanations from Lennart and the hooks work well. Except for the unlink<br>
&gt; hook. Somehow looking at the client name with the proplist causes a seg<br>
&gt; fault. And when I look at the code in module-stream-restore, I see hooks<br>
&gt; into the native protocol being used, along with subscriptions that<br>
&gt; supposedly are a thing of the past. So my question is, in which cases should<br>
&gt; these be used, and when are hooks into the core sufficient?<br>
&gt; Thanks for your feedback<br>
<br>
</div></div>m-s-r defines an &quot;extension&quot; for the native protocol which allows<br>
clients to query and manipulate the stored stream database as well as<br>
being notified about database changes. For the latter we need to keep<br>
track of native connections, that&#39;s why we hook into the native<br>
protocol. Unless you too want to define a protocol extension you don&#39;t<br>
need to hook into the native protocol at all.<br>
<br>
If you hook into PA_CORE_HOOK_SINK_INPUT_UNLINK you get the still<br>
completely valid pa_sink_input* object as second argument. It&#39;s<br>
proplist should still be fully valid as well.<br>
<br>
Please note that there is no guarantee that any of the defined<br>
properties is actually set in a sink input&#39;s proplist.<br>
<br>
If you allow me to have a peek at your code I might be able to tell<br>
you what is wrong.<br>
<br>
Lennart<br>
<font color="#888888"><br>
--<br>
Lennart Poettering &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;Red Hat, Inc.<br>
lennart [at] poettering [dot] net &nbsp; &nbsp; &nbsp; &nbsp; ICQ# 11060553<br>
<a href="http://0pointer.net/lennart/" target="_blank">http://0pointer.net/lennart/</a> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; GnuPG 0x1A015CC4<br>
_______________________________________________<br>
pulseaudio-discuss mailing list<br>
<a href="mailto:pulseaudio-discuss@mail.0pointer.de">pulseaudio-discuss@mail.0pointer.de</a><br>
<a href="https://tango.0pointer.de/mailman/listinfo/pulseaudio-discuss" target="_blank">https://tango.0pointer.de/mailman/listinfo/pulseaudio-discuss</a><br>
</font></blockquote></div><br>