summaryrefslogtreecommitdiffstats
path: root/ext/hal
diff options
context:
space:
mode:
authorTim-Philipp Müller <tim@centricular.net>2007-02-07 13:08:34 +0000
committerTim-Philipp Müller <tim@centricular.net>2007-02-07 13:08:34 +0000
commit784a4689e03678e4667756df4f5cbdcc850d4cbd (patch)
tree9e30ad739ede735f07f1293e4e1b6b0f816a8b74 /ext/hal
parent2a873dd98e5d8c0800ae85030fea8a420da2da32 (diff)
ext/hal/hal.*: Some small cleanups; deal with errors when parsing the HAL ALSA capabilities a bit better.
Original commit message from CVS: * ext/hal/hal.c: (gst_hal_get_string): * ext/hal/hal.h: Some small cleanups; deal with errors when parsing the HAL ALSA capabilities a bit better.
Diffstat (limited to 'ext/hal')
-rw-r--r--ext/hal/hal.c40
-rw-r--r--ext/hal/hal.h5
2 files changed, 24 insertions, 21 deletions
diff --git a/ext/hal/hal.c b/ext/hal/hal.c
index 9b55f6d6..519258d6 100644
--- a/ext/hal/hal.c
+++ b/ext/hal/hal.c
@@ -42,15 +42,13 @@
* Returns: a newly allocated #gchar string containing the appropriate pipeline
* for UDI @udi, or NULL in the case of an error..
*/
-gchar *
+static gchar *
gst_hal_get_string (const gchar * udi)
{
DBusConnection *connection;
DBusError error;
LibHalContext *ctx;
- char *type, *string;
- char *element;
- int card, device;
+ char *string;
dbus_error_init (&error);
@@ -66,23 +64,27 @@ gst_hal_get_string (const gchar * udi)
string = NULL;
if (libhal_device_query_capability (ctx, udi, "alsa", &error)) {
+ char *type, *element = NULL;
+
type = libhal_device_get_property_string (ctx, udi, "alsa.type", &error);
- if (strcmp (type, "playback") == 0) {
+ if (type != NULL && strcmp (type, "playback") == 0) {
element = "alsasink";
- } else if (strcmp (type, "capture") == 0) {
+ } else if (type != NULL && strcmp (type, "capture") == 0) {
element = "alsasrc";
- } else {
- element = NULL;
}
- card = libhal_device_get_property_int (ctx, udi, "alsa.card", &error);
- device = libhal_device_get_property_int (ctx, udi, "alsa.device", &error);
- if (device == 0) {
- /* handle default device specially to use
- * dmix, dsnoop, and softvol if appropriate */
- string = g_strdup_printf ("%s device=default:%d", element, card);
- } else {
- string =
- g_strdup_printf ("%s device=plughw:%d,%d", element, card, device);
+ if (element) {
+ int card, device;
+
+ card = libhal_device_get_property_int (ctx, udi, "alsa.card", &error);
+ device = libhal_device_get_property_int (ctx, udi, "alsa.device", &error);
+ if (device == 0) {
+ /* handle default device specially to use
+ * dmix, dsnoop, and softvol if appropriate */
+ string = g_strdup_printf ("%s device=default:%d", element, card);
+ } else {
+ string =
+ g_strdup_printf ("%s device=plughw:%d,%d", element, card, device);
+ }
}
}
@@ -91,6 +93,10 @@ gst_hal_get_string (const gchar * udi)
dbus_error_free (&error);
+ if (string == NULL) {
+ GST_WARNING ("Problem parsing HAL ALSA capabilities for udi %s", udi);
+ }
+
return string;
}
diff --git a/ext/hal/hal.h b/ext/hal/hal.h
index 194d1ce6..3d5bb05b 100644
--- a/ext/hal/hal.h
+++ b/ext/hal/hal.h
@@ -31,10 +31,7 @@
G_BEGIN_DECLS
-gchar * gst_hal_get_string (const gchar *udi);
-
-GstElement * gst_hal_render_bin_from_udi (const gchar *udi);
-GstElement * gst_hal_render_bin_from_description (const gchar *description);
+GstElement * gst_hal_render_bin_from_udi (const gchar *udi);
GstElement * gst_hal_get_audio_sink (const gchar *udi);
GstElement * gst_hal_get_audio_src (const gchar *udi);