* only load an OSS driver for the first device of a sound card, similar to what is done for ALSA.

* fix a mem leak


git-svn-id: file:///home/lennart/svn/public/pulseaudio/trunk@1217 fefdeb5f-60dc-0310-8127-8f9354f1896f
This commit is contained in:
Lennart Poettering 2006-08-12 13:18:34 +00:00
parent 7fa0744806
commit c86890d5e7

View file

@ -192,26 +192,33 @@ static dbus_bool_t hal_device_is_oss_pcm(LibHalContext *ctx, const char *udi,
DBusError *error) DBusError *error)
{ {
dbus_bool_t rv = FALSE; dbus_bool_t rv = FALSE;
char* device; char* type, *device_file = NULL;
char* type; int device;
type = libhal_device_get_property_string(ctx, udi, "oss.type", error); type = libhal_device_get_property_string(ctx, udi, "oss.type", error);
if (!type || dbus_error_is_set(error)) if (!type || dbus_error_is_set(error))
return FALSE; return FALSE;
if (!strcmp(type, "pcm")) { 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); error);
if (!device || dbus_error_is_set(error)) if (!device_file || dbus_error_is_set(error))
goto exit; goto exit;
/* hack to ignore /dev/audio style devices */ /* hack to ignore /dev/audio style devices */
if ((device = strrchr(device, '/'))) if ((e = strrchr(device_file, '/')))
rv = (pa_startswith(device + 1, "audio")) ? FALSE : TRUE; rv = !pa_startswith(e + 1, "audio");
} }
exit: exit:
libhal_free_string(type); libhal_free_string(type);
libhal_free_string(device_file);
return rv; return rv;
} }