From 1897445a80677ec89e7eef9f2a76e630fd088588 Mon Sep 17 00:00:00 2001 From: Michal Ratajsky Date: Fri, 31 Oct 2014 14:39:11 +0100 Subject: oss: Improve *_list_streams functions and handling of device streams Makes the functions compatible with the ALSA code. As streams in OSS are not dynamic elements, they are removed as soon as they are known to be useless. --- backends/oss/oss-backend.c | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) (limited to 'backends/oss/oss-backend.c') diff --git a/backends/oss/oss-backend.c b/backends/oss/oss-backend.c index 78ed69b..eb4d742 100644 --- a/backends/oss/oss-backend.c +++ b/backends/oss/oss-backend.c @@ -268,23 +268,23 @@ oss_backend_list_streams (MateMixerBackend *backend) /* Walk through the list of devices and create the stream list, each * device has at most one input and one output stream */ - list = oss->priv->devices; + list = g_list_last (oss->priv->devices); while (list != NULL) { OssDevice *device = OSS_DEVICE (list->data); OssStream *stream; - stream = oss_device_get_input_stream (device); - if (stream != NULL) { - oss->priv->streams = - g_list_append (oss->priv->streams, g_object_ref (stream)); - } stream = oss_device_get_output_stream (device); - if (stream != NULL) { + if (stream != NULL) oss->priv->streams = - g_list_append (oss->priv->streams, g_object_ref (stream)); - } - list = list->next; + g_list_prepend (oss->priv->streams, g_object_ref (stream)); + + stream = oss_device_get_input_stream (device); + if (stream != NULL) + oss->priv->streams = + g_list_prepend (oss->priv->streams, g_object_ref (stream)); + + list = list->prev; } } return oss->priv->streams; -- cgit v1.2.1