[pulseaudio-commits] r1640 - in /branches/lennart/src: modules/ pulsecore/

svnmailer-noreply at 0pointer.de svnmailer-noreply at 0pointer.de
Sat Aug 11 12:08:07 PDT 2007


Author: lennart
Date: Sat Aug 11 21:08:06 2007
New Revision: 1640

URL: http://0pointer.de/cgi-bin/viewcvs.cgi?rev=3D1640&root=3Dpulseaudio&vi=
ew=3Drev
Log:
use single array for storing pa_core hook lists, add sink state changed hoo=
k, drop NO_HOOKS flags for sink inputs/source outputs, listen for resume ev=
ents in module-suspend-on-idle.c

Modified:
    branches/lennart/src/modules/module-rescue-streams.c
    branches/lennart/src/modules/module-suspend-on-idle.c
    branches/lennart/src/modules/module-volume-restore.c
    branches/lennart/src/pulsecore/core.c
    branches/lennart/src/pulsecore/core.h
    branches/lennart/src/pulsecore/sink-input.c
    branches/lennart/src/pulsecore/sink-input.h
    branches/lennart/src/pulsecore/sink.c
    branches/lennart/src/pulsecore/source-output.c
    branches/lennart/src/pulsecore/source-output.h
    branches/lennart/src/pulsecore/source.c

Modified: branches/lennart/src/modules/module-rescue-streams.c
URL: http://0pointer.de/cgi-bin/viewcvs.cgi/branches/lennart/src/modules/mo=
dule-rescue-streams.c?rev=3D1640&root=3Dpulseaudio&r1=3D1639&r2=3D1640&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/modules/module-rescue-streams.c (original)
+++ branches/lennart/src/modules/module-rescue-streams.c Sat Aug 11 21:08:0=
6 2007
@@ -138,8 +138,8 @@
     }
 =

     m->userdata =3D u =3D pa_xnew(struct userdata, 1);
-    u->sink_slot =3D pa_hook_connect(&m->core->hook_sink_disconnect, (pa_h=
ook_cb_t) sink_hook_callback, NULL);
-    u->source_slot =3D pa_hook_connect(&m->core->hook_source_disconnect, (=
pa_hook_cb_t) source_hook_callback, NULL);
+    u->sink_slot =3D pa_hook_connect(&m->core->hooks[PA_CORE_HOOK_SINK_DIS=
CONNECT], (pa_hook_cb_t) sink_hook_callback, NULL);
+    u->source_slot =3D pa_hook_connect(&m->core->hooks[PA_CORE_HOOK_SOURCE=
_DISCONNECT], (pa_hook_cb_t) source_hook_callback, NULL);
 =

     pa_modargs_free(ma);
     return 0;

Modified: branches/lennart/src/modules/module-suspend-on-idle.c
URL: http://0pointer.de/cgi-bin/viewcvs.cgi/branches/lennart/src/modules/mo=
dule-suspend-on-idle.c?rev=3D1640&root=3Dpulseaudio&r1=3D1639&r2=3D1640&vie=
w=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/modules/module-suspend-on-idle.c (original)
+++ branches/lennart/src/modules/module-suspend-on-idle.c Sat Aug 11 21:08:=
06 2007
@@ -50,7 +50,7 @@
     pa_core *core;
     pa_usec_t timeout;
     pa_hashmap *device_infos;
-    pa_hook_slot *sink_new_slot, *source_new_slot, *sink_disconnect_slot, =
*source_disconnect_slot;
+    pa_hook_slot *sink_new_slot, *source_new_slot, *sink_disconnect_slot, =
*source_disconnect_slot, *sink_state_changed_slot, *source_state_changed_sl=
ot;
     pa_hook_slot *sink_input_new_slot, *source_output_new_slot, *sink_inpu=
t_disconnect_slot, *source_output_disconnect_slot;
 };
 =

@@ -69,13 +69,13 @@
 =

     d->userdata->core->mainloop->time_restart(d->time_event, NULL);
     =

