summaryrefslogtreecommitdiff
path: root/plugins/media-keys
diff options
context:
space:
mode:
Diffstat (limited to 'plugins/media-keys')
-rw-r--r--plugins/media-keys/cut-n-paste/gvc-channel-map.c67
-rw-r--r--plugins/media-keys/cut-n-paste/gvc-channel-map.h16
-rw-r--r--plugins/media-keys/cut-n-paste/gvc-mixer-card.c27
-rw-r--r--plugins/media-keys/cut-n-paste/gvc-mixer-card.h1
-rw-r--r--plugins/media-keys/cut-n-paste/gvc-mixer-control.c33
-rw-r--r--plugins/media-keys/cut-n-paste/gvc-mixer-event-role.c8
-rw-r--r--plugins/media-keys/cut-n-paste/gvc-mixer-sink-input.c14
-rw-r--r--plugins/media-keys/cut-n-paste/gvc-mixer-sink.c14
-rw-r--r--plugins/media-keys/cut-n-paste/gvc-mixer-source-output.c2
-rw-r--r--plugins/media-keys/cut-n-paste/gvc-mixer-source.c14
-rw-r--r--plugins/media-keys/cut-n-paste/gvc-mixer-stream.c43
-rw-r--r--plugins/media-keys/cut-n-paste/gvc-mixer-stream.h7
-rw-r--r--plugins/media-keys/msd-media-keys-plugin.c6
13 files changed, 143 insertions, 109 deletions
diff --git a/plugins/media-keys/cut-n-paste/gvc-channel-map.c b/plugins/media-keys/cut-n-paste/gvc-channel-map.c
index 6748d57..e35e793 100644
--- a/plugins/media-keys/cut-n-paste/gvc-channel-map.c
+++ b/plugins/media-keys/cut-n-paste/gvc-channel-map.c
@@ -25,7 +25,7 @@
#include <unistd.h>
#include <glib.h>
-#include <glib/gi18n.h>
+#include <glib/gi18n-lib.h>
#include <pulse/pulseaudio.h>
@@ -33,14 +33,6 @@
#define GVC_CHANNEL_MAP_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), GVC_TYPE_CHANNEL_MAP, GvcChannelMapPrivate))
-#ifndef PA_CHECK_VERSION
-#define PA_CHECK_VERSION(major,minor,micro) \
- ((PA_MAJOR > (major)) || \
- (PA_MAJOR == (major) && PA_MINOR > (minor)) || \
- (PA_MAJOR == (major) && PA_MINOR == (minor) && PA_MICRO >= (micro)))
-#endif
-
-
struct GvcChannelMapPrivate
{
pa_channel_map pa_map;
@@ -49,7 +41,6 @@ struct GvcChannelMapPrivate
gdouble extern_volume[NUM_TYPES]; /* volume, balance, fade, lfe */
gboolean can_balance;
gboolean can_fade;
- gboolean has_lfe;
};
enum {
@@ -65,46 +56,8 @@ static void gvc_channel_map_finalize (GObject *object);
G_DEFINE_TYPE (GvcChannelMap, gvc_channel_map, G_TYPE_OBJECT)
-/* FIXME remove when we depend on a newer PA */
-static int
-gvc_pa_channel_map_has_position (const pa_channel_map *map, pa_channel_position_t p) {
- unsigned c;
-
- g_return_val_if_fail(pa_channel_map_valid(map), 0);
- g_return_val_if_fail(p < PA_CHANNEL_POSITION_MAX, 0);
-
- for (c = 0; c < map->channels; c++)
- if (map->map[c] == p)
- return 1;
-
- return 0;
-}
-
-#if !PA_CHECK_VERSION(0,9,16)
-/* The PulseAudio master increase version only when tagged, so let's avoid clashing with pa_ namespace */
-#define pa_cvolume_get_position gvc_cvolume_get_position
-static pa_volume_t
-gvc_cvolume_get_position (pa_cvolume *cv, const pa_channel_map *map, pa_channel_position_t t) {
- unsigned c;
- pa_volume_t v = PA_VOLUME_MUTED;
-
- g_assert(cv);
- g_assert(map);
-
- g_return_val_if_fail(pa_cvolume_compatible_with_channel_map(cv, map), PA_VOLUME_MUTED);
- g_return_val_if_fail(t < PA_CHANNEL_POSITION_MAX, PA_VOLUME_MUTED);
-
- for (c = 0; c < map->channels; c++)
- if (map->map[c] == t)
- if (cv->values[c] > v)
- v = cv->values[c];
-
- return v;
-}
-#endif
-
guint
-gvc_channel_map_get_num_channels (GvcChannelMap *map)
+gvc_channel_map_get_num_channels (const GvcChannelMap *map)
{
g_return_val_if_fail (GVC_IS_CHANNEL_MAP (map), 0);
@@ -140,7 +93,7 @@ gvc_channel_map_get_volume (GvcChannelMap *map)
}
gboolean
-gvc_channel_map_can_balance (GvcChannelMap *map)
+gvc_channel_map_can_balance (const GvcChannelMap *map)
{
g_return_val_if_fail (GVC_IS_CHANNEL_MAP (map), FALSE);
@@ -148,7 +101,7 @@ gvc_channel_map_can_balance (GvcChannelMap *map)
}
gboolean
-gvc_channel_map_can_fade (GvcChannelMap *map)
+gvc_channel_map_can_fade (const GvcChannelMap *map)
{
g_return_val_if_fail (GVC_IS_CHANNEL_MAP (map), FALSE);
@@ -156,7 +109,7 @@ gvc_channel_map_can_fade (GvcChannelMap *map)
}
const char *
-gvc_channel_map_get_mapping (GvcChannelMap *map)
+gvc_channel_map_get_mapping (const GvcChannelMap *map)
{
g_return_val_if_fail (GVC_IS_CHANNEL_MAP (map), NULL);
@@ -167,15 +120,16 @@ gvc_channel_map_get_mapping (GvcChannelMap *map)
}
gboolean
-gvc_channel_map_has_lfe (GvcChannelMap *map)
+gvc_channel_map_has_position (const GvcChannelMap *map,
+ pa_channel_position_t position)
{
g_return_val_if_fail (GVC_IS_CHANNEL_MAP (map), FALSE);
- return map->priv->has_lfe;
+ return pa_channel_map_has_position (&(map->priv->pa_map), position);
}
const pa_channel_map *
-gvc_channel_map_get_pa_channel_map (GvcChannelMap *map)
+gvc_channel_map_get_pa_channel_map (const GvcChannelMap *map)
{
g_return_val_if_fail (GVC_IS_CHANNEL_MAP (map), NULL);
@@ -186,7 +140,7 @@ gvc_channel_map_get_pa_channel_map (GvcChannelMap *map)
}
const pa_cvolume *
-gvc_channel_map_get_cvolume (GvcChannelMap *map)
+gvc_channel_map_get_cvolume (const GvcChannelMap *map)
{
g_return_val_if_fail (GVC_IS_CHANNEL_MAP (map), NULL);
@@ -274,7 +228,6 @@ set_from_pa_map (GvcChannelMap *map,
map->priv->can_balance = pa_channel_map_can_balance (pa_map);
map->priv->can_fade = pa_channel_map_can_fade (pa_map);
- map->priv->has_lfe = gvc_pa_channel_map_has_position (pa_map, PA_CHANNEL_POSITION_LFE);
map->priv->pa_map = *pa_map;
pa_cvolume_set(&map->priv->pa_volume, pa_map->channels, PA_VOLUME_NORM);
diff --git a/plugins/media-keys/cut-n-paste/gvc-channel-map.h b/plugins/media-keys/cut-n-paste/gvc-channel-map.h
index be07df5..1d1ba4e 100644
--- a/plugins/media-keys/cut-n-paste/gvc-channel-map.h
+++ b/plugins/media-keys/cut-n-paste/gvc-channel-map.h
@@ -62,20 +62,22 @@ GType gvc_channel_map_get_type (void);
GvcChannelMap * gvc_channel_map_new (void);
GvcChannelMap * gvc_channel_map_new_from_pa_channel_map (const pa_channel_map *map);
-guint gvc_channel_map_get_num_channels (GvcChannelMap *map);
+guint gvc_channel_map_get_num_channels (const GvcChannelMap *map);
const gdouble * gvc_channel_map_get_volume (GvcChannelMap *map);
-gboolean gvc_channel_map_can_balance (GvcChannelMap *map);
-gboolean gvc_channel_map_can_fade (GvcChannelMap *map);
-gboolean gvc_channel_map_has_lfe (GvcChannelMap *map);
+gboolean gvc_channel_map_can_balance (const GvcChannelMap *map);
+gboolean gvc_channel_map_can_fade (const GvcChannelMap *map);
+gboolean gvc_channel_map_has_position (const GvcChannelMap *map,
+ pa_channel_position_t position);
+#define gvc_channel_map_has_lfe(x) gvc_channel_map_has_position (x, PA_CHANNEL_POSITION_LFE)
void gvc_channel_map_volume_changed (GvcChannelMap *map,
const pa_cvolume *cv,
gboolean set);
-const char * gvc_channel_map_get_mapping (GvcChannelMap *map);
+const char * gvc_channel_map_get_mapping (const GvcChannelMap *map);
/* private */
-const pa_cvolume * gvc_channel_map_get_cvolume (GvcChannelMap *map);
-const pa_channel_map * gvc_channel_map_get_pa_channel_map (GvcChannelMap *map);
+const pa_cvolume * gvc_channel_map_get_cvolume (const GvcChannelMap *map);
+const pa_channel_map * gvc_channel_map_get_pa_channel_map (const GvcChannelMap *map);
#ifdef __cplusplus
}
#endif
diff --git a/plugins/media-keys/cut-n-paste/gvc-mixer-card.c b/plugins/media-keys/cut-n-paste/gvc-mixer-card.c
index 25c77c0..91bdf19 100644
--- a/plugins/media-keys/cut-n-paste/gvc-mixer-card.c
+++ b/plugins/media-keys/cut-n-paste/gvc-mixer-card.c
@@ -26,7 +26,7 @@
#include <unistd.h>
#include <glib.h>
-#include <glib/gi18n.h>
+#include <glib/gi18n-lib.h>
#include <pulse/pulseaudio.h>
@@ -47,6 +47,7 @@ struct GvcMixerCardPrivate
char *target_profile;
char *human_profile;
GList *profiles;
+ pa_operation *profile_op;
};
enum
@@ -209,6 +210,9 @@ _pa_context_set_card_profile_by_index_cb (pa_context *cont
}
g_free (card->priv->target_profile);
card->priv->target_profile = NULL;
+
+ pa_operation_unref (card->priv->profile_op);
+ card->priv->profile_op = NULL;
}
gboolean
@@ -223,25 +227,26 @@ gvc_mixer_card_change_profile (GvcMixerCard *card,
return TRUE;
if (g_strcmp0 (profile, card->priv->target_profile) == 0)
return TRUE;
+ if (card->priv->profile_op != NULL) {
+ pa_operation_cancel (card->priv->profile_op);
+ pa_operation_unref (card->priv->profile_op);
+ card->priv->profile_op = NULL;
+ }
if (card->priv->profile != NULL) {
- pa_operation *o;
-
g_free (card->priv->target_profile);
card->priv->target_profile = g_strdup (profile);
- o = pa_context_set_card_profile_by_index (card->priv->pa_context,
- card->priv->index,
- card->priv->target_profile,
- _pa_context_set_card_profile_by_index_cb,
- card);
+ card->priv->profile_op = pa_context_set_card_profile_by_index (card->priv->pa_context,
+ card->priv->index,
+ card->priv->target_profile,
+ _pa_context_set_card_profile_by_index_cb,
+ card);
- if (o == NULL) {
+ if (card->priv->profile_op == NULL) {
g_warning ("pa_context_set_card_profile_by_index() failed");
return FALSE;
}
-
- pa_operation_unref (o);
} else {
g_assert (card->priv->human_profile == NULL);
card->priv->profile = g_strdup (profile);
diff --git a/plugins/media-keys/cut-n-paste/gvc-mixer-card.h b/plugins/media-keys/cut-n-paste/gvc-mixer-card.h
index 7a19110..54a85e2 100644
--- a/plugins/media-keys/cut-n-paste/gvc-mixer-card.h
+++ b/plugins/media-keys/cut-n-paste/gvc-mixer-card.h
@@ -56,6 +56,7 @@ typedef struct
char *human_profile;
char *status;
guint priority;
+ guint n_sinks, n_sources;
} GvcMixerCardProfile;
GType gvc_mixer_card_get_type (void);
diff --git a/plugins/media-keys/cut-n-paste/gvc-mixer-control.c b/plugins/media-keys/cut-n-paste/gvc-mixer-control.c
index 2fed2e1..7f4532c 100644
--- a/plugins/media-keys/cut-n-paste/gvc-mixer-control.c
+++ b/plugins/media-keys/cut-n-paste/gvc-mixer-control.c
@@ -27,7 +27,7 @@
#include <unistd.h>
#include <glib.h>
-#include <glib/gi18n.h>
+#include <glib/gi18n-lib.h>
#include <pulse/pulseaudio.h>
#include <pulse/glib-mainloop.h>
@@ -448,6 +448,10 @@ _set_default_source (GvcMixerControl *control,
if (stream == NULL) {
control->priv->default_source_id = 0;
control->priv->default_source_is_set = FALSE;
+ g_signal_emit (control,
+ signals[DEFAULT_SOURCE_CHANGED],
+ 0,
+ PA_INVALID_INDEX);
return;
}
@@ -470,8 +474,16 @@ _set_default_sink (GvcMixerControl *control,
guint new_id;
if (stream == NULL) {
+ /* Don't tell front-ends about an unset default
+ * sink if it's already unset */
+ if (control->priv->default_sink_is_set == FALSE)
+ return;
control->priv->default_sink_id = 0;
control->priv->default_sink_is_set = FALSE;
+ g_signal_emit (control,
+ signals[DEFAULT_SINK_CHANGED],
+ 0,
+ PA_INVALID_INDEX);
return;
}
@@ -480,7 +492,6 @@ _set_default_sink (GvcMixerControl *control,
if (control->priv->default_sink_id != new_id) {
control->priv->default_sink_id = new_id;
control->priv->default_sink_is_set = TRUE;
-
g_signal_emit (control,
signals[DEFAULT_SINK_CHANGED],
0,
@@ -672,11 +683,13 @@ update_sink (GvcMixerControl *control,
max_volume = pa_cvolume_max (&info->volume);
gvc_mixer_stream_set_name (stream, info->name);
+ gvc_mixer_stream_set_card_index (stream, info->card);
gvc_mixer_stream_set_description (stream, info->description);
gvc_mixer_stream_set_icon_name (stream, "audio-card");
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_SINK_DECIBEL_VOLUME));
+ gvc_mixer_stream_set_base_volume (stream, (guint32) info->base_volume);
#if PA_MICRO > 15
if (info->active_port != NULL)
gvc_mixer_stream_set_port (stream, info->active_port->name);
@@ -696,7 +709,7 @@ update_sink (GvcMixerControl *control,
}
if (map == NULL)
- map = gvc_mixer_stream_get_channel_map (stream);
+ map = (GvcChannelMap *) gvc_mixer_stream_get_channel_map (stream);
gvc_channel_map_volume_changed (map, &info->volume, FALSE);
}
@@ -759,6 +772,7 @@ update_source (GvcMixerControl *control,
max_volume = pa_cvolume_max (&info->volume);
gvc_mixer_stream_set_name (stream, info->name);
+ gvc_mixer_stream_set_card_index (stream, info->card);
gvc_mixer_stream_set_description (stream, info->description);
gvc_mixer_stream_set_icon_name (stream, "audio-input-microphone");
gvc_mixer_stream_set_volume (stream, (guint)max_volume);
@@ -1064,6 +1078,8 @@ update_card (GvcMixerControl *control,
profile->profile = g_strdup (pi.name);
profile->human_profile = g_strdup (pi.description);
profile->status = card_num_streams_to_status (pi.n_sinks, pi.n_sources);
+ profile->n_sinks = pi.n_sinks;
+ profile->n_sources = pi.n_sources;
profile->priority = pi.priority;
list = g_list_prepend (list, profile);
}
@@ -1328,6 +1344,17 @@ _pa_ext_stream_restore_read_cb (pa_context *context,
if (eol > 0) {
dec_outstanding (control);
+ /* If we don't have an event stream to restore, then
+ * set one up with a default 100% volume */
+ if (!control->priv->event_sink_input_is_set) {
+ pa_ext_stream_restore_info info;
+
+ memset (&info, 0, sizeof(info));
+ info.name = "sink-input-by-media-role:event";
+ info.volume.channels = 1;
+ info.volume.values[0] = PA_VOLUME_NORM;
+ update_event_role_stream (control, &info);
+ }
return;
}
diff --git a/plugins/media-keys/cut-n-paste/gvc-mixer-event-role.c b/plugins/media-keys/cut-n-paste/gvc-mixer-event-role.c
index a2d1169..594f951 100644
--- a/plugins/media-keys/cut-n-paste/gvc-mixer-event-role.c
+++ b/plugins/media-keys/cut-n-paste/gvc-mixer-event-role.c
@@ -25,7 +25,7 @@
#include <unistd.h>
#include <glib.h>
-#include <glib/gi18n.h>
+#include <glib/gi18n-lib.h>
#include <pulse/pulseaudio.h>
#include <pulse/ext-stream-restore.h>
@@ -58,7 +58,7 @@ update_settings (GvcMixerEventRole *role,
{
pa_operation *o;
guint index;
- GvcChannelMap *map;
+ const GvcChannelMap *map;
pa_context *context;
pa_ext_stream_restore_info info;
@@ -87,8 +87,8 @@ update_settings (GvcMixerEventRole *role,
return FALSE;
}
- if (op != NULL)
- *op = o;
+ if (op != NULL)
+ *op = o;
return TRUE;
}
diff --git a/plugins/media-keys/cut-n-paste/gvc-mixer-sink-input.c b/plugins/media-keys/cut-n-paste/gvc-mixer-sink-input.c
index 9dec302..1f4a06b 100644
--- a/plugins/media-keys/cut-n-paste/gvc-mixer-sink-input.c
+++ b/plugins/media-keys/cut-n-paste/gvc-mixer-sink-input.c
@@ -25,7 +25,7 @@
#include <unistd.h>
#include <glib.h>
-#include <glib/gi18n.h>
+#include <glib/gi18n-lib.h>
#include <pulse/pulseaudio.h>
@@ -48,12 +48,12 @@ G_DEFINE_TYPE (GvcMixerSinkInput, gvc_mixer_sink_input, GVC_TYPE_MIXER_STREAM)
static gboolean
gvc_mixer_sink_input_push_volume (GvcMixerStream *stream, gpointer *op)
{
- pa_operation *o;
- guint index;
- GvcChannelMap *map;
- pa_context *context;
- const pa_cvolume *cv;
- guint num_channels;
+ pa_operation *o;
+ guint index;
+ const GvcChannelMap *map;
+ pa_context *context;
+ const pa_cvolume *cv;
+ guint num_channels;
index = gvc_mixer_stream_get_index (stream);
diff --git a/plugins/media-keys/cut-n-paste/gvc-mixer-sink.c b/plugins/media-keys/cut-n-paste/gvc-mixer-sink.c
index ffccc8b..3ab7924 100644
--- a/plugins/media-keys/cut-n-paste/gvc-mixer-sink.c
+++ b/plugins/media-keys/cut-n-paste/gvc-mixer-sink.c
@@ -25,7 +25,7 @@
#include <unistd.h>
#include <glib.h>
-#include <glib/gi18n.h>
+#include <glib/gi18n-lib.h>
#include <pulse/pulseaudio.h>
@@ -48,11 +48,11 @@ G_DEFINE_TYPE (GvcMixerSink, gvc_mixer_sink, GVC_TYPE_MIXER_STREAM)
static gboolean
gvc_mixer_sink_push_volume (GvcMixerStream *stream, gpointer *op)
{
- pa_operation *o;
- guint index;
- GvcChannelMap *map;
- pa_context *context;
- const pa_cvolume *cv;
+ pa_operation *o;
+ guint index;
+ const GvcChannelMap *map;
+ pa_context *context;
+ const pa_cvolume *cv;
index = gvc_mixer_stream_get_index (stream);
@@ -133,7 +133,7 @@ gvc_mixer_sink_change_port (GvcMixerStream *stream,
return TRUE;
#else
- return FALSE;
+ return FALSE;
#endif /* PA_MICRO > 15 */
}
diff --git a/plugins/media-keys/cut-n-paste/gvc-mixer-source-output.c b/plugins/media-keys/cut-n-paste/gvc-mixer-source-output.c
index ec1efd9..7b63221 100644
--- a/plugins/media-keys/cut-n-paste/gvc-mixer-source-output.c
+++ b/plugins/media-keys/cut-n-paste/gvc-mixer-source-output.c
@@ -25,7 +25,7 @@
#include <unistd.h>
#include <glib.h>
-#include <glib/gi18n.h>
+#include <glib/gi18n-lib.h>
#include <pulse/pulseaudio.h>
diff --git a/plugins/media-keys/cut-n-paste/gvc-mixer-source.c b/plugins/media-keys/cut-n-paste/gvc-mixer-source.c
index 83b8afc..bc51f08 100644
--- a/plugins/media-keys/cut-n-paste/gvc-mixer-source.c
+++ b/plugins/media-keys/cut-n-paste/gvc-mixer-source.c
@@ -25,7 +25,7 @@
#include <unistd.h>
#include <glib.h>
-#include <glib/gi18n.h>
+#include <glib/gi18n-lib.h>
#include <pulse/pulseaudio.h>
@@ -48,11 +48,11 @@ G_DEFINE_TYPE (GvcMixerSource, gvc_mixer_source, GVC_TYPE_MIXER_STREAM)
static gboolean
gvc_mixer_source_push_volume (GvcMixerStream *stream, gpointer *op)
{
- pa_operation *o;
- guint index;
- GvcChannelMap *map;
- pa_context *context;
- const pa_cvolume *cv;
+ pa_operation *o;
+ guint index;
+ const GvcChannelMap *map;
+ pa_context *context;
+ const pa_cvolume *cv;
index = gvc_mixer_stream_get_index (stream);
@@ -133,7 +133,7 @@ gvc_mixer_source_change_port (GvcMixerStream *stream,
return TRUE;
#else
- return FALSE;
+ return FALSE;
#endif /* PA_MICRO > 15 */
}
diff --git a/plugins/media-keys/cut-n-paste/gvc-mixer-stream.c b/plugins/media-keys/cut-n-paste/gvc-mixer-stream.c
index 7b08828..7b1e0ec 100644
--- a/plugins/media-keys/cut-n-paste/gvc-mixer-stream.c
+++ b/plugins/media-keys/cut-n-paste/gvc-mixer-stream.c
@@ -25,7 +25,7 @@
#include <unistd.h>
#include <glib.h>
-#include <glib/gi18n.h>
+#include <glib/gi18n-lib.h>
#include <pulse/pulseaudio.h>
@@ -40,6 +40,7 @@ struct GvcMixerStreamPrivate
pa_context *pa_context;
guint id;
guint index;
+ gint card_index;
GvcChannelMap *channel_map;
char *name;
char *description;
@@ -73,6 +74,7 @@ enum
PROP_CAN_DECIBEL,
PROP_IS_EVENT_STREAM,
PROP_IS_VIRTUAL,
+ PROP_CARD_INDEX,
PROP_PORT,
};
@@ -117,7 +119,7 @@ gvc_mixer_stream_get_id (GvcMixerStream *stream)
return stream->priv->id;
}
-GvcChannelMap *
+const GvcChannelMap *
gvc_mixer_stream_get_channel_map (GvcMixerStream *stream)
{
g_return_val_if_fail (GVC_IS_MIXER_STREAM (stream), NULL);
@@ -403,7 +405,7 @@ gvc_mixer_stream_set_base_volume (GvcMixerStream *stream,
return TRUE;
}
-GvcMixerStreamPort *
+const GvcMixerStreamPort *
gvc_mixer_stream_get_port (GvcMixerStream *stream)
{
GList *l;
@@ -489,6 +491,25 @@ gvc_mixer_stream_set_ports (GvcMixerStream *stream,
return TRUE;
}
+gint
+gvc_mixer_stream_get_card_index (GvcMixerStream *stream)
+{
+ g_return_val_if_fail (GVC_IS_MIXER_STREAM (stream), PA_INVALID_INDEX);
+ return stream->priv->card_index;
+}
+
+gboolean
+gvc_mixer_stream_set_card_index (GvcMixerStream *stream,
+ gint card_index)
+{
+ g_return_val_if_fail (GVC_IS_MIXER_STREAM (stream), FALSE);
+
+ stream->priv->card_index = card_index;
+ g_object_notify (G_OBJECT (stream), "card-index");
+
+ return TRUE;
+}
+
static void
gvc_mixer_stream_set_property (GObject *object,
guint prop_id,
@@ -543,6 +564,9 @@ gvc_mixer_stream_set_property (GObject *object,
case PROP_PORT:
gvc_mixer_stream_set_port (self, g_value_get_string (value));
break;
+ case PROP_CARD_INDEX:
+ self->priv->card_index = g_value_get_long (value);
+ break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
break;
@@ -605,6 +629,9 @@ gvc_mixer_stream_get_property (GObject *object,
case PROP_PORT:
g_value_set_string (value, self->priv->port);
break;
+ case PROP_CARD_INDEX:
+ g_value_set_long (value, self->priv->card_index);
+ break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
break;
@@ -815,6 +842,13 @@ gvc_mixer_stream_class_init (GvcMixerStreamClass *klass)
"The name of the current port for this stream",
NULL,
G_PARAM_READWRITE));
+ g_object_class_install_property (gobject_class,
+ PROP_CARD_INDEX,
+ g_param_spec_long ("card-index",
+ "Card index",
+ "The index of the card for this stream",
+ PA_INVALID_INDEX, G_MAXLONG, PA_INVALID_INDEX,
+ G_PARAM_READWRITE|G_PARAM_CONSTRUCT));
g_type_class_add_private (klass, sizeof (GvcMixerStreamPrivate));
}
@@ -844,6 +878,9 @@ gvc_mixer_stream_finalize (GObject *object)
g_return_if_fail (mixer_stream->priv != NULL);
+ g_object_unref (mixer_stream->priv->channel_map);
+ mixer_stream->priv->channel_map = NULL;
+
g_free (mixer_stream->priv->name);
mixer_stream->priv->name = NULL;
diff --git a/plugins/media-keys/cut-n-paste/gvc-mixer-stream.h b/plugins/media-keys/cut-n-paste/gvc-mixer-stream.h
index 6f7eab3..e818505 100644
--- a/plugins/media-keys/cut-n-paste/gvc-mixer-stream.h
+++ b/plugins/media-keys/cut-n-paste/gvc-mixer-stream.h
@@ -70,8 +70,8 @@ GType gvc_mixer_stream_get_type (void);
pa_context * gvc_mixer_stream_get_pa_context (GvcMixerStream *stream);
guint gvc_mixer_stream_get_index (GvcMixerStream *stream);
guint gvc_mixer_stream_get_id (GvcMixerStream *stream);
-GvcChannelMap * gvc_mixer_stream_get_channel_map (GvcMixerStream *stream);
-GvcMixerStreamPort *gvc_mixer_stream_get_port (GvcMixerStream *stream);
+const GvcChannelMap *gvc_mixer_stream_get_channel_map(GvcMixerStream *stream);
+const GvcMixerStreamPort *gvc_mixer_stream_get_port (GvcMixerStream *stream);
const GList * gvc_mixer_stream_get_ports (GvcMixerStream *stream);
gboolean gvc_mixer_stream_change_port (GvcMixerStream *stream,
const char *port);
@@ -92,6 +92,7 @@ const char * gvc_mixer_stream_get_description (GvcMixerStream *stream);
const char * gvc_mixer_stream_get_application_id (GvcMixerStream *stream);
gboolean gvc_mixer_stream_is_event_stream (GvcMixerStream *stream);
gboolean gvc_mixer_stream_is_virtual (GvcMixerStream *stream);
+gint gvc_mixer_stream_get_card_index (GvcMixerStream *stream);
/* private */
gboolean gvc_mixer_stream_set_volume (GvcMixerStream *stream,
@@ -120,6 +121,8 @@ gboolean gvc_mixer_stream_set_port (GvcMixerStream *stream,
const char *port);
gboolean gvc_mixer_stream_set_ports (GvcMixerStream *stream,
GList *ports);
+gboolean gvc_mixer_stream_set_card_index (GvcMixerStream *stream,
+ gint card_index);
#ifdef __cplusplus
}
diff --git a/plugins/media-keys/msd-media-keys-plugin.c b/plugins/media-keys/msd-media-keys-plugin.c
index 4d297bb..93a805f 100644
--- a/plugins/media-keys/msd-media-keys-plugin.c
+++ b/plugins/media-keys/msd-media-keys-plugin.c
@@ -102,3 +102,9 @@ msd_media_keys_plugin_class_init (MsdMediaKeysPluginClass *klass)
g_type_class_add_private (klass, sizeof (MsdMediaKeysPluginPrivate));
}
+
+static void
+msd_media_keys_plugin_class_finalize (MsdMediaKeysPluginClass *klass)
+{
+}
+