From 6856359f7cb8544bd51a141fea9eeab28e6d1b25 Mon Sep 17 00:00:00 2001 From: Conor Curran Date: Thu, 24 Mar 2011 13:09:54 +0000 Subject: the beginnings of general source monitoring --- src/pulseaudio-mgr.c | 32 +++++++++++++++++++++++++++++--- 1 file changed, 29 insertions(+), 3 deletions(-) (limited to 'src/pulseaudio-mgr.c') diff --git a/src/pulseaudio-mgr.c b/src/pulseaudio-mgr.c index 95f4c06..2ead17c 100644 --- a/src/pulseaudio-mgr.c +++ b/src/pulseaudio-mgr.c @@ -76,7 +76,10 @@ static void pm_toggle_mute_for_every_sink_callback (pa_context *c, const pa_sink_info *sink, int eol, void* userdata); - +static void pm_source_output_info_callback (pa_context *c, + const pa_source_output_info *info, + int eol, + void *userdata); static gboolean reconnect_to_pulse (gpointer user_data); @@ -257,7 +260,6 @@ pm_subscribed_events_callback (pa_context *c, } break; case PA_SUBSCRIPTION_EVENT_SINK_INPUT: - // We don't care about sink input removals. g_debug ("sink input event"); if ((t & PA_SUBSCRIPTION_EVENT_TYPE_MASK) == PA_SUBSCRIPTION_EVENT_REMOVE) { gint cached_index = device_get_current_sink_input_index (sink); @@ -270,12 +272,26 @@ pm_subscribed_events_callback (pa_context *c, } else if ((t & PA_SUBSCRIPTION_EVENT_TYPE_MASK) == PA_SUBSCRIPTION_EVENT_NEW) { g_debug ("some new sink input event ? - index = %i", index); - // Determine if its a VOIP app or a maybe blocking state. + // Maybe blocking state ?. pa_operation_unref (pa_context_get_sink_input_info (c, index, pm_sink_input_info_callback, userdata)); } break; + case PA_SUBSCRIPTION_EVENT_SOURCE_OUTPUT: + g_debug ("source output event"); + if ((t & PA_SUBSCRIPTION_EVENT_TYPE_MASK) == PA_SUBSCRIPTION_EVENT_REMOVE) { + //gint cached_index = device_get_current_sink_input_index (sink); + //g_debug ("Just saw a sink input removal event - index = %i and cached index = %i", index, cached_index); + } + else if ((t & PA_SUBSCRIPTION_EVENT_TYPE_MASK) == PA_SUBSCRIPTION_EVENT_NEW) { + g_debug ("some new source output event ? - index = %i", index); + // Determine if its a VOIP app. + pa_operation_unref (pa_context_get_source_output_info (c, + index, + pm_source_output_info_callback, userdata)); + } + break; case PA_SUBSCRIPTION_EVENT_SERVER: g_debug("PA_SUBSCRIPTION_EVENT_SERVER event triggered."); pa_operation *o; @@ -333,6 +349,7 @@ pm_context_state_callback (pa_context *c, void *userdata) (PA_SUBSCRIPTION_MASK_SINK| PA_SUBSCRIPTION_MASK_SOURCE| PA_SUBSCRIPTION_MASK_SINK_INPUT| + PA_SUBSCRIPTION_MASK_SOURCE_OUTPUT| PA_SUBSCRIPTION_MASK_SERVER), NULL, NULL))) { g_warning("pa_context_subscribe() failed"); @@ -500,6 +517,15 @@ pm_sink_input_info_callback (pa_context *c, } } +static void +pm_source_output_info_callback (pa_context *c, + const pa_source_output_info *info, + int eol, + void *userdata) +{ + +} + static void pm_update_device (pa_context *c, const pa_sink_info *info, -- cgit v1.2.3