[pulseaudio-commits] r1600 - in /branches/lennart/src/pulsecore: core.c core.h sink-input.c sink.c source-output.c source.c

svnmailer-noreply at 0pointer.de svnmailer-noreply at 0pointer.de
Thu Aug 9 14:05:22 PDT 2007


Author: lennart
Date: Thu Aug  9 23:05:20 2007
New Revision: 1600

URL: http://0pointer.de/cgi-bin/viewcvs.cgi?rev=3D1600&root=3Dpulseaudio&vi=
ew=3Drev
Log:
add a couple of additional hooks for modules to use

Modified:
    branches/lennart/src/pulsecore/core.c
    branches/lennart/src/pulsecore/core.h
    branches/lennart/src/pulsecore/sink-input.c
    branches/lennart/src/pulsecore/sink.c
    branches/lennart/src/pulsecore/source-output.c
    branches/lennart/src/pulsecore/source.c

Modified: branches/lennart/src/pulsecore/core.c
URL: http://0pointer.de/cgi-bin/viewcvs.cgi/branches/lennart/src/pulsecore/=
core.c?rev=3D1600&root=3Dpulseaudio&r1=3D1599&r2=3D1600&view=3Ddiff
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D
--- branches/lennart/src/pulsecore/core.c (original)
+++ branches/lennart/src/pulsecore/core.c Thu Aug  9 23:05:20 2007
@@ -164,10 +164,22 @@
 =

     c->is_system_instance =3D 0;
 =

+    pa_hook_init(&c->hook_sink_new, c);
+    pa_hook_init(&c->hook_sink_new_post, c);
+    pa_hook_init(&c->hook_sink_disconnect, c);
+    pa_hook_init(&c->hook_sink_disconnect_post, c);
+    pa_hook_init(&c->hook_source_new, c);
+    pa_hook_init(&c->hook_source_new_post, c);
+    pa_hook_init(&c->hook_source_disconnect, c);
+    pa_hook_init(&c->hook_source_disconnect_post, c);
     pa_hook_init(&c->hook_sink_input_new, c);
-    pa_hook_init(&c->hook_sink_disconnect, c);
+    pa_hook_init(&c->hook_sink_input_new_post, c);
+    pa_hook_init(&c->hook_sink_input_disconnect, c);
+    pa_hook_init(&c->hook_sink_input_disconnect_post, c);
     pa_hook_init(&c->hook_source_output_new, c);
-    pa_hook_init(&c->hook_source_disconnect, c);
+    pa_hook_init(&c->hook_source_output_new_post, c);
+    pa_hook_init(&c->hook_source_output_disconnect, c);
+    pa_hook_init(&c->hook_source_output_disconnect_post, c);
 =

     pa_property_init(c);
 =

@@ -226,10 +238,22 @@
 =

     c->mainloop->io_free(c->asyncmsgq_event);
 =

+    pa_hook_free(&c->hook_sink_new);
+    pa_hook_free(&c->hook_sink_new_post);
+    pa_hook_free(&c->hook_sink_disconnect);
+    pa_hook_free(&c->hook_sink_disconnect_post);
+    pa_hook_free(&c->hook_source_new);
+    pa_hook_free(&c->hook_source_new_post);
+    pa_hook_free(&c->hook_source_disconnect);
+    pa_hook_free(&c->hook_source_disconnect_post);
     pa_hook_free(&c->hook_sink_input_new);
-    pa_hook_free(&c->hook_sink_disconnect);
+    pa_hook_free(&c->hook_sink_input_new_post);
+    pa_hook_free(&c->hook_sink_input_disconnect);
+    pa_hook_free(&c->hook_sink_input_disconnect_post);
     pa_hook_free(&c->hook_source_output_new);
-    pa_hook_free(&c->hook_source_disconnect);
+    pa_hook_free(&c->hook_source_output_new_post);
+    pa_hook_free(&c->hook_source_output_disconnect);
+    pa_hook_free(&c->hook_source_output_disconnect_post);
 =

     pa_xfree(c);
 }

Modified: branches/lennart/src/pulsecore/core.h
URL: http://0pointer.de/cgi-bin/viewcvs.cgi/branches/lennart/src/pulsecore/=
core.h?rev=3D1600&root=3Dpulseaudio&r1=3D1599&r2=3D1600&view=3Ddiff
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D
--- branches/lennart/src/pulsecore/core.h (original)
+++ branches/lennart/src/pulsecore/core.h Thu Aug  9 23:05:20 2007
@@ -88,10 +88,22 @@
 =

     /* hooks */
     pa_hook
+        hook_sink_new,
+        hook_sink_new_post,
+        hook_sink_disconnect,
+        hook_sink_disconnect_post,
+        hook_source_new,
+        hook_source_new_post,
+        hook_source_disconnect,
+        hook_source_disconnect_post,
         hook_sink_input_new,
