ext/alsa/gstalsa.c: Don't probe for playback device if we're a source element. Fixes #139658.

Original commit message from CVS:
* ext/alsa/gstalsa.c: (gst_alsa_class_probe_devices):
Don't probe for playback device if we're a source element. Fixes
#139658.
This commit is contained in:
Ronald S. Bultje 2004-04-29 00:40:14 +00:00
parent 77f14f9209
commit df0008971f
2 changed files with 19 additions and 1 deletions

View file

@ -1,3 +1,9 @@
2004-04-28 Ronald Bultje <rbultje@ronald.bitfreak.net>
* ext/alsa/gstalsa.c: (gst_alsa_class_probe_devices):
Don't probe for playback device if we're a source element. Fixes
#139658.
2004-04-29 Benjamin Otte <otte@gnome.org>
* ext/mad/gstid3tag.c: (gst_id3_tag_handle_event),

View file

@ -326,11 +326,23 @@ gst_alsa_class_probe_devices (GstAlsaClass * klass, gboolean check)
gint num, res;
gchar *dev;
snd_pcm_t *pcm;
snd_pcm_stream_t mode = 0;
const GList *templates;
/* we assume one pad template at max [zero=mixer] */
templates =
gst_element_class_get_pad_template_list (GST_ELEMENT_CLASS (klass));
if (templates) {
if (GST_PAD_TEMPLATE_DIRECTION (templates->data) == GST_PAD_SRC)
mode = SND_PCM_STREAM_CAPTURE;
else
mode = SND_PCM_STREAM_PLAYBACK;
}
for (num = 0; num < MAX_DEVICES; num++) {
dev = g_strdup_printf ("hw:%d", num);
if (!(res = snd_pcm_open (&pcm, dev, 0, SND_PCM_NONBLOCK)) ||
if (!(res = snd_pcm_open (&pcm, dev, mode, SND_PCM_NONBLOCK)) ||
res == -EBUSY) {
klass->devices = g_list_append (klass->devices, dev);