mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-12-24 09:10:36 +00:00
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.
This commit is contained in:
parent
2a873dd98e
commit
784a4689e0
4 changed files with 32 additions and 22 deletions
|
@ -1,3 +1,10 @@
|
||||||
|
2007-01-30 Tim-Philipp Müller <tim at centricular dot net>
|
||||||
|
|
||||||
|
* 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.
|
||||||
|
|
||||||
2007-02-06 Tim-Philipp Müller <tim at centricular dot net>
|
2007-02-06 Tim-Philipp Müller <tim at centricular dot net>
|
||||||
|
|
||||||
* gst/smpte/gstsmpte.c: (gst_smpte_transition_type_get_type):
|
* gst/smpte/gstsmpte.c: (gst_smpte_transition_type_get_type):
|
||||||
|
|
2
common
2
common
|
@ -1 +1 @@
|
||||||
Subproject commit 8ba5dffb5ee7e7daea1030f6b34bfef10f9801a3
|
Subproject commit de43a8f3c629983e0bea0b8eb617e52ed35a6cda
|
|
@ -42,15 +42,13 @@
|
||||||
* Returns: a newly allocated #gchar string containing the appropriate pipeline
|
* Returns: a newly allocated #gchar string containing the appropriate pipeline
|
||||||
* for UDI @udi, or NULL in the case of an error..
|
* for UDI @udi, or NULL in the case of an error..
|
||||||
*/
|
*/
|
||||||
gchar *
|
static gchar *
|
||||||
gst_hal_get_string (const gchar * udi)
|
gst_hal_get_string (const gchar * udi)
|
||||||
{
|
{
|
||||||
DBusConnection *connection;
|
DBusConnection *connection;
|
||||||
DBusError error;
|
DBusError error;
|
||||||
LibHalContext *ctx;
|
LibHalContext *ctx;
|
||||||
char *type, *string;
|
char *string;
|
||||||
char *element;
|
|
||||||
int card, device;
|
|
||||||
|
|
||||||
dbus_error_init (&error);
|
dbus_error_init (&error);
|
||||||
|
|
||||||
|
@ -66,23 +64,27 @@ gst_hal_get_string (const gchar * udi)
|
||||||
string = NULL;
|
string = NULL;
|
||||||
|
|
||||||
if (libhal_device_query_capability (ctx, udi, "alsa", &error)) {
|
if (libhal_device_query_capability (ctx, udi, "alsa", &error)) {
|
||||||
|
char *type, *element = NULL;
|
||||||
|
|
||||||
type = libhal_device_get_property_string (ctx, udi, "alsa.type", &error);
|
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";
|
element = "alsasink";
|
||||||
} else if (strcmp (type, "capture") == 0) {
|
} else if (type != NULL && strcmp (type, "capture") == 0) {
|
||||||
element = "alsasrc";
|
element = "alsasrc";
|
||||||
} else {
|
|
||||||
element = NULL;
|
|
||||||
}
|
}
|
||||||
card = libhal_device_get_property_int (ctx, udi, "alsa.card", &error);
|
if (element) {
|
||||||
device = libhal_device_get_property_int (ctx, udi, "alsa.device", &error);
|
int card, device;
|
||||||
if (device == 0) {
|
|
||||||
/* handle default device specially to use
|
card = libhal_device_get_property_int (ctx, udi, "alsa.card", &error);
|
||||||
* dmix, dsnoop, and softvol if appropriate */
|
device = libhal_device_get_property_int (ctx, udi, "alsa.device", &error);
|
||||||
string = g_strdup_printf ("%s device=default:%d", element, card);
|
if (device == 0) {
|
||||||
} else {
|
/* handle default device specially to use
|
||||||
string =
|
* dmix, dsnoop, and softvol if appropriate */
|
||||||
g_strdup_printf ("%s device=plughw:%d,%d", element, card, device);
|
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);
|
dbus_error_free (&error);
|
||||||
|
|
||||||
|
if (string == NULL) {
|
||||||
|
GST_WARNING ("Problem parsing HAL ALSA capabilities for udi %s", udi);
|
||||||
|
}
|
||||||
|
|
||||||
return string;
|
return string;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -31,10 +31,7 @@
|
||||||
|
|
||||||
G_BEGIN_DECLS
|
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_udi (const gchar *udi);
|
|
||||||
GstElement * gst_hal_render_bin_from_description (const gchar *description);
|
|
||||||
|
|
||||||
GstElement * gst_hal_get_audio_sink (const gchar *udi);
|
GstElement * gst_hal_get_audio_sink (const gchar *udi);
|
||||||
GstElement * gst_hal_get_audio_src (const gchar *udi);
|
GstElement * gst_hal_get_audio_src (const gchar *udi);
|
||||||
|
|
Loading…
Reference in a new issue