-        hook_sink_disconnect,
+        hook_sink_input_new_post,
+        hook_sink_input_disconnect,
+        hook_sink_input_disconnect_post,
         hook_source_output_new,
-        hook_source_disconnect;
+        hook_source_output_new_post,
+        hook_source_output_disconnect,
+        hook_source_output_disconnect_post;
 =

     pa_asyncmsgq *asyncmsgq;
     pa_io_event *asyncmsgq_event;

Modified: branches/lennart/src/pulsecore/sink-input.c
URL: http://0pointer.de/cgi-bin/viewcvs.cgi/branches/lennart/src/pulsecore/=
sink-input.c?rev=3D1600&root=3Dpulseaudio&r1=3D1599&r2=3D1600&view=3Ddiff
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D
--- branches/lennart/src/pulsecore/sink-input.c (original)
+++ branches/lennart/src/pulsecore/sink-input.c Thu Aug  9 23:05:20 2007
@@ -249,6 +249,8 @@
     pa_assert(i);
     pa_return_if_fail(i->state !=3D PA_SINK_INPUT_DISCONNECTED);
 =

+    pa_hook_fire(&i->sink->core->hook_sink_input_disconnect, i);
+    =

     if (i->sync_prev)
         i->sync_prev->sync_next =3D i->sync_next;
     if (i->sync_next)
@@ -265,12 +267,14 @@
     sink_input_set_state(i, PA_SINK_INPUT_DISCONNECTED);
     pa_sink_update_status(i->sink);
     =

-    i->sink =3D NULL;
     i->peek =3D NULL;
     i->drop =3D NULL;
     i->kill =3D NULL;
     i->get_latency =3D NULL;
     i->underrun =3D NULL;
+
+    pa_hook_fire(&i->sink->core->hook_sink_input_disconnect_post, i);
+    i->sink =3D NULL;
     pa_sink_input_unref(i);
 }
 =

