summaryrefslogtreecommitdiff
path: root/backends/pulse
diff options
context:
space:
mode:
Diffstat (limited to 'backends/pulse')
-rw-r--r--backends/pulse/pulse-connection.c12
-rw-r--r--backends/pulse/pulse-device-switch.c4
-rw-r--r--backends/pulse/pulse-device.c1
-rw-r--r--backends/pulse/pulse-ext-stream.c8
-rw-r--r--backends/pulse/pulse-helpers.c2
-rw-r--r--backends/pulse/pulse-sink-input.c8
-rw-r--r--backends/pulse/pulse-sink-switch.c5
-rw-r--r--backends/pulse/pulse-sink.c6
-rw-r--r--backends/pulse/pulse-source-output.c8
-rw-r--r--backends/pulse/pulse-source-switch.c5
-rw-r--r--backends/pulse/pulse-source.c6
-rw-r--r--backends/pulse/pulse-stream-control.c14
-rw-r--r--backends/pulse/pulse-stream-control.h3
13 files changed, 70 insertions, 12 deletions
diff --git a/backends/pulse/pulse-connection.c b/backends/pulse/pulse-connection.c
index 995b522..62156c1 100644
--- a/backends/pulse/pulse-connection.c
+++ b/backends/pulse/pulse-connection.c
@@ -786,6 +786,7 @@ pulse_connection_set_default_sink (PulseConnection *connection,
pa_operation *op;
g_return_val_if_fail (PULSE_IS_CONNECTION (connection), FALSE);
+ g_return_val_if_fail (name != NULL, FALSE);
if (connection->priv->state != PULSE_CONNECTION_CONNECTED)
return FALSE;
@@ -804,6 +805,7 @@ pulse_connection_set_default_source (PulseConnection *connection,
pa_operation *op;
g_return_val_if_fail (PULSE_IS_CONNECTION (connection), FALSE);
+ g_return_val_if_fail (name != NULL, FALSE);
if (connection->priv->state != PULSE_CONNECTION_CONNECTED)
return FALSE;
@@ -823,6 +825,8 @@ pulse_connection_set_card_profile (PulseConnection *connection,
pa_operation *op;
g_return_val_if_fail (PULSE_IS_CONNECTION (connection), FALSE);
+ g_return_val_if_fail (card != NULL, FALSE);
+ g_return_val_if_fail (profile != NULL, FALSE);
if (connection->priv->state != PULSE_CONNECTION_CONNECTED)
return FALSE;
@@ -863,6 +867,7 @@ pulse_connection_set_sink_volume (PulseConnection *connection,
pa_operation *op;
g_return_val_if_fail (PULSE_IS_CONNECTION (connection), FALSE);
+ g_return_val_if_fail (volume != NULL, FALSE);
if (connection->priv->state != PULSE_CONNECTION_CONNECTED)
return FALSE;
@@ -883,6 +888,7 @@ pulse_connection_set_sink_port (PulseConnection *connection,
pa_operation *op;
g_return_val_if_fail (PULSE_IS_CONNECTION (connection), FALSE);
+ g_return_val_if_fail (port != NULL, FALSE);
if (connection->priv->state != PULSE_CONNECTION_CONNECTED)
return FALSE;
@@ -923,6 +929,7 @@ pulse_connection_set_sink_input_volume (PulseConnection *connection,
pa_operation *op;
g_return_val_if_fail (PULSE_IS_CONNECTION (connection), FALSE);
+ g_return_val_if_fail (volume != NULL, FALSE);
if (connection->priv->state != PULSE_CONNECTION_CONNECTED)
return FALSE;
@@ -963,6 +970,7 @@ pulse_connection_set_source_volume (PulseConnection *connection,
pa_operation *op;
g_return_val_if_fail (PULSE_IS_CONNECTION (connection), FALSE);
+ g_return_val_if_fail (volume != NULL, FALSE);
if (connection->priv->state != PULSE_CONNECTION_CONNECTED)
return FALSE;
@@ -983,6 +991,7 @@ pulse_connection_set_source_port (PulseConnection *connection,
pa_operation *op;
g_return_val_if_fail (PULSE_IS_CONNECTION (connection), FALSE);
+ g_return_val_if_fail (port != NULL, FALSE);
if (connection->priv->state != PULSE_CONNECTION_CONNECTED)
return FALSE;
@@ -1023,6 +1032,7 @@ pulse_connection_set_source_output_volume (PulseConnection *connection,
pa_operation *op;
g_return_val_if_fail (PULSE_IS_CONNECTION (connection), FALSE);
+ g_return_val_if_fail (volume != NULL, FALSE);
if (connection->priv->state != PULSE_CONNECTION_CONNECTED)
return FALSE;
@@ -1158,6 +1168,7 @@ pulse_connection_write_ext_stream (PulseConnection *connection,
pa_operation *op;
g_return_val_if_fail (PULSE_IS_CONNECTION (connection), FALSE);
+ g_return_val_if_fail (info != NULL, FALSE);
if (connection->priv->state != PULSE_CONNECTION_CONNECTED)
return FALSE;
@@ -1179,6 +1190,7 @@ pulse_connection_delete_ext_stream (PulseConnection *connection,
gchar **names;
g_return_val_if_fail (PULSE_IS_CONNECTION (connection), FALSE);
+ g_return_val_if_fail (name != NULL, FALSE);
if (connection->priv->state != PULSE_CONNECTION_CONNECTED)
return FALSE;
diff --git a/backends/pulse/pulse-device-switch.c b/backends/pulse/pulse-device-switch.c
index c6b8316..4bd32ce 100644
--- a/backends/pulse/pulse-device-switch.c
+++ b/backends/pulse/pulse-device-switch.c
@@ -89,6 +89,10 @@ pulse_device_switch_dispose (GObject *object)
PulseDeviceSwitch *
pulse_device_switch_new (const gchar *name, const gchar *label, PulseDevice *device)
{
+ g_return_val_if_fail (name != NULL, NULL);
+ g_return_val_if_fail (label != NULL, NULL);
+ g_return_val_if_fail (PULSE_IS_DEVICE (device), NULL);
+
return g_object_new (PULSE_TYPE_DEVICE_SWITCH,
"name", name,
"label", label,
diff --git a/backends/pulse/pulse-device.c b/backends/pulse/pulse-device.c
index d53c86a..9b75ca4 100644
--- a/backends/pulse/pulse-device.c
+++ b/backends/pulse/pulse-device.c
@@ -330,6 +330,7 @@ PulsePort *
pulse_device_get_port (PulseDevice *device, const gchar *name)
{
g_return_val_if_fail (PULSE_IS_DEVICE (device), NULL);
+ g_return_val_if_fail (name != NULL, NULL);
return g_hash_table_lookup (device->priv->ports, name);
}
diff --git a/backends/pulse/pulse-ext-stream.c b/backends/pulse/pulse-ext-stream.c
index 2ebf8e7..e99fbb1 100644
--- a/backends/pulse/pulse-ext-stream.c
+++ b/backends/pulse/pulse-ext-stream.c
@@ -393,8 +393,12 @@ pulse_ext_stream_update (PulseExtStream *ext,
_mate_mixer_stream_control_set_flags (MATE_MIXER_STREAM_CONTROL (ext), flags);
/* Also set initially, but may change at any time */
- _mate_mixer_stream_control_set_stream (MATE_MIXER_STREAM_CONTROL (ext),
- MATE_MIXER_STREAM (parent));
+ if (parent != NULL)
+ _mate_mixer_stream_control_set_stream (MATE_MIXER_STREAM_CONTROL (ext),
+ MATE_MIXER_STREAM (parent));
+ else
+ _mate_mixer_stream_control_set_stream (MATE_MIXER_STREAM_CONTROL (ext),
+ NULL);
g_object_thaw_notify (G_OBJECT (ext));
}
diff --git a/backends/pulse/pulse-helpers.c b/backends/pulse/pulse-helpers.c
index 671c3e2..f1272ae 100644
--- a/backends/pulse/pulse-helpers.c
+++ b/backends/pulse/pulse-helpers.c
@@ -73,6 +73,8 @@ const pa_channel_position_t pulse_channel_map_to[MATE_MIXER_CHANNEL_MAX] =
MateMixerStreamControlMediaRole
pulse_convert_media_role_name (const gchar *name)
{
+ g_return_val_if_fail (name != NULL, MATE_MIXER_STREAM_CONTROL_MEDIA_ROLE_UNKNOWN);
+
if (!strcmp (name, "video")) {
return MATE_MIXER_STREAM_CONTROL_MEDIA_ROLE_VIDEO;
}
diff --git a/backends/pulse/pulse-sink-input.c b/backends/pulse/pulse-sink-input.c
index eb812c6..c20a820 100644
--- a/backends/pulse/pulse-sink-input.c
+++ b/backends/pulse/pulse-sink-input.c
@@ -146,8 +146,12 @@ pulse_sink_input_new (PulseSink *sink, const pa_sink_input_info *info)
NULL);
g_free (name);
- if (app_info != NULL)
- pulse_stream_control_set_app_info (PULSE_STREAM_CONTROL (input), app_info);
+ if (app_info != NULL) {
+ /* Takes ownership of app_info */
+ pulse_stream_control_set_app_info (PULSE_STREAM_CONTROL (input),
+ app_info,
+ TRUE);
+ }
pulse_sink_input_update (input, info);
return input;
diff --git a/backends/pulse/pulse-sink-switch.c b/backends/pulse/pulse-sink-switch.c
index 62aca94..74c182f 100644
--- a/backends/pulse/pulse-sink-switch.c
+++ b/backends/pulse/pulse-sink-switch.c
@@ -24,6 +24,7 @@
#include "pulse-connection.h"
#include "pulse-port.h"
#include "pulse-port-switch.h"
+#include "pulse-sink.h"
#include "pulse-sink-switch.h"
#include "pulse-stream.h"
@@ -52,6 +53,10 @@ pulse_sink_switch_init (PulseSinkSwitch *swtch)
PulsePortSwitch *
pulse_sink_switch_new (const gchar *name, const gchar *label, PulseSink *sink)
{
+ g_return_val_if_fail (name != NULL, NULL);
+ g_return_val_if_fail (label != NULL, NULL);
+ g_return_val_if_fail (PULSE_IS_SINK (sink), NULL);
+
return g_object_new (PULSE_TYPE_SINK_SWITCH,
"name", name,
"label", label,
diff --git a/backends/pulse/pulse-sink.c b/backends/pulse/pulse-sink.c
index 294643c..616331b 100644
--- a/backends/pulse/pulse-sink.c
+++ b/backends/pulse/pulse-sink.c
@@ -130,6 +130,7 @@ pulse_sink_new (PulseConnection *connection,
g_return_val_if_fail (PULSE_IS_CONNECTION (connection), NULL);
g_return_val_if_fail (info != NULL, NULL);
+ g_return_val_if_fail (device == NULL || PULSE_IS_DEVICE (device), NULL);
sink = g_object_new (PULSE_TYPE_SINK,
"name", info->name,
@@ -189,6 +190,9 @@ pulse_sink_add_input (PulseSink *sink, const pa_sink_input_info *info)
{
PulseSinkInput *input;
+ g_return_val_if_fail (PULSE_IS_SINK (sink), FALSE);
+ g_return_val_if_fail (info != NULL, FALSE);
+
/* This function is used for both creating and refreshing sink inputs */
input = g_hash_table_lookup (sink->priv->inputs, GUINT_TO_POINTER (info->index));
if (input == NULL) {
@@ -218,6 +222,8 @@ pulse_sink_remove_input (PulseSink *sink, guint32 index)
PulseSinkInput *input;
gchar *name;
+ g_return_if_fail (PULSE_IS_SINK (sink));
+
input = g_hash_table_lookup (sink->priv->inputs, GUINT_TO_POINTER (index));
if G_UNLIKELY (input == NULL)
return;
diff --git a/backends/pulse/pulse-source-output.c b/backends/pulse/pulse-source-output.c
index a48f9f6..9a38250 100644
--- a/backends/pulse/pulse-source-output.c
+++ b/backends/pulse/pulse-source-output.c
@@ -134,8 +134,12 @@ pulse_source_output_new (PulseSource *source,
NULL);
g_free (name);
- if (app_info != NULL)
- pulse_stream_control_set_app_info (PULSE_STREAM_CONTROL (output), app_info);
+ if (app_info != NULL) {
+ /* Takes ownership of app_info */
+ pulse_stream_control_set_app_info (PULSE_STREAM_CONTROL (output),
+ app_info,
+ TRUE);
+ }
pulse_source_output_update (output, info);
return output;
diff --git a/backends/pulse/pulse-source-switch.c b/backends/pulse/pulse-source-switch.c
index 9616bb1..76f97f0 100644
--- a/backends/pulse/pulse-source-switch.c
+++ b/backends/pulse/pulse-source-switch.c
@@ -24,6 +24,7 @@
#include "pulse-connection.h"
#include "pulse-port.h"
#include "pulse-port-switch.h"
+#include "pulse-source.h"
#include "pulse-source-switch.h"
#include "pulse-stream.h"
@@ -52,6 +53,10 @@ pulse_source_switch_init (PulseSourceSwitch *swtch)
PulsePortSwitch *
pulse_source_switch_new (const gchar *name, const gchar *label, PulseSource *source)
{
+ g_return_val_if_fail (name != NULL, NULL);
+ g_return_val_if_fail (label != NULL, NULL);
+ g_return_val_if_fail (PULSE_IS_SOURCE (source), NULL);
+
return g_object_new (PULSE_TYPE_SOURCE_SWITCH,
"name", name,
"label", label,
diff --git a/backends/pulse/pulse-source.c b/backends/pulse/pulse-source.c
index acba188..570423d 100644
--- a/backends/pulse/pulse-source.c
+++ b/backends/pulse/pulse-source.c
@@ -127,6 +127,7 @@ pulse_source_new (PulseConnection *connection,
g_return_val_if_fail (PULSE_IS_CONNECTION (connection), NULL);
g_return_val_if_fail (info != NULL, NULL);
+ g_return_val_if_fail (device == NULL || PULSE_IS_DEVICE (device), NULL);
source = g_object_new (PULSE_TYPE_SOURCE,
"name", info->name,
@@ -186,6 +187,9 @@ pulse_source_add_output (PulseSource *source, const pa_source_output_info *info)
{
PulseSourceOutput *output;
+ g_return_val_if_fail (PULSE_IS_SOURCE (source), FALSE);
+ g_return_val_if_fail (info != NULL, FALSE);
+
/* This function is used for both creating and refreshing source outputs */
output = g_hash_table_lookup (source->priv->outputs, GUINT_TO_POINTER (info->index));
if (output == NULL) {
@@ -215,6 +219,8 @@ pulse_source_remove_output (PulseSource *source, guint32 index)
PulseSourceOutput *output;
gchar *name;
+ g_return_if_fail (PULSE_IS_SOURCE (source));
+
output = g_hash_table_lookup (source->priv->outputs, GUINT_TO_POINTER (index));
if G_UNLIKELY (output == NULL)
return;
diff --git a/backends/pulse/pulse-stream-control.c b/backends/pulse/pulse-stream-control.c
index bc59c97..fe4304c 100644
--- a/backends/pulse/pulse-stream-control.c
+++ b/backends/pulse/pulse-stream-control.c
@@ -308,14 +308,19 @@ pulse_stream_control_get_channel_map (PulseStreamControl *control)
}
void
-pulse_stream_control_set_app_info (PulseStreamControl *control, MateMixerAppInfo *info)
+pulse_stream_control_set_app_info (PulseStreamControl *control,
+ MateMixerAppInfo *info,
+ gboolean take)
{
g_return_if_fail (PULSE_IS_STREAM_CONTROL (control));
- if G_UNLIKELY (control->priv->app_info)
+ if G_UNLIKELY (control->priv->app_info != NULL)
_mate_mixer_app_info_free (control->priv->app_info);
- control->priv->app_info = info;
+ if (take == TRUE)
+ control->priv->app_info = info;
+ else
+ control->priv->app_info = _mate_mixer_app_info_copy (info);
}
void
@@ -324,11 +329,10 @@ pulse_stream_control_set_channel_map (PulseStreamControl *control, const pa_chan
MateMixerStreamControlFlags flags;
g_return_if_fail (PULSE_IS_STREAM_CONTROL (control));
- g_return_if_fail (map != NULL);
flags = mate_mixer_stream_control_get_flags (MATE_MIXER_STREAM_CONTROL (control));
- if (pa_channel_map_valid (map)) {
+ if (map != NULL && pa_channel_map_valid (map)) {
if (pa_channel_map_can_balance (map))
flags |= MATE_MIXER_STREAM_CONTROL_CAN_BALANCE;
else
diff --git a/backends/pulse/pulse-stream-control.h b/backends/pulse/pulse-stream-control.h
index abc3f98..c37d6eb 100644
--- a/backends/pulse/pulse-stream-control.h
+++ b/backends/pulse/pulse-stream-control.h
@@ -81,7 +81,8 @@ const pa_cvolume * pulse_stream_control_get_cvolume (PulseStreamControl
const pa_channel_map *pulse_stream_control_get_channel_map (PulseStreamControl *control);
void pulse_stream_control_set_app_info (PulseStreamControl *stream,
- MateMixerAppInfo *info);
+ MateMixerAppInfo *info,
+ gboolean take);
void pulse_stream_control_set_channel_map (PulseStreamControl *control,
const pa_channel_map *map);