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

svnmailer-noreply at 0pointer.de svnmailer-noreply at 0pointer.de
Mon Sep 24 14:47:23 PDT 2007


Author: lennart
Date: Mon Sep 24 23:47:22 2007
New Revision: 1897

URL: http://0pointer.de/cgi-bin/viewcvs.cgi?rev=1897&root=pulseaudio&view=rev
Log:
add hooks for name/description changes of sinks/source and streams

Modified:
    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.h
URL: http://0pointer.de/cgi-bin/viewcvs.cgi/branches/lennart/src/pulsecore/core.h?rev=1897&root=pulseaudio&r1=1896&r2=1897&view=diff
==============================================================================
--- branches/lennart/src/pulsecore/core.h (original)
+++ branches/lennart/src/pulsecore/core.h Mon Sep 24 23:47:22 2007
@@ -47,22 +47,26 @@
     PA_CORE_HOOK_SINK_UNLINK,
     PA_CORE_HOOK_SINK_UNLINK_POST,
     PA_CORE_HOOK_SINK_STATE_CHANGED,
+    PA_CORE_HOOK_SINK_DESCRIPTION_CHANGED,
     PA_CORE_HOOK_SOURCE_NEW_POST,
     PA_CORE_HOOK_SOURCE_UNLINK,
     PA_CORE_HOOK_SOURCE_UNLINK_POST,
     PA_CORE_HOOK_SOURCE_STATE_CHANGED,
+    PA_CORE_HOOK_SOURCE_DESCRIPTION_CHANGED,
     PA_CORE_HOOK_SINK_INPUT_NEW,
     PA_CORE_HOOK_SINK_INPUT_PUT,
     PA_CORE_HOOK_SINK_INPUT_UNLINK,
     PA_CORE_HOOK_SINK_INPUT_UNLINK_POST,
     PA_CORE_HOOK_SINK_INPUT_MOVE,
     PA_CORE_HOOK_SINK_INPUT_MOVE_POST,
+    PA_CORE_HOOK_SINK_INPUT_NAME_CHANGED,
     PA_CORE_HOOK_SOURCE_OUTPUT_NEW,
     PA_CORE_HOOK_SOURCE_OUTPUT_PUT,
     PA_CORE_HOOK_SOURCE_OUTPUT_UNLINK,
     PA_CORE_HOOK_SOURCE_OUTPUT_UNLINK_POST,
     PA_CORE_HOOK_SOURCE_OUTPUT_MOVE,
     PA_CORE_HOOK_SOURCE_OUTPUT_MOVE_POST,
+    PA_CORE_HOOK_SOURCE_OUTPUT_NAME_CHANGED,
     PA_CORE_HOOK_MAX
 } pa_core_hook_t;
 
@@ -90,7 +94,7 @@
 
     pa_sample_spec default_sample_spec;
     unsigned default_n_fragments, default_fragment_size_msec;
-    
+
     pa_time_event *module_auto_unload_event;
     pa_defer_event *module_defer_unload_event;
 
@@ -110,7 +114,7 @@
     int disallow_module_loading, running_as_daemon;
     pa_resample_method_t resample_method;
     int is_system_instance;
-    int high_priority; 
+    int high_priority;
 
     /* hooks */
     pa_hook hooks[PA_CORE_HOOK_MAX];

Modified: branches/lennart/src/pulsecore/sink-input.c
URL: http://0pointer.de/cgi-bin/viewcvs.cgi/branches/lennart/src/pulsecore/sink-input.c?rev=1897&root=pulseaudio&r1=1896&r2=1897&view=diff
==============================================================================
--- branches/lennart/src/pulsecore/sink-input.c (original)
+++ branches/lennart/src/pulsecore/sink-input.c Mon Sep 24 23:47:22 2007
@@ -683,7 +683,10 @@
     pa_xfree(i->name);
     i->name = pa_xstrdup(name);
 
