From 9f97b7cbe13b3a4f0fefd8588a3dec95f0d14e58 Mon Sep 17 00:00:00 2001 From: Lennart Poettering Date: Fri, 21 Aug 2009 02:56:17 +0200 Subject: sink-input: add callbacks that are called whenever the mute/volume changes --- src/pulsecore/sink.c | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) (limited to 'src/pulsecore/sink.c') diff --git a/src/pulsecore/sink.c b/src/pulsecore/sink.c index 1cce8e6b..fab88755 100644 --- a/src/pulsecore/sink.c +++ b/src/pulsecore/sink.c @@ -1380,9 +1380,14 @@ static void propagate_reference_volume(pa_sink *s) { pa_cvolume_remap(&remapped, &s->channel_map, &i->channel_map); pa_sw_cvolume_multiply(&i->volume, &remapped, &i->reference_ratio); - /* The reference volume changed, let's tell people so */ - if (!pa_cvolume_equal(&old_volume, &i->volume)) + /* The volume changed, let's tell people so */ + if (!pa_cvolume_equal(&old_volume, &i->volume)) { + + if (i->volume_changed) + i->volume_changed(i); + pa_subscription_post(i->core, PA_SUBSCRIPTION_EVENT_SINK_INPUT|PA_SUBSCRIPTION_EVENT_CHANGE, i->index); + } } } @@ -1522,8 +1527,13 @@ static void propagate_real_volume(pa_sink *s, const pa_cvolume *old_real_volume) pa_sw_cvolume_multiply(&i->volume, &remapped, &i->reference_ratio); /* Notify if something changed */ - if (!pa_cvolume_equal(&old_volume, &i->volume)) + if (!pa_cvolume_equal(&old_volume, &i->volume)) { + + if (i->volume_changed) + i->volume_changed(i); + pa_subscription_post(i->core, PA_SUBSCRIPTION_EVENT_SINK_INPUT|PA_SUBSCRIPTION_EVENT_CHANGE, i->index); + } } } -- cgit From 9abc010c930999eed67253f5b83f7c226b1a17f6 Mon Sep 17 00:00:00 2001 From: Lennart Poettering Date: Fri, 21 Aug 2009 21:27:44 +0200 Subject: object: speed up type verification by not relying on strcmp() Instead of using string contents for type identification use the address of a constant string array. This should speed up type verifications a little sind we only need to compare one machine word instead of a full string. Also, this saves a few strings. To make clear that types must be compared via address and not string contents 'type_name' is now called 'type_id'. This also simplifies the macros for declaring and defining public and private subclasses. --- src/pulsecore/sink.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/pulsecore/sink.c') diff --git a/src/pulsecore/sink.c b/src/pulsecore/sink.c index fab88755..5cec7747 100644 --- a/src/pulsecore/sink.c +++ b/src/pulsecore/sink.c @@ -52,7 +52,7 @@ #define ABSOLUTE_MAX_LATENCY (10*PA_USEC_PER_SEC) #define DEFAULT_FIXED_LATENCY (250*PA_USEC_PER_MSEC) -static PA_DEFINE_CHECK_TYPE(pa_sink, pa_msgobject); +PA_DEFINE_PUBLIC_CLASS(pa_sink, pa_msgobject); static void sink_free(pa_object *s); -- cgit