[pulseaudio-commits] r1217 - /trunk/src/modules/module-hal-detect.c

svnmailer-noreply at 0pointer.de svnmailer-noreply at 0pointer.de
Sat Aug 12 06:18:37 PDT 2006


Author: lennart
Date: Sat Aug 12 15:18:34 2006
New Revision: 1217

URL: http://0pointer.de/cgi-bin/viewcvs.cgi?rev=1217&root=pulseaudio&view=rev
Log:
* only load an OSS driver for the first device of a sound card, similar to what is done for ALSA. 
* fix a mem leak

Modified:
    trunk/src/modules/module-hal-detect.c

Modified: trunk/src/modules/module-hal-detect.c
URL: http://0pointer.de/cgi-bin/viewcvs.cgi/trunk/src/modules/module-hal-detect.c?rev=1217&root=pulseaudio&r1=1216&r2=1217&view=diff
==============================================================================
--- trunk/src/modules/module-hal-detect.c (original)
+++ trunk/src/modules/module-hal-detect.c Sat Aug 12 15:18:34 2006
@@ -192,26 +192,33 @@
                                          DBusError *error)
 {
     dbus_bool_t rv = FALSE;
-    char* device;
-    char* type;
+    char* type, *device_file = NULL;
+    int device;
 
     type = libhal_device_get_property_string(ctx, udi, "oss.type", error);
     if (!type || dbus_error_is_set(error))
         return FALSE;
-
+    
     if (!strcmp(type, "pcm")) {
-        device = libhal_device_get_property_string(ctx, udi, "oss.device_file",
+        char *e;
+
+        device = libhal_device_get_property_int(ctx, udi, "oss.device", error);
+        if (dbus_error_is_set(error) || device != 0)
+            goto exit;
+
+        device_file = libhal_device_get_property_string(ctx, udi, "oss.device_file",
                                                    error);
-        if (!device || dbus_error_is_set(error))
+        if (!device_file || dbus_error_is_set(error))
             goto exit;
 
         /* hack to ignore /dev/audio style devices */
-        if ((device = strrchr(device, '/')))
-            rv = (pa_startswith(device + 1, "audio")) ? FALSE : TRUE;
+        if ((e = strrchr(device_file, '/')))
+            rv = !pa_startswith(e + 1, "audio");
     }
 
 exit:
     libhal_free_string(type);
+    libhal_free_string(device_file);
     return rv;
 }
 




More information about the pulseaudio-commits mailing list