-    pa_subscription_post(i->sink->core, PA_SUBSCRIPTION_EVENT_SINK_INPUT|PA_SUBSCRIPTION_EVENT_CHANGE, i->index);
+    if (PA_SINK_INPUT_LINKED(i->state)) {
+        pa_hook_fire(&i->sink->core->hooks[PA_CORE_HOOK_SINK_INPUT_NAME_CHANGED], i);
+        pa_subscription_post(i->sink->core, PA_SUBSCRIPTION_EVENT_SINK_INPUT|PA_SUBSCRIPTION_EVENT_CHANGE, i->index);
+    }
 }
 
 pa_resample_method_t pa_sink_input_get_resample_method(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=1897&root=pulseaudio&r1=1896&r2=1897&view=diff
==============================================================================
--- branches/lennart/src/pulsecore/sink.c (original)
+++ branches/lennart/src/pulsecore/sink.c Mon Sep 24 23:47:22 2007
@@ -764,7 +764,10 @@
         pa_xfree(n);
     }
 
-    pa_subscription_post(s->core, PA_SUBSCRIPTION_EVENT_SINK|PA_SUBSCRIPTION_EVENT_CHANGE, s->index);
+    if (PA_SINK_LINKED(s->state)) {
+        pa_subscription_post(s->core, PA_SUBSCRIPTION_EVENT_SINK|PA_SUBSCRIPTION_EVENT_CHANGE, s->index);
+        pa_hook_fire(&s->core->hooks[PA_CORE_HOOK_SINK_DESCRIPTION_CHANGED], s);
+    }
 }
 
 unsigned pa_sink_linked_by(pa_sink *s) {

Modified: branches/lennart/src/pulsecore/source-output.c
URL: http://0pointer.de/cgi-bin/viewcvs.cgi/branches/lennart/src/pulsecore/source-output.c?rev=1897&root=pulseaudio&r1=1896&r2=1897&view=diff
==============================================================================
--- branches/lennart/src/pulsecore/source-output.c (original)
+++ branches/lennart/src/pulsecore/source-output.c Mon Sep 24 23:47:22 2007
@@ -356,7 +356,10 @@
     pa_xfree(o->name);
     o->name = pa_xstrdup(name);
 
-    pa_subscription_post(o->source->core, PA_SUBSCRIPTION_EVENT_SOURCE_OUTPUT|PA_SUBSCRIPTION_EVENT_CHANGE, o->index);
+    if (PA_SOURCE_OUTPUT_LINKED(o->state)) {
+        pa_hook_fire(&o->source->core->hooks[PA_CORE_HOOK_SOURCE_OUTPUT_NAME_CHANGED], o);
+        pa_subscription_post(o->source->core, PA_SUBSCRIPTION_EVENT_SOURCE_OUTPUT|PA_SUBSCRIPTION_EVENT_CHANGE, o->index);
+    }
 }
 
 pa_resample_method_t pa_source_output_get_resample_method(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=1897&root=pulseaudio&r1=1896&r2=1897&view=diff
==============================================================================
--- branches/lennart/src/pulsecore/source.c (original)
+++ branches/lennart/src/pulsecore/source.c Mon Sep 24 23:47:22 2007
@@ -418,7 +418,10 @@
     pa_xfree(s->description);
     s->description = pa_xstrdup(description);
 
-    pa_subscription_post(s->core, PA_SUBSCRIPTION_EVENT_SOURCE|PA_SUBSCRIPTION_EVENT_CHANGE, s->index);
+    if (PA_SOURCE_LINKED(s->state)) {
+        pa_hook_fire(&s->core->hooks[PA_CORE_HOOK_SOURCE_DESCRIPTION_CHANGED], s);
+        pa_subscription_post(s->core, PA_SUBSCRIPTION_EVENT_SOURCE|PA_SUBSCRIPTION_EVENT_CHANGE, s->index);
+    }
 }
 
 void pa_source_set_asyncmsgq(pa_source *s, pa_asyncmsgq *q) {




More information about the pulseaudio-commits mailing list