summaryrefslogtreecommitdiff
path: root/backends/alsa/alsa-stream-input-control.c
diff options
context:
space:
mode:
authorMichal Ratajsky <[email protected]>2016-01-04 20:31:14 +0100
committerMichal Ratajsky <[email protected]>2016-01-04 20:31:14 +0100
commit9772797c31ebed2417b42a9389caae1b16847e86 (patch)
tree0257271d6f8387ce89984bf8341b11186381c8d5 /backends/alsa/alsa-stream-input-control.c
parentd32ca3f420d036cd750fc1aad7f95da40559cc5d (diff)
downloadlibmatemixer-9772797c31ebed2417b42a9389caae1b16847e86.tar.bz2
libmatemixer-9772797c31ebed2417b42a9389caae1b16847e86.tar.xz
Improve error checking in many places
Diffstat (limited to 'backends/alsa/alsa-stream-input-control.c')
-rw-r--r--backends/alsa/alsa-stream-input-control.c16
1 files changed, 11 insertions, 5 deletions
diff --git a/backends/alsa/alsa-stream-input-control.c b/backends/alsa/alsa-stream-input-control.c
index 1954008..5f5e90e 100644
--- a/backends/alsa/alsa-stream-input-control.c
+++ b/backends/alsa/alsa-stream-input-control.c
@@ -25,6 +25,7 @@
#include "alsa-compat.h"
#include "alsa-constants.h"
#include "alsa-element.h"
+#include "alsa-stream.h"
#include "alsa-stream-control.h"
#include "alsa-stream-input-control.h"
@@ -82,6 +83,11 @@ alsa_stream_input_control_new (const gchar *name,
MateMixerStreamControlRole role,
AlsaStream *stream)
{
+
+ g_return_val_if_fail (name != NULL, NULL);
+ g_return_val_if_fail (label != NULL, NULL);
+ g_return_val_if_fail (ALSA_IS_STREAM (stream), NULL);
+
return g_object_new (ALSA_TYPE_STREAM_INPUT_CONTROL,
"name", name,
"label", label,
@@ -133,7 +139,7 @@ alsa_stream_input_control_set_mute (AlsaStreamControl *control, gboolean mute)
snd_mixer_elem_t *el;
gint ret;
- g_return_val_if_fail (ALSA_IS_STREAM_CONTROL (control), FALSE);
+ g_return_val_if_fail (ALSA_IS_STREAM_INPUT_CONTROL (control), FALSE);
el = alsa_element_get_snd_element (ALSA_ELEMENT (control));
if G_UNLIKELY (el == NULL)
@@ -154,7 +160,7 @@ alsa_stream_input_control_set_volume (AlsaStreamControl *control, guint volume)
snd_mixer_elem_t *el;
gint ret;
- g_return_val_if_fail (ALSA_IS_STREAM_CONTROL (control), FALSE);
+ g_return_val_if_fail (ALSA_IS_STREAM_INPUT_CONTROL (control), FALSE);
el = alsa_element_get_snd_element (ALSA_ELEMENT (control));
if G_UNLIKELY (el == NULL)
@@ -177,7 +183,7 @@ alsa_stream_input_control_set_channel_volume (AlsaStreamControl *contr
snd_mixer_elem_t *el;
gint ret;
- g_return_val_if_fail (ALSA_IS_STREAM_CONTROL (control), FALSE);
+ g_return_val_if_fail (ALSA_IS_STREAM_INPUT_CONTROL (control), FALSE);
el = alsa_element_get_snd_element (ALSA_ELEMENT (control));
if G_UNLIKELY (el == NULL)
@@ -202,7 +208,7 @@ alsa_stream_input_control_get_volume_from_decibel (AlsaStreamControl *control,
glong value;
gint ret;
- g_return_val_if_fail (ALSA_IS_STREAM_CONTROL (control), FALSE);
+ g_return_val_if_fail (ALSA_IS_STREAM_INPUT_CONTROL (control), FALSE);
el = alsa_element_get_snd_element (ALSA_ELEMENT (control));
if G_UNLIKELY (el == NULL)
@@ -231,7 +237,7 @@ alsa_stream_input_control_get_decibel_from_volume (AlsaStreamControl *control,
glong value;
gint ret;
- g_return_val_if_fail (ALSA_IS_STREAM_CONTROL (control), FALSE);
+ g_return_val_if_fail (ALSA_IS_STREAM_INPUT_CONTROL (control), FALSE);
el = alsa_element_get_snd_element (ALSA_ELEMENT (control));
if G_UNLIKELY (el == NULL)