diff options
author | Carlos Silva <r3pek@r3pek.org> | 2016-01-10 02:38:59 +0000 |
---|---|---|
committer | Bastien Nocera <hadess@hadess.net> | 2016-01-12 01:31:56 +0100 |
commit | d4eda71c49bb458eda7cf9d22d47002b8528552c (patch) | |
tree | 9bbd12322de63ee9e37844791cb898c5396de888 /gvc-mixer-source-output.c | |
parent | 7e5504db3d85b7a4b5dc0207c47af09b426ad75a (diff) | |
download | libgnome-volume-control-d4eda71c49bb458eda7cf9d22d47002b8528552c.tar.gz |
gvc-mixer-source-output: Update volume and mute status
This commit implements notifying about volume and mute status changes
for source outputs (applications that monitor the microphone, in short).
https://bugzilla.gnome.org/show_bug.cgi?id=760387
Diffstat (limited to 'gvc-mixer-source-output.c')
-rw-r--r-- | gvc-mixer-source-output.c | 52 |
1 files changed, 49 insertions, 3 deletions
diff --git a/gvc-mixer-source-output.c b/gvc-mixer-source-output.c index dc856d0..664bb94 100644 --- a/gvc-mixer-source-output.c +++ b/gvc-mixer-source-output.c @@ -30,6 +30,8 @@ #include <pulse/pulseaudio.h> #include "gvc-mixer-source-output.h" +#include "gvc-mixer-stream-private.h" +#include "gvc-channel-map-private.h" #define GVC_MIXER_SOURCE_OUTPUT_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), GVC_TYPE_MIXER_SOURCE_OUTPUT, GvcMixerSourceOutputPrivate)) @@ -45,8 +47,33 @@ G_DEFINE_TYPE (GvcMixerSourceOutput, gvc_mixer_source_output, GVC_TYPE_MIXER_STR static gboolean gvc_mixer_source_output_push_volume (GvcMixerStream *stream, gpointer *op) { - /* FIXME: */ - *op = NULL; + pa_operation *o; + guint index; + const GvcChannelMap *map; + pa_context *context; + const pa_cvolume *cv; + + index = gvc_mixer_stream_get_index (stream); + + map = gvc_mixer_stream_get_channel_map (stream); + + cv = gvc_channel_map_get_cvolume(map); + + context = gvc_mixer_stream_get_pa_context (stream); + + o = pa_context_set_source_output_volume (context, + index, + cv, + NULL, + NULL); + + if (o == NULL) { + g_warning ("pa_context_set_source_output_volume() failed"); + return FALSE; + } + + *op = o; + return TRUE; } @@ -54,7 +81,26 @@ static gboolean gvc_mixer_source_output_change_is_muted (GvcMixerStream *stream, gboolean is_muted) { - /* FIXME: */ + pa_operation *o; + guint index; + pa_context *context; + + index = gvc_mixer_stream_get_index (stream); + context = gvc_mixer_stream_get_pa_context (stream); + + o = pa_context_set_source_output_mute (context, + index, + is_muted, + NULL, + NULL); + + if (o == NULL) { + g_warning ("pa_context_set_source_output_mute_by_index() failed"); + return FALSE; + } + + pa_operation_unref(o); + return TRUE; } |