summaryrefslogtreecommitdiff
path: root/backends/alsa/alsa-device.c
diff options
context:
space:
mode:
authorMichal Ratajsky <[email protected]>2014-10-31 14:33:16 +0100
committerMichal Ratajsky <[email protected]>2014-10-31 14:33:16 +0100
commitb839e8ca0c73f9715654497e241d4aa3e3042125 (patch)
treee7fad3a59d028ba407c4af4ef3b27b1e74085527 /backends/alsa/alsa-device.c
parent9d928d858194db5bb65535f521e4f9e169f1b2d9 (diff)
downloadlibmatemixer-b839e8ca0c73f9715654497e241d4aa3e3042125.tar.bz2
libmatemixer-b839e8ca0c73f9715654497e241d4aa3e3042125.tar.xz
alsa: Improve *_list_streams functions
Avoids including useless streams in the list and optimizes GList construction.
Diffstat (limited to 'backends/alsa/alsa-device.c')
-rw-r--r--backends/alsa/alsa-device.c17
1 files changed, 11 insertions, 6 deletions
diff --git a/backends/alsa/alsa-device.c b/backends/alsa/alsa-device.c
index 6a2c54a..643e46e 100644
--- a/backends/alsa/alsa-device.c
+++ b/backends/alsa/alsa-device.c
@@ -465,12 +465,17 @@ alsa_device_list_streams (MateMixerDevice *mmd)
device = ALSA_DEVICE (mmd);
if (device->priv->streams == NULL) {
- if (device->priv->output != NULL)
- device->priv->streams = g_list_prepend (device->priv->streams,
- g_object_ref (device->priv->output));
- if (device->priv->input != NULL)
- device->priv->streams = g_list_prepend (device->priv->streams,
- g_object_ref (device->priv->input));
+ AlsaStream *stream;
+
+ stream = alsa_device_get_output_stream (device);
+ if (stream != NULL)
+ device->priv->streams =
+ g_list_prepend (device->priv->streams, g_object_ref (stream));
+
+ stream = alsa_device_get_input_stream (device);
+ if (stream != NULL)
+ device->priv->streams =
+ g_list_prepend (device->priv->streams, g_object_ref (stream));
}
return device->priv->streams;
}