summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--backends/pulse/pulse-backend.c179
-rw-r--r--backends/pulse/pulse-client-stream.c65
-rw-r--r--backends/pulse/pulse-client-stream.h22
-rw-r--r--backends/pulse/pulse-connection.c36
-rw-r--r--backends/pulse/pulse-sink-input.c15
-rw-r--r--backends/pulse/pulse-source-output.c24
-rw-r--r--backends/pulse/pulse-source-output.h6
-rw-r--r--backends/pulse/pulse-stream.c17
-rw-r--r--backends/pulse/pulse-stream.h3
-rw-r--r--docs/reference/libmatemixer-sections.txt1
10 files changed, 205 insertions, 163 deletions
diff --git a/backends/pulse/pulse-backend.c b/backends/pulse/pulse-backend.c
index 8ed7342..40e28e5 100644
--- a/backends/pulse/pulse-backend.c
+++ b/backends/pulse/pulse-backend.c
@@ -152,7 +152,7 @@ static gint backend_compare_devices (gconstpointer
gconstpointer b);
static gint backend_compare_streams (gconstpointer a,
gconstpointer b);
-static gboolean backend_compare_stream_name (gpointer key,
+static gboolean backend_compare_stream_names (gpointer key,
gpointer value,
gpointer user_data);
@@ -380,6 +380,7 @@ backend_open (MateMixerBackend *backend)
g_object_unref (connection);
return FALSE;
}
+
pulse->priv->connection = connection;
pulse->priv->state = MATE_MIXER_STATE_CONNECTING;
return TRUE;
@@ -561,6 +562,8 @@ backend_connection_state_cb (PulseConnection *connection,
/* We managed to connect once before, try to reconnect and if it
* fails immediately, use an idle source;
* in case the idle source already exists, just let it try again */
+
+ // XXX need to handle cached streams that are gone when reconnected
if (!pulse->priv->connect_source &&
!pulse_connection_connect (connection)) {
pulse->priv->connect_source = g_idle_source_new ();
@@ -613,7 +616,7 @@ backend_server_info_cb (PulseConnection *connection,
if (info->default_source_name != NULL) {
MateMixerStream *stream = g_hash_table_find (pulse->priv->sources,
- backend_compare_stream_name,
+ backend_compare_stream_names,
(gpointer) info->default_source_name);
/* It is theoretically possible to receive a server info notification
@@ -639,7 +642,7 @@ backend_server_info_cb (PulseConnection *connection,
if (info->default_sink_name != NULL) {
MateMixerStream *stream = g_hash_table_find (pulse->priv->sinks,
- backend_compare_stream_name,
+ backend_compare_stream_names,
(gpointer) info->default_sink_name);
if (G_LIKELY (stream != NULL)) {
pulse->priv->default_sink = g_object_ref (stream);
@@ -664,26 +667,29 @@ backend_card_info_cb (PulseConnection *connection,
const pa_card_info *info,
PulseBackend *pulse)
{
- gpointer p;
+ gpointer p;
+ PulseDevice *device;
p = g_hash_table_lookup (pulse->priv->devices, GINT_TO_POINTER (info->index));
- if (!p) {
- PulseDevice *device = pulse_device_new (connection, info);
+ if (p == NULL) {
+ device = pulse_device_new (connection, info);
+
+ if (G_UNLIKELY (device == NULL))
+ return;
g_hash_table_insert (pulse->priv->devices,
- GINT_TO_POINTER (pulse_device_get_index (device)),
+ GINT_TO_POINTER (info->index),
device);
-
- g_signal_emit_by_name (G_OBJECT (pulse),
- "device-added",
- mate_mixer_device_get_name (MATE_MIXER_DEVICE (device)));
} else {
- pulse_device_update (PULSE_DEVICE (p), info);
-
- g_signal_emit_by_name (G_OBJECT (pulse),
- "device-changed",
- mate_mixer_device_get_name (MATE_MIXER_DEVICE (p)));
+ device = PULSE_DEVICE (p);
+ pulse_device_update (device, info);
}
+
+ g_signal_emit_by_name (G_OBJECT (pulse),
+ (p == NULL)
+ ? "device-added"
+ : "device-changed",
+ mate_mixer_device_get_name (MATE_MIXER_DEVICE (device)));
}
static void
@@ -713,26 +719,29 @@ backend_sink_info_cb (PulseConnection *connection,
const pa_sink_info *info,
PulseBackend *pulse)
{
- gpointer p;
+ gpointer p;
+ PulseStream *stream;
p = g_hash_table_lookup (pulse->priv->sinks, GINT_TO_POINTER (info->index));
- if (!p) {
- PulseStream *stream = pulse_sink_new (connection, info);
+ if (p == NULL) {
+ stream = pulse_sink_new (connection, info);
+
+ if (G_UNLIKELY (stream == NULL))
+ return;
g_hash_table_insert (pulse->priv->sinks,
- GINT_TO_POINTER (pulse_stream_get_index (stream)),
+ GINT_TO_POINTER (info->index),
stream);
-
- g_signal_emit_by_name (G_OBJECT (pulse),
- "stream-added",
- mate_mixer_stream_get_name (MATE_MIXER_STREAM (stream)));
} else {
- pulse_sink_update (p, info);
-
- g_signal_emit_by_name (G_OBJECT (pulse),
- "stream-changed",
- mate_mixer_stream_get_name (MATE_MIXER_STREAM (p)));
+ stream = PULSE_STREAM (p);
+ pulse_sink_update (stream, info);
}
+
+ g_signal_emit_by_name (G_OBJECT (pulse),
+ (p == NULL)
+ ? "stream-added"
+ : "stream-changed",
+ mate_mixer_stream_get_name (MATE_MIXER_STREAM (stream)));
}
static void
@@ -762,30 +771,37 @@ backend_sink_input_info_cb (PulseConnection *connection,
const pa_sink_input_info *info,
PulseBackend *pulse)
{
- gpointer p;
- gpointer parent;
+ gpointer p;
+ gpointer parent = NULL;
+ PulseStream *stream;
- parent = g_hash_table_lookup (pulse->priv->sinks, GINT_TO_POINTER (info->sink));
+ if (info->sink) {
+ parent = g_hash_table_lookup (pulse->priv->sinks, GINT_TO_POINTER (info->sink));
+ if (G_UNLIKELY (parent == NULL))
+ g_debug ("Unknown parent %d of PulseAudio sink input %d",
+ info->sink,
+ info->index);
+ }
p = g_hash_table_lookup (pulse->priv->sink_inputs, GINT_TO_POINTER (info->index));
- if (!p) {
- PulseStream *stream;
-
+ if (p == NULL) {
stream = pulse_sink_input_new (connection, info, parent);
+ if (G_UNLIKELY (stream == NULL))
+ return;
+
g_hash_table_insert (pulse->priv->sink_inputs,
- GINT_TO_POINTER (pulse_stream_get_index (stream)),
+ GINT_TO_POINTER (info->index),
stream);
-
- g_signal_emit_by_name (G_OBJECT (pulse),
- "stream-added",
- mate_mixer_stream_get_name (MATE_MIXER_STREAM (stream)));
} else {
- pulse_sink_input_update (p, info, parent);
-
- g_signal_emit_by_name (G_OBJECT (pulse),
- "stream-changed",
- mate_mixer_stream_get_name (MATE_MIXER_STREAM (p)));
+ stream = PULSE_STREAM (p);
+ pulse_sink_input_update (stream, info, parent);
}
+
+ g_signal_emit_by_name (G_OBJECT (pulse),
+ (p == NULL)
+ ? "stream-added"
+ : "stream-changed",
+ mate_mixer_stream_get_name (MATE_MIXER_STREAM (stream)));
}
static void
@@ -815,30 +831,33 @@ backend_source_info_cb (PulseConnection *connection,
const pa_source_info *info,
PulseBackend *pulse)
{
- gpointer p;
+ gpointer p;
+ PulseStream *stream;
p = g_hash_table_lookup (pulse->priv->sources, GINT_TO_POINTER (info->index));
- if (!p) {
- PulseStream *stream;
-
+ if (p == NULL) {
+ /* Skip monitor streams */
if (info->monitor_of_sink != PA_INVALID_INDEX)
return;
stream = pulse_source_new (connection, info);
+
+ if (G_UNLIKELY (stream == NULL))
+ return;
+
g_hash_table_insert (pulse->priv->sources,
- GINT_TO_POINTER (pulse_stream_get_index (stream)),
+ GINT_TO_POINTER (info->index),
stream);
-
- g_signal_emit_by_name (G_OBJECT (pulse),
- "stream-added",
- mate_mixer_stream_get_name (MATE_MIXER_STREAM (stream)));
} else {
- pulse_source_update (p, info);
-
- g_signal_emit_by_name (G_OBJECT (pulse),
- "stream-changed",
- mate_mixer_stream_get_name (MATE_MIXER_STREAM (p)));
+ stream = PULSE_STREAM (p);
+ pulse_source_update (stream, info);
}
+
+ g_signal_emit_by_name (G_OBJECT (pulse),
+ (p == NULL)
+ ? "stream-added"
+ : "stream-changed",
+ mate_mixer_stream_get_name (MATE_MIXER_STREAM (stream)));
}
static void
@@ -849,8 +868,6 @@ backend_source_removed_cb (PulseConnection *connection,
gpointer p;
gchar *name;
- // XXX set parent
-
p = g_hash_table_lookup (pulse->priv->sources, GINT_TO_POINTER (index));
if (G_UNLIKELY (p == NULL))
return;
@@ -870,27 +887,37 @@ backend_source_output_info_cb (PulseConnection *connection,
const pa_source_output_info *info,
PulseBackend *pulse)
{
- gpointer p;
+ gpointer p;
+ gpointer parent = NULL;
+ PulseStream *stream;
+
+ if (G_LIKELY (info->source)) {
+ parent = g_hash_table_lookup (pulse->priv->sources, GINT_TO_POINTER (info->source));
+
+ /* Probably a monitor source that we have skipped */
+ if (parent == NULL)
+ return;
+ }
p = g_hash_table_lookup (pulse->priv->source_outputs, GINT_TO_POINTER (info->index));
- if (!p) {
- PulseStream *stream;
+ if (p == NULL) {
+ stream = pulse_source_output_new (connection, info, parent);
+ if (G_UNLIKELY (stream == NULL))
+ return;
- stream = pulse_source_output_new (connection, info);
g_hash_table_insert (pulse->priv->source_outputs,
- GINT_TO_POINTER (pulse_stream_get_index (stream)),
+ GINT_TO_POINTER (info->index),
stream);
-
- g_signal_emit_by_name (G_OBJECT (pulse),
- "stream-added",
- mate_mixer_stream_get_name (MATE_MIXER_STREAM (stream)));
} else {
- pulse_source_output_update (p, info);
-
- g_signal_emit_by_name (G_OBJECT (pulse),
- "stream-changed",
- mate_mixer_stream_get_name (MATE_MIXER_STREAM (p)));
+ stream = PULSE_STREAM (p);
+ pulse_source_output_update (stream, info, parent);
}
+
+ g_signal_emit_by_name (G_OBJECT (pulse),
+ (p == NULL)
+ ? "stream-added"
+ : "stream-changed",
+ mate_mixer_stream_get_name (MATE_MIXER_STREAM (stream)));
}
static void
@@ -956,7 +983,7 @@ backend_compare_streams (gconstpointer a, gconstpointer b)
}
static gboolean
-backend_compare_stream_name (gpointer key, gpointer value, gpointer user_data)
+backend_compare_stream_names (gpointer key, gpointer value, gpointer user_data)
{
MateMixerStream *stream = MATE_MIXER_STREAM (value);
diff --git a/backends/pulse/pulse-client-stream.c b/backends/pulse/pulse-client-stream.c
index a597e69..7d25756 100644
--- a/backends/pulse/pulse-client-stream.c
+++ b/backends/pulse/pulse-client-stream.c
@@ -172,20 +172,15 @@ pulse_client_stream_finalize (GObject *object)
}
gboolean
-pulse_client_stream_update_parent (MateMixerClientStream *client,
- MateMixerStream *parent)
+pulse_client_stream_update_parent (PulseClientStream *client, MateMixerStream *parent)
{
- PulseClientStream *pulse;
-
g_return_val_if_fail (PULSE_IS_CLIENT_STREAM (client), FALSE);
- pulse = PULSE_CLIENT_STREAM (client);
-
- if (pulse->priv->parent != parent) {
- g_clear_object (&pulse->priv->parent);
+ if (client->priv->parent != parent) {
+ g_clear_object (&client->priv->parent);
if (G_LIKELY (parent != NULL))
- pulse->priv->parent = g_object_ref (parent);
+ client->priv->parent = g_object_ref (parent);
g_object_notify (G_OBJECT (client), "parent");
}
@@ -193,18 +188,13 @@ pulse_client_stream_update_parent (MateMixerClientStream *client,
}
gboolean
-pulse_client_stream_update_app_name (MateMixerClientStream *client,
- const gchar *app_name)
+pulse_client_stream_update_app_name (PulseClientStream *client, const gchar *app_name)
{
- PulseClientStream *pulse;
-
g_return_val_if_fail (PULSE_IS_CLIENT_STREAM (client), FALSE);
- pulse = PULSE_CLIENT_STREAM (client);
-
- if (g_strcmp0 (pulse->priv->app_name, app_name)) {
- g_free (pulse->priv->app_name);
- pulse->priv->app_name = g_strdup (app_name);
+ if (g_strcmp0 (client->priv->app_name, app_name)) {
+ g_free (client->priv->app_name);
+ client->priv->app_name = g_strdup (app_name);
g_object_notify (G_OBJECT (client), "app-name");
}
@@ -212,18 +202,13 @@ pulse_client_stream_update_app_name (MateMixerClientStream *client,
}
gboolean
-pulse_client_stream_update_app_id (MateMixerClientStream *client,
- const gchar *app_id)
+pulse_client_stream_update_app_id (PulseClientStream *client, const gchar *app_id)
{
- PulseClientStream *pulse;
-
g_return_val_if_fail (PULSE_IS_CLIENT_STREAM (client), FALSE);
- pulse = PULSE_CLIENT_STREAM (client);
-
- if (g_strcmp0 (pulse->priv->app_id, app_id)) {
- g_free (pulse->priv->app_id);
- pulse->priv->app_id = g_strdup (app_id);
+ if (g_strcmp0 (client->priv->app_id, app_id)) {
+ g_free (client->priv->app_id);
+ client->priv->app_id = g_strdup (app_id);
g_object_notify (G_OBJECT (client), "app-id");
}
@@ -231,18 +216,13 @@ pulse_client_stream_update_app_id (MateMixerClientStream *client,
}
gboolean
-pulse_client_stream_update_app_version (MateMixerClientStream *client,
- const gchar *app_version)
+pulse_client_stream_update_app_version (PulseClientStream *client, const gchar *app_version)
{
- PulseClientStream *pulse;
-
g_return_val_if_fail (PULSE_IS_CLIENT_STREAM (client), FALSE);
- pulse = PULSE_CLIENT_STREAM (client);
-
- if (g_strcmp0 (pulse->priv->app_version, app_version)) {
- g_free (pulse->priv->app_version);
- pulse->priv->app_version = g_strdup (app_version);
+ if (g_strcmp0 (client->priv->app_version, app_version)) {
+ g_free (client->priv->app_version);
+ client->priv->app_version = g_strdup (app_version);
g_object_notify (G_OBJECT (client), "app-version");
}
@@ -250,18 +230,13 @@ pulse_client_stream_update_app_version (MateMixerClientStream *client,
}
gboolean
-pulse_client_stream_update_app_icon (MateMixerClientStream *client,
- const gchar *app_icon)
+pulse_client_stream_update_app_icon (PulseClientStream *client, const gchar *app_icon)
{
- PulseClientStream *pulse;
-
g_return_val_if_fail (PULSE_IS_CLIENT_STREAM (client), FALSE);
- pulse = PULSE_CLIENT_STREAM (client);
-
- if (g_strcmp0 (pulse->priv->app_icon, app_icon)) {
- g_free (pulse->priv->app_icon);
- pulse->priv->app_icon = g_strdup (app_icon);
+ if (g_strcmp0 (client->priv->app_icon, app_icon)) {
+ g_free (client->priv->app_icon);
+ client->priv->app_icon = g_strdup (app_icon);
g_object_notify (G_OBJECT (client), "app-icon");
}
diff --git a/backends/pulse/pulse-client-stream.h b/backends/pulse/pulse-client-stream.h
index c24a535..61e9c4d 100644
--- a/backends/pulse/pulse-client-stream.h
+++ b/backends/pulse/pulse-client-stream.h
@@ -64,17 +64,17 @@ struct _PulseClientStreamClass
GType pulse_client_stream_get_type (void) G_GNUC_CONST;
-gboolean pulse_client_stream_update_parent (MateMixerClientStream *client,
- MateMixerStream *parent);
-
-gboolean pulse_client_stream_update_app_name (MateMixerClientStream *client,
- const gchar *app_name);
-gboolean pulse_client_stream_update_app_id (MateMixerClientStream *client,
- const gchar *app_id);
-gboolean pulse_client_stream_update_app_version (MateMixerClientStream *client,
- const gchar *app_version);
-gboolean pulse_client_stream_update_app_icon (MateMixerClientStream *client,
- const gchar *app_icon);
+gboolean pulse_client_stream_update_parent (PulseClientStream *client,
+ MateMixerStream *parent);
+
+gboolean pulse_client_stream_update_app_name (PulseClientStream *client,
+ const gchar *app_name);
+gboolean pulse_client_stream_update_app_id (PulseClientStream *client,
+ const gchar *app_id);
+gboolean pulse_client_stream_update_app_version (PulseClientStream *client,
+ const gchar *app_version);
+gboolean pulse_client_stream_update_app_icon (PulseClientStream *client,
+ const gchar *app_icon);
G_END_DECLS
diff --git a/backends/pulse/pulse-connection.c b/backends/pulse/pulse-connection.c
index 4289660..4918299 100644
--- a/backends/pulse/pulse-connection.c
+++ b/backends/pulse/pulse-connection.c
@@ -378,13 +378,13 @@ pulse_connection_new (const gchar *app_name,
* the list will be kept with the connection as it may be reused later
* when creating PulseAudio streams */
proplist = pa_proplist_new ();
- if (app_name)
+ if (app_name != NULL)
pa_proplist_sets (proplist, PA_PROP_APPLICATION_NAME, app_name);
- if (app_id)
+ if (app_id != NULL)
pa_proplist_sets (proplist, PA_PROP_APPLICATION_ID, app_id);
- if (app_icon)
+ if (app_icon != NULL)
pa_proplist_sets (proplist, PA_PROP_APPLICATION_ICON_NAME, app_icon);
- if (app_version)
+ if (app_version != NULL)
pa_proplist_sets (proplist, PA_PROP_APPLICATION_VERSION, app_version);
if (app_name != NULL) {
@@ -438,10 +438,12 @@ pulse_connection_connect (PulseConnection *connection)
if (pa_context_connect (connection->priv->context,
connection->priv->server,
PA_CONTEXT_NOFLAGS,
- NULL) == 0)
+ NULL) == 0) {
+ connection->priv->state = PULSE_CONNECTION_CONNECTING;
return TRUE;
- else
- return FALSE;
+ }
+
+ return FALSE;
}
void
@@ -470,6 +472,8 @@ pulse_connection_create_monitor (PulseConnection *connection,
guint32 index_source,
guint32 index_sink_input)
{
+ g_return_val_if_fail (PULSE_IS_CONNECTION (connection), NULL);
+
return pulse_monitor_new (connection->priv->context,
connection->priv->proplist,
index_source,
@@ -822,8 +826,6 @@ connection_load_lists (PulseConnection *connection)
GList *ops = NULL;
pa_operation *op;
- g_return_val_if_fail (PULSE_IS_CONNECTION (connection), FALSE);
-
if (G_UNLIKELY (connection->priv->outstanding)) {
g_warn_if_reached ();
return FALSE;
@@ -911,14 +913,17 @@ connection_state_cb (pa_context *c, void *userdata)
PA_SUBSCRIPTION_MASK_SINK_INPUT |
PA_SUBSCRIPTION_MASK_SOURCE_OUTPUT,
NULL, NULL);
- if (op) {
+ if (op != NULL) {
pa_context_set_subscribe_callback (connection->priv->context,
connection_subscribe_cb,
connection);
pa_operation_unref (op);
- connection_load_lists (connection);
- connection_change_state (connection, PULSE_CONNECTION_LOADING);
+ if (connection_load_lists (connection) == TRUE)
+ connection_change_state (connection, PULSE_CONNECTION_LOADING);
+ else
+ pulse_connection_disconnect (connection);
+
return;
}
@@ -931,9 +936,7 @@ connection_state_cb (pa_context *c, void *userdata)
}
if (state == PA_CONTEXT_TERMINATED || state == PA_CONTEXT_FAILED) {
- /* We also handle the case of clean connection termination as it is a state
- * change which should not normally happen, because the signal subscription
- * is cancelled before disconnecting */
+ /* We do not distinguish between failure and clean connection termination */
pulse_connection_disconnect (connection);
return;
}
@@ -1184,6 +1187,7 @@ connection_list_loaded (PulseConnection *connection)
g_warn_if_reached ();
connection->priv->outstanding = 0;
}
+
if (connection->priv->outstanding == 0) {
pa_operation *op;
@@ -1191,7 +1195,7 @@ connection_list_loaded (PulseConnection *connection)
connection_server_info_cb,
connection);
- if (G_UNLIKELY (!connection_process_operation (connection, op)))
+ if (G_UNLIKELY (connection_process_operation (connection, op) == FALSE))
pulse_connection_disconnect (connection);
}
}
diff --git a/backends/pulse/pulse-sink-input.c b/backends/pulse/pulse-sink-input.c
index 74734dc..4e9991b 100644
--- a/backends/pulse/pulse-sink-input.c
+++ b/backends/pulse/pulse-sink-input.c
@@ -175,22 +175,25 @@ pulse_sink_input_update (PulseStream *stream,
prop = pa_proplist_gets (info->proplist, PA_PROP_APPLICATION_NAME);
if (prop != NULL)
- pulse_client_stream_update_app_name (MATE_MIXER_CLIENT_STREAM (stream), prop);
+ pulse_client_stream_update_app_name (PULSE_CLIENT_STREAM (stream), prop);
prop = pa_proplist_gets (info->proplist, PA_PROP_APPLICATION_ID);
if (prop != NULL)
- pulse_client_stream_update_app_id (MATE_MIXER_CLIENT_STREAM (stream), prop);
+ pulse_client_stream_update_app_id (PULSE_CLIENT_STREAM (stream), prop);
prop = pa_proplist_gets (info->proplist, PA_PROP_APPLICATION_VERSION);
if (prop != NULL)
- pulse_client_stream_update_app_version (MATE_MIXER_CLIENT_STREAM (stream), prop);
+ pulse_client_stream_update_app_version (PULSE_CLIENT_STREAM (stream), prop);
prop = pa_proplist_gets (info->proplist, PA_PROP_APPLICATION_ICON_NAME);
if (prop != NULL)
- pulse_client_stream_update_app_icon (MATE_MIXER_CLIENT_STREAM (stream), prop);
+ pulse_client_stream_update_app_icon (PULSE_CLIENT_STREAM (stream), prop);
- pulse_client_stream_update_parent (MATE_MIXER_CLIENT_STREAM (stream),
- MATE_MIXER_STREAM (parent));
+ if (G_LIKELY (parent != NULL))
+ pulse_client_stream_update_parent (PULSE_CLIENT_STREAM (stream),
+ MATE_MIXER_STREAM (parent));
+ else
+ pulse_client_stream_update_parent (PULSE_CLIENT_STREAM (stream), NULL);
// XXX needs to fix monitor if parent changes
diff --git a/backends/pulse/pulse-source-output.c b/backends/pulse/pulse-source-output.c
index 50269ce..dcd5eb3 100644
--- a/backends/pulse/pulse-source-output.c
+++ b/backends/pulse/pulse-source-output.c
@@ -69,7 +69,9 @@ pulse_source_output_init (PulseSourceOutput *output)
}
PulseStream *
-pulse_source_output_new (PulseConnection *connection, const pa_source_output_info *info)
+pulse_source_output_new (PulseConnection *connection,
+ const pa_source_output_info *info,
+ PulseStream *parent)
{
PulseSourceOutput *output;
@@ -83,13 +85,15 @@ pulse_source_output_new (PulseConnection *connection, const pa_source_output_inf
NULL);
/* Other data may change at any time, so let's make a use of our update function */
- pulse_source_output_update (PULSE_STREAM (output), info);
+ pulse_source_output_update (PULSE_STREAM (output), info, parent);
return PULSE_STREAM (output);
}
gboolean
-pulse_source_output_update (PulseStream *stream, const pa_source_output_info *info)
+pulse_source_output_update (PulseStream *stream,
+ const pa_source_output_info *info,
+ PulseStream *parent)
{
MateMixerStreamFlags flags = MATE_MIXER_STREAM_INPUT |
MATE_MIXER_STREAM_CLIENT;
@@ -114,19 +118,19 @@ pulse_source_output_update (PulseStream *stream, const pa_source_output_info *in
prop = pa_proplist_gets (info->proplist, PA_PROP_APPLICATION_NAME);
if (prop != NULL)
- pulse_client_stream_update_app_name (MATE_MIXER_CLIENT_STREAM (stream), prop);
+ pulse_client_stream_update_app_name (PULSE_CLIENT_STREAM (stream), prop);
prop = pa_proplist_gets (info->proplist, PA_PROP_APPLICATION_ID);
if (prop != NULL)
- pulse_client_stream_update_app_id (MATE_MIXER_CLIENT_STREAM (stream), prop);
+ pulse_client_stream_update_app_id (PULSE_CLIENT_STREAM (stream), prop);
prop = pa_proplist_gets (info->proplist, PA_PROP_APPLICATION_VERSION);
if (prop != NULL)
- pulse_client_stream_update_app_version (MATE_MIXER_CLIENT_STREAM (stream), prop);
+ pulse_client_stream_update_app_version (PULSE_CLIENT_STREAM (stream), prop);
prop = pa_proplist_gets (info->proplist, PA_PROP_APPLICATION_ICON_NAME);
if (prop != NULL)
- pulse_client_stream_update_app_icon (MATE_MIXER_CLIENT_STREAM (stream), prop);
+ pulse_client_stream_update_app_icon (PULSE_CLIENT_STREAM (stream), prop);
prop = pa_proplist_gets (info->proplist, PA_PROP_MEDIA_ROLE);
@@ -173,6 +177,12 @@ pulse_source_output_update (PulseStream *stream, const pa_source_output_info *in
pulse_stream_update_volume (stream, NULL, &info->channel_map);
#endif
+ if (G_LIKELY (parent != NULL))
+ pulse_client_stream_update_parent (PULSE_CLIENT_STREAM (stream),
+ MATE_MIXER_STREAM (parent));
+ else
+ pulse_client_stream_update_parent (PULSE_CLIENT_STREAM (stream), NULL);
+
// XXX needs to fix monitor if parent changes
g_object_thaw_notify (G_OBJECT (stream));
diff --git a/backends/pulse/pulse-source-output.h b/backends/pulse/pulse-source-output.h
index 7413eb1..69efae0 100644
--- a/backends/pulse/pulse-source-output.h
+++ b/backends/pulse/pulse-source-output.h
@@ -59,10 +59,12 @@ struct _PulseSourceOutputClass
GType pulse_source_output_get_type (void) G_GNUC_CONST;
PulseStream *pulse_source_output_new (PulseConnection *connection,
- const pa_source_output_info *info);
+ const pa_source_output_info *info,
+ PulseStream *parent);
gboolean pulse_source_output_update (PulseStream *stream,
- const pa_source_output_info *info);
+ const pa_source_output_info *info,
+ PulseStream *parent);
G_END_DECLS
diff --git a/backends/pulse/pulse-stream.c b/backends/pulse/pulse-stream.c
index 49001b9..4daff23 100644
--- a/backends/pulse/pulse-stream.c
+++ b/backends/pulse/pulse-stream.c
@@ -424,6 +424,23 @@ pulse_stream_update_description (PulseStream *stream, const gchar *description)
return TRUE;
}
+// XXX actually use this
+gboolean
+pulse_stream_update_device (PulseStream *stream, MateMixerDevice *device)
+{
+ g_return_val_if_fail (PULSE_IS_STREAM (stream), FALSE);
+
+ if (stream->priv->device != device) {
+ g_clear_object (&stream->priv->device);
+
+ if (G_LIKELY (device != NULL))
+ stream->priv->device = g_object_ref (device);
+
+ g_object_notify (G_OBJECT (stream), "device");
+ }
+ return TRUE;
+}
+
gboolean
pulse_stream_update_flags (PulseStream *stream, MateMixerStreamFlags flags)
{
diff --git a/backends/pulse/pulse-stream.h b/backends/pulse/pulse-stream.h
index fa0b25b..539c003 100644
--- a/backends/pulse/pulse-stream.h
+++ b/backends/pulse/pulse-stream.h
@@ -21,6 +21,7 @@
#include <glib.h>
#include <glib-object.h>
+#include <libmatemixer/matemixer-device.h>
#include <libmatemixer/matemixer-stream.h>
#include <pulse/pulseaudio.h>
@@ -83,6 +84,8 @@ gboolean pulse_stream_update_name (PulseStream *str
const gchar *name);
gboolean pulse_stream_update_description (PulseStream *stream,
const gchar *description);
+gboolean pulse_stream_update_device (PulseStream *stream,
+ MateMixerDevice *device);
gboolean pulse_stream_update_flags (PulseStream *stream,
MateMixerStreamFlags flags);
gboolean pulse_stream_update_state (PulseStream *stream,
diff --git a/docs/reference/libmatemixer-sections.txt b/docs/reference/libmatemixer-sections.txt
index 376030d..69e60e1 100644
--- a/docs/reference/libmatemixer-sections.txt
+++ b/docs/reference/libmatemixer-sections.txt
@@ -175,6 +175,7 @@ mate_mixer_stream_set_active_port
mate_mixer_stream_get_min_volume
mate_mixer_stream_get_max_volume
mate_mixer_stream_get_normal_volume
+mate_mixer_stream_get_base_volume
<SUBSECTION Standard>
MATE_MIXER_IS_STREAM
MATE_MIXER_STREAM