[pulseaudio-discuss] sink input unlink hooks

pl bossart bossart.nospam at gmail.com
Tue Jan 20 07:59:45 PST 2009


Thanks Lennart for the explanation of the need to use the native protocol
hooks only if you need to change the database.
On the problem with the unlink hook, you replied to me in a private email, I
am copying the answer for the group.

>Here's your problem: at the time the UNLINK hook is called the
>pa_sink_input object is already fully initialized. Hence we don't have
>to use tha pa_sink_input_new_data structure but instead can pass the
>sink input object itself. Hence your prototype should look like this:
>
>static pa_hook_result_t siuhc(pa_core *c, pa_sink_input *si, struct
>userdata *u);
>
>or similar.

In short, hooks don'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.

Regards
Pierre

On Sun, Jan 18, 2009 at 9:23 AM, Lennart Poettering
<lennart at poettering.net>wrote:

> On Thu, 15.01.09 17:47, pl bossart (bossart.nospam at gmail.com) wrote:
>
> > Hi all,
> > I am trying to write a module that keeps track of all connections to a
> sink.
> > I started from the code in module-stream-restore.c, read detailed
> > explanations from Lennart and the hooks work well. Except for the unlink
> > hook. Somehow looking at the client name with the proplist causes a seg
> > fault. And when I look at the code in module-stream-restore, I see hooks
> > into the native protocol being used, along with subscriptions that
> > supposedly are a thing of the past. So my question is, in which cases
> should
> > these be used, and when are hooks into the core sufficient?
> > Thanks for your feedback
>
> m-s-r defines an "extension" for the native protocol which allows
> clients to query and manipulate the stored stream database as well as
> being notified about database changes. For the latter we need to keep
> track of native connections, that's why we hook into the native
> protocol. Unless you too want to define a protocol extension you don't
> need to hook into the native protocol at all.
>
> If you hook into PA_CORE_HOOK_SINK_INPUT_UNLINK you get the still
> completely valid pa_sink_input* object as second argument. It's
> proplist should still be fully valid as well.
>
> Please note that there is no guarantee that any of the defined
> properties is actually set in a sink input's proplist.
>
> If you allow me to have a peek at your code I might be able to tell
> you what is wrong.
>
> Lennart
>
> --
> Lennart Poettering                        Red Hat, Inc.
> lennart [at] poettering [dot] net         ICQ# 11060553
> http://0pointer.net/lennart/           GnuPG 0x1A015CC4
> _______________________________________________
> pulseaudio-discuss mailing list
> pulseaudio-discuss at mail.0pointer.de
> https://tango.0pointer.de/mailman/listinfo/pulseaudio-discuss
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freedesktop.org/archives/pulseaudio-discuss/attachments/20090120/d08534af/attachment.htm>


More information about the pulseaudio-discuss mailing list