@@ -309,6 +313,7 @@
     pa_sink_update_status(i->sink);
 =

     pa_subscription_post(i->sink->core, PA_SUBSCRIPTION_EVENT_SINK_INPUT|P=
A_SUBSCRIPTION_EVENT_NEW, i->index);
+    pa_hook_fire(&i->sink->core->hook_sink_input_new_post, i);
 }
 =

 void pa_sink_input_kill(pa_sink_input*i) {

Modified: branches/lennart/src/pulsecore/sink.c
URL: http://0pointer.de/cgi-bin/viewcvs.cgi/branches/lennart/src/pulsecore/=
sink.c?rev=3D1600&root=3Dpulseaudio&r1=3D1599&r2=3D1600&view=3Ddiff
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D
--- branches/lennart/src/pulsecore/sink.c (original)
+++ branches/lennart/src/pulsecore/sink.c Thu Aug  9 23:05:20 2007
@@ -80,6 +80,9 @@
     pa_return_null_if_fail(!driver || pa_utf8_valid(driver));
     pa_return_null_if_fail(name && pa_utf8_valid(name) && *name);
 =

+    if (pa_hook_fire(&core->hook_sink_new, NULL) < 0) /* FIXME */
+        return NULL;
+    =

     s =3D pa_msgobject_new(pa_sink);
 =

     if (!(name =3D pa_namereg_register(core, name, PA_NAMEREG_SINK, s, fai=
l))) {
@@ -146,6 +149,8 @@
 =

     pa_subscription_post(core, PA_SUBSCRIPTION_EVENT_SINK | PA_SUBSCRIPTIO=
N_EVENT_NEW, s->index);
 =

+    pa_hook_fire(&core->hook_sink_new_post, s);
+
     return s;
 }
 =

@@ -174,10 +179,10 @@
     pa_assert(s);
     pa_return_if_fail(s->state !=3D PA_SINK_DISCONNECTED);
 =

+    pa_hook_fire(&s->core->hook_sink_disconnect, s);
+    =

     pa_namereg_unregister(s->core, s->name);
     pa_idxset_remove_by_data(s->core->sinks, s, NULL);
-
-    pa_hook_fire(&s->core->hook_sink_disconnect, s);
 =

     while ((i =3D pa_idxset_first(s->inputs, NULL))) {
         pa_assert(i !=3D j);
@@ -198,6 +203,8 @@
     s->set_state =3D NULL;
 =

     pa_subscription_post(s->core, PA_SUBSCRIPTION_EVENT_SINK | PA_SUBSCRIP=
TION_EVENT_REMOVE, s->index);
+
+    pa_hook_fire(&s->core->hook_sink_disconnect_post, s);
 }
 =

 static void sink_free(pa_object *o) {

Modified: branches/lennart/src/pulsecore/source-output.c
URL: http://0pointer.de/cgi-bin/viewcvs.cgi/branches/lennart/src/pulsecore/=
source-output.c?rev=3D1600&root=3Dpulseaudio&r1=3D1599&r2=3D1600&view=3Ddiff
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D
--- branches/lennart/src/pulsecore/source-output.c (original)
+++ branches/lennart/src/pulsecore/source-output.c Thu Aug  9 23:05:20 2007
@@ -187,21 +187,26 @@
     pa_assert(o);
     pa_return_if_fail(o->state !=3D PA_SOURCE_OUTPUT_DISCONNECTED);
 =

+    pa_hook_fire(&o->source->core->hook_source_output_disconnect, o);
+    =

     pa_asyncmsgq_send(o->source->asyncmsgq, PA_MSGOBJECT(o->source), PA_SO=
URCE_MESSAGE_REMOVE_OUTPUT, o, 0, NULL);
 =

     pa_idxset_remove_by_data(o->source->core->source_outputs, o, NULL);
     pa_idxset_remove_by_data(o->source->outputs, o, NULL);
-    pa_source_output_unref(o);
 =

     pa_subscription_post(o->source->core, PA_SUBSCRIPTION_EVENT_SOURCE_OUT=
PUT|PA_SUBSCRIPTION_EVENT_REMOVE, o->index);
 =

     source_output_set_state(o, PA_SOURCE_OUTPUT_DISCONNECTED);
     pa_source_update_status(o->source);
 =

-    o->source =3D NULL;
     o->push =3D NULL;
     o->kill =3D NULL;
     o->get_latency =3D NULL;
+
+    pa_hook_fire(&o->source->core->hook_source_output_disconnect_post, o);
+
+    o->source =3D NULL;
+    pa_source_output_unref(o);
 }
 =

 static void source_output_free(pa_object* mo) {
@@ -229,6 +234,8 @@
     pa_source_update_status(o->source);
 =

     pa_subscription_post(o->source->core, PA_SUBSCRIPTION_EVENT_SOURCE_OUT=
PUT|PA_SUBSCRIPTION_EVENT_NEW, o->index);
+
+    pa_hook_fire(&o->source->core->hook_source_output_new_post, o);
 }
 =

 void pa_source_output_kill(pa_source_output*o) {

Modified: branches/lennart/src/pulsecore/source.c
URL: http://0pointer.de/cgi-bin/viewcvs.cgi/branches/lennart/src/pulsecore/=
source.c?rev=3D1600&root=3Dpulseaudio&r1=3D1599&r2=3D1600&view=3Ddiff
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D
--- branches/lennart/src/pulsecore/source.c (original)
+++ branches/lennart/src/pulsecore/source.c Thu Aug  9 23:05:20 2007
@@ -73,6 +73,9 @@
     pa_return_null_if_fail(!driver || pa_utf8_valid(driver));
     pa_return_null_if_fail(pa_utf8_valid(name) && *name);
 =

+    if (pa_hook_fire(&core->hook_sink_new, NULL) < 0) /* FIXME */
+        return NULL;
+    =

     s =3D pa_msgobject_new(pa_source);
 =

     if (!(name =3D pa_namereg_register(core, name, PA_NAMEREG_SOURCE, s, f=
ail))) {
@@ -125,6 +128,8 @@
 =

     pa_subscription_post(core, PA_SUBSCRIPTION_EVENT_SOURCE | PA_SUBSCRIPT=
ION_EVENT_NEW, s->index);
 =

+    pa_hook_fire(&core->hook_source_new_post, s);
+    =

     return s;
 }
 =

@@ -153,10 +158,10 @@
     pa_assert(s);
     pa_return_if_fail(s->state !=3D PA_SOURCE_DISCONNECTED);
 =

+    pa_hook_fire(&s->core->hook_source_disconnect, s);
+
     pa_namereg_unregister(s->core, s->name);
     pa_idxset_remove_by_data(s->core->sources, s, NULL);
-
-    pa_hook_fire(&s->core->hook_source_disconnect, s);
 =

     while ((o =3D pa_idxset_first(s->outputs, NULL))) {
         pa_assert(o !=3D j);
@@ -174,6 +179,8 @@
     s->set_state =3D NULL;
 =

     pa_subscription_post(s->core, PA_SUBSCRIPTION_EVENT_SOURCE | PA_SUBSCR=
IPTION_EVENT_REMOVE, s->index);
+
+    pa_hook_fire(&s->core->hook_source_disconnect_post, s);
 }
 =

 static void source_free(pa_object *o) {




More information about the pulseaudio-commits mailing list