diff --git a/gvc-mixer-control.c b/gvc-mixer-control.c index b6f6a39..9caa31b 100644 --- a/gvc-mixer-control.c +++ b/gvc-mixer-control.c @@ -1494,6 +1494,7 @@ update_sink (GvcMixerControl *control, gvc_mixer_stream_set_card_index (stream, info->card); gvc_mixer_stream_set_description (stream, info->description); set_icon_name_from_proplist (stream, info->proplist, "audio-card"); + gvc_mixer_stream_set_form_factor (stream, pa_proplist_gets (info->proplist, PA_PROP_DEVICE_FORM_FACTOR)); gvc_mixer_stream_set_sysfs_path (stream, pa_proplist_gets (info->proplist, "sysfs.path")); gvc_mixer_stream_set_volume (stream, (guint)max_volume); gvc_mixer_stream_set_is_muted (stream, info->mute); @@ -1620,6 +1621,7 @@ update_source (GvcMixerControl *control, gvc_mixer_stream_set_card_index (stream, info->card); gvc_mixer_stream_set_description (stream, info->description); set_icon_name_from_proplist (stream, info->proplist, "audio-input-microphone"); + gvc_mixer_stream_set_form_factor (stream, pa_proplist_gets (info->proplist, PA_PROP_DEVICE_FORM_FACTOR)); gvc_mixer_stream_set_volume (stream, (guint)max_volume); gvc_mixer_stream_set_is_muted (stream, info->mute); gvc_mixer_stream_set_can_decibel (stream, !!(info->flags & PA_SOURCE_DECIBEL_VOLUME)); diff --git a/gvc-mixer-stream.c b/gvc-mixer-stream.c index d3e01b6..59e7b1f 100644 --- a/gvc-mixer-stream.c +++ b/gvc-mixer-stream.c @@ -48,6 +48,7 @@ struct GvcMixerStreamPrivate char *description; char *application_id; char *icon_name; + char *form_factor; char *sysfs_path; gboolean is_muted; gboolean can_decibel; @@ -71,6 +72,7 @@ enum PROP_DESCRIPTION, PROP_APPLICATION_ID, PROP_ICON_NAME, + PROP_FORM_FACTOR, PROP_SYSFS_PATH, PROP_VOLUME, PROP_DECIBEL, @@ -414,6 +416,13 @@ gvc_mixer_stream_get_icon_name (GvcMixerStream *stream) return stream->priv->icon_name; } +const char * +gvc_mixer_stream_get_form_factor (GvcMixerStream *stream) +{ + g_return_val_if_fail (GVC_IS_MIXER_STREAM (stream), NULL); + return stream->priv->form_factor; +} + const char * gvc_mixer_stream_get_sysfs_path (GvcMixerStream *stream) { @@ -449,6 +458,19 @@ gvc_mixer_stream_set_icon_name (GvcMixerStream *stream, return TRUE; } +gboolean +gvc_mixer_stream_set_form_factor (GvcMixerStream *stream, + const char *form_factor) +{ + g_return_val_if_fail (GVC_IS_MIXER_STREAM (stream), FALSE); + + g_free (stream->priv->form_factor); + stream->priv->form_factor = g_strdup (form_factor); + g_object_notify (G_OBJECT (stream), "form-factor"); + + return TRUE; +} + gboolean gvc_mixer_stream_set_sysfs_path (GvcMixerStream *stream, const char *sysfs_path) @@ -641,6 +663,9 @@ gvc_mixer_stream_set_property (GObject *object, case PROP_ICON_NAME: gvc_mixer_stream_set_icon_name (self, g_value_get_string (value)); break; + case PROP_FORM_FACTOR: + gvc_mixer_stream_set_form_factor (self, g_value_get_string (value)); + break; case PROP_SYSFS_PATH: gvc_mixer_stream_set_sysfs_path (self, g_value_get_string (value)); break; @@ -707,6 +732,9 @@ gvc_mixer_stream_get_property (GObject *object, case PROP_ICON_NAME: g_value_set_string (value, self->priv->icon_name); break; + case PROP_FORM_FACTOR: + g_value_set_string (value, self->priv->form_factor); + break; case PROP_SYSFS_PATH: g_value_set_string (value, self->priv->sysfs_path); break; @@ -911,6 +939,13 @@ gvc_mixer_stream_class_init (GvcMixerStreamClass *klass) "Name of icon to display for this stream", NULL, G_PARAM_READWRITE|G_PARAM_CONSTRUCT)); + g_object_class_install_property (gobject_class, + PROP_FORM_FACTOR, + g_param_spec_string ("form-factor", + "Form Factor", + "Device form factor for this stream, as reported by PulseAudio", + NULL, + G_PARAM_READWRITE|G_PARAM_CONSTRUCT)); g_object_class_install_property (gobject_class, PROP_SYSFS_PATH, g_param_spec_string ("sysfs-path", @@ -996,6 +1031,9 @@ gvc_mixer_stream_finalize (GObject *object) g_free (mixer_stream->priv->icon_name); mixer_stream->priv->icon_name = NULL; + g_free (mixer_stream->priv->form_factor); + mixer_stream->priv->form_factor = NULL; + g_free (mixer_stream->priv->sysfs_path); mixer_stream->priv->sysfs_path = NULL; diff --git a/gvc-mixer-stream.h b/gvc-mixer-stream.h index 435f933..fefb1c8 100644 --- a/gvc-mixer-stream.h +++ b/gvc-mixer-stream.h @@ -87,6 +87,7 @@ gboolean gvc_mixer_stream_change_is_muted (GvcMixerStream *stream, gboolean gvc_mixer_stream_is_running (GvcMixerStream *stream); const char * gvc_mixer_stream_get_name (GvcMixerStream *stream); const char * gvc_mixer_stream_get_icon_name (GvcMixerStream *stream); +const char * gvc_mixer_stream_get_form_factor (GvcMixerStream *stream); const char * gvc_mixer_stream_get_sysfs_path (GvcMixerStream *stream); GIcon * gvc_mixer_stream_get_gicon (GvcMixerStream *stream); const char * gvc_mixer_stream_get_description (GvcMixerStream *stream); @@ -110,6 +111,8 @@ gboolean gvc_mixer_stream_set_description (GvcMixerStream *stream, const char *description); gboolean gvc_mixer_stream_set_icon_name (GvcMixerStream *stream, const char *name); +gboolean gvc_mixer_stream_set_form_factor (GvcMixerStream *stream, + const char *form_factor); gboolean gvc_mixer_stream_set_sysfs_path (GvcMixerStream *stream, const char *sysfs_path); gboolean gvc_mixer_stream_set_is_event_stream (GvcMixerStream *stream,