ext/alsa/gstalsa.c: Try to get devic-name from device string first, and from handle only as fallback (seems to yield ...

Original commit message from CVS:
* ext/alsa/gstalsa.c: (gst_alsa_find_device_name):
Try to get devic-name from device string first, and from handle only
as fallback (seems to yield better results and is more robust
against buggy probing code on the application side).
This commit is contained in:
Tim-Philipp Müller 2007-02-09 09:58:28 +00:00
parent 880da4d8f1
commit 662c557cc2
2 changed files with 18 additions and 11 deletions

View file

@ -1,3 +1,10 @@
2007-02-09 Tim-Philipp Müller <tim at centricular dot net>
* ext/alsa/gstalsa.c: (gst_alsa_find_device_name):
Try to get devic-name from device string first, and from handle only
as fallback (seems to yield better results and is more robust
against buggy probing code on the application side).
2007-02-08 Tim-Philipp Müller <tim at centricular dot net> 2007-02-08 Tim-Philipp Müller <tim at centricular dot net>
Based on patch by: Julien Puydt <julien.puydt at laposte net> Based on patch by: Julien Puydt <julien.puydt at laposte net>

View file

@ -451,17 +451,7 @@ gst_alsa_find_device_name (GstObject * obj, const gchar * device,
{ {
gchar *ret = NULL; gchar *ret = NULL;
if (handle != NULL) { if (device != NULL) {
snd_pcm_info_t *info;
GST_LOG_OBJECT (obj, "Trying to get device name from open handle");
snd_pcm_info_malloc (&info);
snd_pcm_info (handle, info);
ret = g_strdup (snd_pcm_info_get_name (info));
snd_pcm_info_free (info);
}
if (ret == NULL && device != NULL) {
gchar *dev, *comma; gchar *dev, *comma;
gint devnum; gint devnum;
@ -477,6 +467,16 @@ gst_alsa_find_device_name (GstObject * obj, const gchar * device,
g_free (dev); g_free (dev);
} }
if (ret == NULL && handle != NULL) {
snd_pcm_info_t *info;
GST_LOG_OBJECT (obj, "Trying to get device name from open handle");
snd_pcm_info_malloc (&info);
snd_pcm_info (handle, info);
ret = g_strdup (snd_pcm_info_get_name (info));
snd_pcm_info_free (info);
}
GST_LOG_OBJECT (obj, "Device name for device '%s': %s", GST_LOG_OBJECT (obj, "Device name for device '%s': %s",
GST_STR_NULL (device), GST_STR_NULL (ret)); GST_STR_NULL (device), GST_STR_NULL (ret));