-    if (d->sink && pa_sink_used_by(d->sink) <=3D 0) {
+    if (d->sink && pa_sink_used_by(d->sink) <=3D 0 && pa_sink_get_state(d-=
>sink) !=3D PA_SINK_SUSPENDED) {
         pa_log_info("Sink %s idle for too long, suspending ...", d->sink->=
name);
         pa_sink_suspend(d->sink, 1);
         pa_source_suspend(d->sink->monitor_source, 1);
     }
 =

-    if (d->source && pa_source_used_by(d->source) <=3D 0) {
+    if (d->source && pa_source_used_by(d->source) <=3D 0 && pa_source_get_=
state(d->source) !=3D PA_SOURCE_SUSPENDED) {
         pa_log_info("Source %s idle for too long, suspending ...", d->sour=
ce->name);
         pa_source_suspend(d->source, 1);
     }
@@ -209,6 +209,40 @@
     return PA_HOOK_OK;
 }
 =

+static pa_hook_result_t device_state_changed_hook_cb(pa_core *c, pa_object=
 *o, struct userdata *u) {
+    struct device_info *d;
+
+    pa_assert(c);
+    pa_object_assert_ref(o);
+    pa_assert(u);
+
+    if (!(d =3D pa_hashmap_get(u->device_infos, o)))
+        return PA_HOOK_OK;
+
+    if (pa_sink_isinstance(o)) {
+        pa_sink *s =3D PA_SINK(o);
+        =

+        if (pa_sink_used_by(s) <=3D 0) {
+            pa_sink_state_t state =3D pa_sink_get_state(s);
+
+            if (state =3D=3D PA_SINK_RUNNING || state =3D=3D PA_SINK_IDLE)
+                restart(d);
+        }
+        =

+    } else if (pa_source_isinstance(o)) {
+        pa_source *s =3D PA_SOURCE(o);
+
+        if (pa_source_used_by(s) <=3D 0) {
+            pa_sink_state_t state =3D pa_source_get_state(s);
+
+            if (state =3D=3D PA_SINK_RUNNING || state =3D=3D PA_SINK_IDLE)
+                restart(d);
+        }
+    }
+            =

+    return PA_HOOK_OK;
+}
+
 int pa__init(pa_module*m) {
     pa_modargs *ma =3D NULL;
     struct userdata *u;
@@ -240,15 +274,17 @@
     for (source =3D pa_idxset_first(m->core->sources, &idx); source; sourc=
e =3D pa_idxset_next(m->core->sources, &idx))
         device_new_hook_cb(m->core, PA_OBJECT(source), u);
 =

-    u->sink_new_slot =3D pa_hook_connect(&m->core->hook_sink_new_post, (pa=
_hook_cb_t) device_new_hook_cb, u);
-    u->source_new_slot =3D pa_hook_connect(&m->core->hook_source_new_post,=
 (pa_hook_cb_t) device_new_hook_cb, u);
-    u->sink_disconnect_slot =3D pa_hook_connect(&m->core->hook_sink_discon=
nect_post, (pa_hook_cb_t) device_disconnect_hook_cb, u);
-    u->source_disconnect_slot =3D pa_hook_connect(&m->core->hook_source_di=
sconnect_post, (pa_hook_cb_t) device_disconnect_hook_cb, u);
-
-    u->sink_input_new_slot =3D pa_hook_connect(&m->core->hook_sink_input_n=
ew_post, (pa_hook_cb_t) sink_input_new_hook_cb, u);
-    u->source_output_new_slot =3D pa_hook_connect(&m->core->hook_source_ou=
tput_new_post, (pa_hook_cb_t) source_output_new_hook_cb, u);
-    u->sink_input_disconnect_slot =3D pa_hook_connect(&m->core->hook_sink_=
input_disconnect_post, (pa_hook_cb_t) sink_input_disconnect_hook_cb, u);
-    u->source_output_disconnect_slot =3D pa_hook_connect(&m->core->hook_so=
urce_output_disconnect_post, (pa_hook_cb_t) source_output_disconnect_hook_c=
b, u);
+    u->sink_new_slot =3D pa_hook_connect(&m->core->hooks[PA_CORE_HOOK_SINK=
_NEW_POST], (pa_hook_cb_t) device_new_hook_cb, u);
+    u->source_new_slot =3D pa_hook_connect(&m->core->hooks[PA_CORE_HOOK_SO=
URCE_NEW_POST], (pa_hook_cb_t) device_new_hook_cb, u);
+    u->sink_disconnect_slot =3D pa_hook_connect(&m->core->hooks[PA_CORE_HO=
OK_SINK_DISCONNECT], (pa_hook_cb_t) device_disconnect_hook_cb, u);
+    u->source_disconnect_slot =3D pa_hook_connect(&m->core->hooks[PA_CORE_=
HOOK_SOURCE_DISCONNECT], (pa_hook_cb_t) device_disconnect_hook_cb, u);
+    u->sink_state_changed_slot =3D pa_hook_connect(&m->core->hooks[PA_CORE=
_HOOK_SINK_STATE_CHANGED], (pa_hook_cb_t) device_state_changed_hook_cb, u);
+    u->source_state_changed_slot =3D pa_hook_connect(&m->core->hooks[PA_CO=
RE_HOOK_SOURCE_STATE_CHANGED], (pa_hook_cb_t) device_state_changed_hook_cb,=
 u);
+
+    u->sink_input_new_slot =3D pa_hook_connect(&m->core->hooks[PA_CORE_HOO=
K_SINK_INPUT_PUT], (pa_hook_cb_t) sink_input_new_hook_cb, u);
+    u->source_output_new_slot =3D pa_hook_connect(&m->core->hooks[PA_CORE_=
HOOK_SOURCE_OUTPUT_PUT], (pa_hook_cb_t) source_output_new_hook_cb, u);
+    u->sink_input_disconnect_slot =3D pa_hook_connect(&m->core->hooks[PA_C=
ORE_HOOK_SINK_INPUT_DISCONNECT_POST], (pa_hook_cb_t) sink_input_disconnect_=
hook_cb, u);
+    u->source_output_disconnect_slot =3D pa_hook_connect(&m->core->hooks[P=
A_CORE_HOOK_SOURCE_OUTPUT_DISCONNECT_POST], (pa_hook_cb_t) source_output_di=
sconnect_hook_cb, u);
     =

     pa_modargs_free(ma);
     return 0;
@@ -276,11 +312,15 @@
         pa_hook_slot_free(u->sink_new_slot);
     if (u->sink_disconnect_slot)
         pa_hook_slot_free(u->sink_disconnect_slot);
+    if (u->sink_state_changed_slot)
+        pa_hook_slot_free(u->sink_state_changed_slot);
 =

     if (u->source_new_slot)
         pa_hook_slot_free(u->source_new_slot);
     if (u->source_disconnect_slot)
         pa_hook_slot_free(u->source_disconnect_slot);
+    if (u->source_state_changed_slot)
+        pa_hook_slot_free(u->source_state_changed_slot);
 =

     if (u->sink_input_new_slot)
         pa_hook_slot_free(u->sink_input_new_slot);

Modified: branches/lennart/src/modules/module-volume-restore.c
URL: http://0pointer.de/cgi-bin/viewcvs.cgi/branches/lennart/src/modules/mo=
dule-volume-restore.c?rev=3D1640&root=3Dpulseaudio&r1=3D1639&r2=3D1640&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/modules/module-volume-restore.c (original)
+++ branches/lennart/src/modules/module-volume-restore.c Sat Aug 11 21:08:0=
6 2007
@@ -444,8 +444,8 @@
         goto fail;
 =

     u->subscription =3D pa_subscription_new(m->core, PA_SUBSCRIPTION_MASK_=
SINK_INPUT|PA_SUBSCRIPTION_MASK_SOURCE_OUTPUT, subscribe_callback, u);
-    u->sink_input_hook_slot =3D pa_hook_connect(&m->core->hook_sink_input_=
new, (pa_hook_cb_t) sink_input_hook_callback, u);
-    u->source_output_hook_slot =3D pa_hook_connect(&m->core->hook_source_o=
utput_new, (pa_hook_cb_t) source_output_hook_callback, u);
+    u->sink_input_hook_slot =3D pa_hook_connect(&m->core->hooks[PA_CORE_HO=
OK_SINK_INPUT_NEW], (pa_hook_cb_t) sink_input_hook_callback, u);
+    u->source_output_hook_slot =3D pa_hook_connect(&m->core->hooks[PA_CORE=
_HOOK_SOURCE_OUTPUT_NEW], (pa_hook_cb_t) source_output_hook_callback, u);
 =

     pa_modargs_free(ma);
     return 0;

Modified: branches/lennart/src/pulsecore/core.c
URL: http://0pointer.de/cgi-bin/viewcvs.cgi/branches/lennart/src/pulsecore/=
core.c?rev=3D1640&root=3Dpulseaudio&r1=3D1639&r2=3D1640&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 Sat Aug 11 21:08:06 2007
@@ -72,7 +72,8 @@
 pa_core* pa_core_new(pa_mainloop_api *m, int shared) {
     pa_core* c;
     pa_mempool *pool;
-
+    int j;
+    =

     pa_assert(m);
 =

     if (shared) {
@@ -138,22 +139,8 @@
 =

     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_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_output_new_post, c);
-    pa_hook_init(&c->hook_source_output_disconnect, c);
-    pa_hook_init(&c->hook_source_output_disconnect_post, c);
+    for (j =3D 0; j < PA_CORE_HOOK_MAX; j++)
+        pa_hook_init(&c->hooks[j], c);
 =

     pa_property_init(c);
 =

@@ -168,6 +155,7 @@
 =

 static void core_free(pa_object *o) {
     pa_core *c =3D PA_CORE(o);
+    int j;
     pa_assert(c);
 =

     pa_module_unload_all(c);
@@ -203,22 +191,8 @@
 =

     pa_property_cleanup(c);
 =

-    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_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_output_new_post);
-    pa_hook_free(&c->hook_source_output_disconnect);
-    pa_hook_free(&c->hook_source_output_disconnect_post);
+    for (j =3D 0; j < PA_CORE_HOOK_MAX; j++)
+        pa_hook_free(&c->hooks[j]);
 =

     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=3D1640&root=3Dpulseaudio&r1=3D1639&r2=3D1640&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 Sat Aug 11 21:08:06 2007
@@ -41,6 +41,26 @@
 #include <pulsecore/core-subscribe.h>
 #include <pulsecore/sink-input.h>
 #include <pulsecore/msgobject.h>
+
+typedef enum pa_core_hook {
+    PA_CORE_HOOK_SINK_NEW_POST,
+    PA_CORE_HOOK_SINK_DISCONNECT,
+    PA_CORE_HOOK_SINK_DISCONNECT_POST,
+    PA_CORE_HOOK_SINK_STATE_CHANGED,
+    PA_CORE_HOOK_SOURCE_NEW_POST,
+    PA_CORE_HOOK_SOURCE_DISCONNECT,
+    PA_CORE_HOOK_SOURCE_DISCONNECT_POST,
+    PA_CORE_HOOK_SOURCE_STATE_CHANGED,
+    PA_CORE_HOOK_SINK_INPUT_NEW,
+    PA_CORE_HOOK_SINK_INPUT_PUT,
+    PA_CORE_HOOK_SINK_INPUT_DISCONNECT,
+    PA_CORE_HOOK_SINK_INPUT_DISCONNECT_POST,
+    PA_CORE_HOOK_SOURCE_OUTPUT_NEW,
+    PA_CORE_HOOK_SOURCE_OUTPUT_PUT,
+    PA_CORE_HOOK_SOURCE_OUTPUT_DISCONNECT,
+    PA_CORE_HOOK_SOURCE_OUTPUT_DISCONNECT_POST,
+    PA_CORE_HOOK_MAX
+} pa_core_hook_t;
 =

 /* The core structure of PulseAudio. Every PulseAudio daemon contains
  * exactly one of these. It is used for storing kind of global
@@ -89,23 +109,7 @@
     int is_system_instance;
 =

     /* 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_input_new_post,
-        hook_sink_input_disconnect,
-        hook_sink_input_disconnect_post,
-        hook_source_output_new,
-        hook_source_output_new_post,
-        hook_source_output_disconnect,
-        hook_source_output_disconnect_post;
+    pa_hook hooks[PA_CORE_HOOK_MAX];
 };
 =

 PA_DECLARE_CLASS(pa_core);

Modified: branches/lennart/src/pulsecore/sink-input.c
URL: http://0pointer.de/cgi-bin/viewcvs.cgi/branches/lennart/src/pulsecore/=
sink-input.c?rev=3D1640&root=3Dpulseaudio&r1=3D1639&r2=3D1640&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 Sat Aug 11 21:08:06 2007
@@ -98,9 +98,8 @@
     pa_assert(core);
     pa_assert(data);
 =

-    if (!(flags & PA_SINK_INPUT_NO_HOOKS))
-        if (pa_hook_fire(&core->hook_sink_input_new, data) < 0)
-            return NULL;
+    if (pa_hook_fire(&core->hooks[PA_CORE_HOOK_SINK_INPUT_NEW], data) < 0)
+        return NULL;
 =

     pa_return_null_if_fail(!data->driver || pa_utf8_valid(data->driver));
     pa_return_null_if_fail(!data->name || pa_utf8_valid(data->name));
@@ -249,7 +248,7 @@
     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);
+    pa_hook_fire(&i->sink->core->hooks[PA_CORE_HOOK_SINK_INPUT_DISCONNECT]=
, i);
     =

     if (i->sync_prev)
         i->sync_prev->sync_next =3D i->sync_next;
@@ -273,7 +272,7 @@
     i->get_latency =3D NULL;
     i->underrun =3D NULL;
 =

-    pa_hook_fire(&i->sink->core->hook_sink_input_disconnect_post, i);
+    pa_hook_fire(&i->sink->core->hooks[PA_CORE_HOOK_SINK_INPUT_DISCONNECT_=
POST], i);
     i->sink =3D NULL;
     pa_sink_input_unref(i);
 }
@@ -313,7 +312,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);
+    pa_hook_fire(&i->sink->core->hooks[PA_CORE_HOOK_SINK_INPUT_PUT], i);
 }
 =

 void pa_sink_input_kill(pa_sink_input*i) {

Modified: branches/lennart/src/pulsecore/sink-input.h
URL: http://0pointer.de/cgi-bin/viewcvs.cgi/branches/lennart/src/pulsecore/=
sink-input.h?rev=3D1640&root=3Dpulseaudio&r1=3D1639&r2=3D1640&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.h (original)
+++ branches/lennart/src/pulsecore/sink-input.h Sat Aug 11 21:08:06 2007
@@ -47,7 +47,6 @@
 =

 typedef enum pa_sink_input_flags {
     PA_SINK_INPUT_VARIABLE_RATE =3D 1,
-    PA_SINK_INPUT_NO_HOOKS =3D 2
 } pa_sink_input_flags_t;
 =

 struct pa_sink_input {

Modified: branches/lennart/src/pulsecore/sink.c
URL: http://0pointer.de/cgi-bin/viewcvs.cgi/branches/lennart/src/pulsecore/=
sink.c?rev=3D1640&root=3Dpulseaudio&r1=3D1639&r2=3D1640&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 Sat Aug 11 21:08:06 2007
@@ -80,9 +80,6 @@
     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))) {
@@ -149,7 +146,7 @@
 =

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

-    pa_hook_fire(&core->hook_sink_new_post, s);
+    pa_hook_fire(&core->hooks[PA_CORE_HOOK_SINK_NEW_POST], s);
 =

     return s;
 }
@@ -170,6 +167,8 @@
         return -1;
 =

     s->state =3D state;
+    =

+    pa_hook_fire(&s->core->hooks[PA_CORE_HOOK_SINK_STATE_CHANGED], s);
     return 0;
 }
 =

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

-    pa_hook_fire(&s->core->hook_sink_disconnect, s);
+    pa_hook_fire(&s->core->hooks[PA_CORE_HOOK_SINK_DISCONNECT], s);
     =

     pa_namereg_unregister(s->core, s->name);
     pa_idxset_remove_by_data(s->core->sinks, s, NULL);
@@ -204,7 +203,7 @@
 =

     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);
+    pa_hook_fire(&s->core->hooks[PA_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=3D1640&root=3Dpulseaudio&r1=3D1639&r2=3D1640&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 Sat Aug 11 21:08:06 2007
@@ -76,9 +76,8 @@
     pa_assert(core);
     pa_assert(data);
 =

-    if (!(flags & PA_SOURCE_OUTPUT_NO_HOOKS))
-        if (pa_hook_fire(&core->hook_source_output_new, data) < 0)
-            return NULL;
+    if (pa_hook_fire(&core->hooks[PA_CORE_HOOK_SOURCE_OUTPUT_NEW], data) <=
 0)
+        return NULL;
 =

     pa_return_null_if_fail(!data->driver || pa_utf8_valid(data->driver));
     pa_return_null_if_fail(!data->name || pa_utf8_valid(data->name));
@@ -187,7 +186,7 @@
     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_hook_fire(&o->source->core->hooks[PA_CORE_HOOK_SOURCE_OUTPUT_DISCON=
NECT], o);
     =

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

@@ -203,7 +202,7 @@
     o->kill =3D NULL;
     o->get_latency =3D NULL;
 =

-    pa_hook_fire(&o->source->core->hook_source_output_disconnect_post, o);
+    pa_hook_fire(&o->source->core->hooks[PA_CORE_HOOK_SOURCE_OUTPUT_DISCON=
NECT_POST], o);
 =

     o->source =3D NULL;
     pa_source_output_unref(o);
@@ -235,7 +234,7 @@
 =

     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);
+    pa_hook_fire(&o->source->core->hooks[PA_CORE_HOOK_SOURCE_OUTPUT_PUT], =
o);
 }
 =

 void pa_source_output_kill(pa_source_output*o) {

Modified: branches/lennart/src/pulsecore/source-output.h
URL: http://0pointer.de/cgi-bin/viewcvs.cgi/branches/lennart/src/pulsecore/=
source-output.h?rev=3D1640&root=3Dpulseaudio&r1=3D1639&r2=3D1640&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.h (original)
+++ branches/lennart/src/pulsecore/source-output.h Sat Aug 11 21:08:06 2007
@@ -42,8 +42,7 @@
 } pa_source_output_state_t;
 =

 typedef enum pa_source_output_flags {
-    PA_SOURCE_OUTPUT_NO_HOOKS =3D 1,
-    PA_SOURCE_OUTPUT_VARIABLE_RATE =3D 2
+    PA_SOURCE_OUTPUT_VARIABLE_RATE =3D 1
 } pa_source_output_flags_t;
 =

 struct pa_source_output {

Modified: branches/lennart/src/pulsecore/source.c
URL: http://0pointer.de/cgi-bin/viewcvs.cgi/branches/lennart/src/pulsecore/=
source.c?rev=3D1640&root=3Dpulseaudio&r1=3D1639&r2=3D1640&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 Sat Aug 11 21:08:06 2007
@@ -73,9 +73,6 @@
     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))) {
@@ -128,7 +125,7 @@
 =

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

-    pa_hook_fire(&core->hook_source_new_post, s);
+    pa_hook_fire(&core->hooks[PA_CORE_HOOK_SOURCE_NEW_POST], s);
     =

     return s;
 }
@@ -149,6 +146,7 @@
         return -1;
 =

     s->state =3D state;
+    pa_hook_fire(&s->core->hooks[PA_CORE_HOOK_SOURCE_STATE_CHANGED], s);
     return 0;
 }
 =

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

-    pa_hook_fire(&s->core->hook_source_disconnect, s);
+    pa_hook_fire(&s->core->hooks[PA_CORE_HOOK_SOURCE_DISCONNECT], s);    =

 =

     pa_namereg_unregister(s->core, s->name);
     pa_idxset_remove_by_data(s->core->sources, s, NULL);
@@ -180,7 +178,7 @@
 =

     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);
+    pa_hook_fire(&s->core->hooks[PA_CORE_HOOK_SOURCE_DISCONNECT_POST], s);=
    =

 }
 =

 static void source_free(pa_object *o) {




More information about the pulseaudio-commits mailing list