From 851c4a0b3615234ff3930389dd666205c2863c64 Mon Sep 17 00:00:00 2001 From: Michal Ratajsky Date: Tue, 5 Jan 2016 11:14:12 +0100 Subject: pulse: Turn a macro into a function and provide error checking --- backends/pulse/pulse-stream-control.c | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) (limited to 'backends/pulse/pulse-stream-control.c') 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) { -- cgit v1.2.1