summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--backends/pulse/pulse-sink-control.c4
-rw-r--r--backends/pulse/pulse-source-control.c6
-rw-r--r--backends/pulse/pulse-source-output.c2
-rw-r--r--backends/pulse/pulse-stream-control.c17
-rw-r--r--backends/pulse/pulse-stream-control.h32
-rw-r--r--backends/pulse/pulse-stream.c2
6 files changed, 38 insertions, 25 deletions
diff --git a/backends/pulse/pulse-sink-control.c b/backends/pulse/pulse-sink-control.c
index d511208..c3fffb1 100644
--- a/backends/pulse/pulse-sink-control.c
+++ b/backends/pulse/pulse-sink-control.c
@@ -126,7 +126,7 @@ pulse_sink_control_set_mute (PulseStreamControl *psc, gboolean mute)
g_return_val_if_fail (PULSE_IS_SINK_CONTROL (psc), FALSE);
return pulse_connection_set_sink_mute (pulse_stream_control_get_connection (psc),
- PULSE_STREAM_CONTROL_GET_STREAM_INDEX (psc),
+ pulse_stream_control_get_stream_index (psc),
mute);
}
@@ -137,7 +137,7 @@ pulse_sink_control_set_volume (PulseStreamControl *psc, pa_cvolume *cvolume)
g_return_val_if_fail (cvolume != NULL, FALSE);
return pulse_connection_set_sink_volume (pulse_stream_control_get_connection (psc),
- PULSE_STREAM_CONTROL_GET_STREAM_INDEX (psc),
+ pulse_stream_control_get_stream_index (psc),
cvolume);
}
diff --git a/backends/pulse/pulse-source-control.c b/backends/pulse/pulse-source-control.c
index 1cff6b5..2597c70 100644
--- a/backends/pulse/pulse-source-control.c
+++ b/backends/pulse/pulse-source-control.c
@@ -122,7 +122,7 @@ pulse_source_control_set_mute (PulseStreamControl *psc, gboolean mute)
g_return_val_if_fail (PULSE_IS_SOURCE_CONTROL (psc), FALSE);
return pulse_connection_set_source_mute (pulse_stream_control_get_connection (psc),
- PULSE_STREAM_CONTROL_GET_STREAM_INDEX (psc),
+ pulse_stream_control_get_stream_index (psc),
mute);
}
@@ -133,7 +133,7 @@ pulse_source_control_set_volume (PulseStreamControl *psc, pa_cvolume *cvolume)
g_return_val_if_fail (cvolume != NULL, FALSE);
return pulse_connection_set_source_volume (pulse_stream_control_get_connection (psc),
- PULSE_STREAM_CONTROL_GET_STREAM_INDEX (psc),
+ pulse_stream_control_get_stream_index (psc),
cvolume);
}
@@ -144,7 +144,7 @@ pulse_source_control_create_monitor (PulseStreamControl *psc)
g_return_val_if_fail (PULSE_IS_SOURCE_CONTROL (psc), NULL);
- index = PULSE_STREAM_CONTROL_GET_STREAM_INDEX (psc);
+ index = pulse_stream_control_get_stream_index (psc);
if G_UNLIKELY (index == PA_INVALID_INDEX) {
g_debug ("Monitor of stream control %s is not available",
mate_mixer_stream_control_get_name (MATE_MIXER_STREAM_CONTROL (psc)));
diff --git a/backends/pulse/pulse-source-output.c b/backends/pulse/pulse-source-output.c
index 6d7fad8..b3552d5 100644
--- a/backends/pulse/pulse-source-output.c
+++ b/backends/pulse/pulse-source-output.c
@@ -211,6 +211,6 @@ pulse_source_output_create_monitor (PulseStreamControl *psc)
g_return_val_if_fail (PULSE_IS_SOURCE_OUTPUT (psc), NULL);
return pulse_connection_create_monitor (pulse_stream_control_get_connection (psc),
- PULSE_STREAM_CONTROL_GET_STREAM_INDEX (psc),
+ pulse_stream_control_get_stream_index (psc),
PA_INVALID_INDEX);
}
diff --git a/backends/pulse/pulse-stream-control.c b/backends/pulse/pulse-stream-control.c
index fe4304c..5ed5bb8 100644
--- a/backends/pulse/pulse-stream-control.c
+++ b/backends/pulse/pulse-stream-control.c
@@ -25,6 +25,7 @@
#include "pulse-connection.h"
#include "pulse-helpers.h"
#include "pulse-monitor.h"
+#include "pulse-stream.h"
#include "pulse-stream-control.h"
struct _PulseStreamControlPrivate
@@ -270,11 +271,25 @@ pulse_stream_control_finalize (GObject *object)
guint32
pulse_stream_control_get_index (PulseStreamControl *control)
{
- g_return_val_if_fail (PULSE_IS_STREAM_CONTROL (control), 0);
+ g_return_val_if_fail (PULSE_IS_STREAM_CONTROL (control), PA_INVALID_INDEX);
return control->priv->index;
}
+guint32
+pulse_stream_control_get_stream_index (PulseStreamControl *control)
+{
+ MateMixerStream *stream;
+
+ g_return_val_if_fail (PULSE_IS_STREAM_CONTROL (control), PA_INVALID_INDEX);
+
+ stream = mate_mixer_stream_control_get_stream (MATE_MIXER_STREAM_CONTROL (control));
+ if G_UNLIKELY (stream == NULL)
+ return PA_INVALID_INDEX;
+
+ return pulse_stream_get_index (PULSE_STREAM (stream));
+}
+
PulseConnection *
pulse_stream_control_get_connection (PulseStreamControl *control)
{
diff --git a/backends/pulse/pulse-stream-control.h b/backends/pulse/pulse-stream-control.h
index ae1bb26..07d297c 100644
--- a/backends/pulse/pulse-stream-control.h
+++ b/backends/pulse/pulse-stream-control.h
@@ -41,9 +41,6 @@ G_BEGIN_DECLS
#define PULSE_STREAM_CONTROL_GET_CLASS(o) \
(G_TYPE_INSTANCE_GET_CLASS ((o), PULSE_TYPE_STREAM_CONTROL, PulseStreamControlClass))
-#define PULSE_STREAM_CONTROL_GET_STREAM_INDEX(psc) \
- (pulse_stream_get_index (PULSE_STREAM (mate_mixer_stream_control_get_stream (MATE_MIXER_STREAM_CONTROL (psc)))))
-
typedef struct _PulseStreamControlClass PulseStreamControlClass;
typedef struct _PulseStreamControlPrivate PulseStreamControlPrivate;
@@ -68,25 +65,26 @@ struct _PulseStreamControlClass
PulseMonitor *(*create_monitor) (PulseStreamControl *control);
};
-GType pulse_stream_control_get_type (void) G_GNUC_CONST;
+GType pulse_stream_control_get_type (void) G_GNUC_CONST;
-guint32 pulse_stream_control_get_index (PulseStreamControl *control);
+guint32 pulse_stream_control_get_index (PulseStreamControl *control);
+guint32 pulse_stream_control_get_stream_index (PulseStreamControl *control);
-PulseConnection * pulse_stream_control_get_connection (PulseStreamControl *control);
-PulseMonitor * pulse_stream_control_get_monitor (PulseStreamControl *control);
+PulseConnection * pulse_stream_control_get_connection (PulseStreamControl *control);
+PulseMonitor * pulse_stream_control_get_monitor (PulseStreamControl *control);
-const pa_cvolume * pulse_stream_control_get_cvolume (PulseStreamControl *control);
-const pa_channel_map *pulse_stream_control_get_channel_map (PulseStreamControl *control);
+const pa_cvolume * pulse_stream_control_get_cvolume (PulseStreamControl *control);
+const pa_channel_map *pulse_stream_control_get_channel_map (PulseStreamControl *control);
-void pulse_stream_control_set_app_info (PulseStreamControl *stream,
- MateMixerAppInfo *info,
- gboolean take);
+void pulse_stream_control_set_app_info (PulseStreamControl *stream,
+ MateMixerAppInfo *info,
+ gboolean take);
-void pulse_stream_control_set_channel_map (PulseStreamControl *control,
- const pa_channel_map *map);
-void pulse_stream_control_set_cvolume (PulseStreamControl *control,
- const pa_cvolume *cvolume,
- pa_volume_t base_volume);
+void pulse_stream_control_set_channel_map (PulseStreamControl *control,
+ const pa_channel_map *map);
+void pulse_stream_control_set_cvolume (PulseStreamControl *control,
+ const pa_cvolume *cvolume,
+ pa_volume_t base_volume);
G_END_DECLS
diff --git a/backends/pulse/pulse-stream.c b/backends/pulse/pulse-stream.c
index 9856c98..50b821e 100644
--- a/backends/pulse/pulse-stream.c
+++ b/backends/pulse/pulse-stream.c
@@ -164,7 +164,7 @@ pulse_stream_dispose (GObject *object)
guint32
pulse_stream_get_index (PulseStream *stream)
{
- g_return_val_if_fail (PULSE_IS_STREAM (stream), 0);
+ g_return_val_if_fail (PULSE_IS_STREAM (stream), PA_INVALID_INDEX);
return stream->priv->index;
}