mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-11-27 20:21:24 +00:00
ext/alsa/: Fix alsa oddness in mixer after the combination of using mixer in source/sink elements and using hw:x,y in...
Original commit message from CVS: * ext/alsa/gstalsa.c: (device_list), (gst_alsa_class_probe_devices): * ext/alsa/gstalsamixer.c: (gst_alsa_mixer_open): Fix alsa oddness in mixer after the combination of using mixer in source/sink elements and using hw:x,y instead of just hw:x.
This commit is contained in:
parent
5d568b25ce
commit
94d9342dc9
3 changed files with 41 additions and 18 deletions
|
@ -1,3 +1,11 @@
|
|||
2004-05-08 Ronald Bultje <rbultje@ronald.bitfreak.net>
|
||||
|
||||
* ext/alsa/gstalsa.c: (device_list),
|
||||
(gst_alsa_class_probe_devices):
|
||||
* ext/alsa/gstalsamixer.c: (gst_alsa_mixer_open):
|
||||
Fix alsa oddness in mixer after the combination of using mixer
|
||||
in source/sink elements and using hw:x,y instead of just hw:x.
|
||||
|
||||
2004-05-09 Benjamin Otte <otte@gnome.org>
|
||||
|
||||
* gst/wavparse/gstwavparse.c: (gst_wavparse_destroy_sourcepad),
|
||||
|
|
|
@ -319,6 +319,10 @@ device_list (snd_pcm_stream_t stream, GstAlsaClass * klass)
|
|||
int card, err, dev;
|
||||
snd_ctl_card_info_t *info;
|
||||
snd_pcm_info_t *pcminfo;
|
||||
gboolean mixer = (stream == -1);
|
||||
|
||||
if (stream == -1)
|
||||
stream = 0;
|
||||
|
||||
snd_ctl_card_info_alloca (&info);
|
||||
snd_pcm_info_alloca (&pcminfo);
|
||||
|
@ -340,9 +344,11 @@ device_list (snd_pcm_stream_t stream, GstAlsaClass * klass)
|
|||
goto next_card;
|
||||
}
|
||||
|
||||
if (mixer) {
|
||||
klass->devices = g_list_append (klass->devices, g_strdup (name));
|
||||
} else {
|
||||
dev = -1;
|
||||
while (1) {
|
||||
|
||||
gchar *gst_device;
|
||||
|
||||
snd_ctl_pcm_next_device (handle, &dev);
|
||||
|
@ -359,6 +365,7 @@ device_list (snd_pcm_stream_t stream, GstAlsaClass * klass)
|
|||
gst_device = g_strdup_printf ("hw:%d,%d", card, dev);
|
||||
klass->devices = g_list_append (klass->devices, gst_device);
|
||||
}
|
||||
}
|
||||
snd_ctl_close (handle);
|
||||
next_card:
|
||||
if (snd_card_next (&card) < 0) {
|
||||
|
@ -377,7 +384,7 @@ gst_alsa_class_probe_devices (GstAlsaClass * klass, gboolean check)
|
|||
* do function-wise look-ups. */
|
||||
|
||||
if (!init && !check) {
|
||||
snd_pcm_stream_t mode = 0;
|
||||
snd_pcm_stream_t mode = -1;
|
||||
const GList *templates;
|
||||
|
||||
/* we assume one pad template at max [zero=mixer] */
|
||||
|
|
|
@ -132,6 +132,7 @@ gst_alsa_mixer_open (GstAlsaMixer * mixer)
|
|||
{
|
||||
gint err, device;
|
||||
GstAlsa *alsa = GST_ALSA (mixer);
|
||||
gchar *nocomma;
|
||||
|
||||
mixer->mixer_handle = (snd_mixer_t *) - 1;
|
||||
|
||||
|
@ -143,9 +144,13 @@ gst_alsa_mixer_open (GstAlsaMixer * mixer)
|
|||
return FALSE;
|
||||
}
|
||||
|
||||
if ((err = snd_mixer_attach (mixer->mixer_handle, alsa->device)) < 0) {
|
||||
nocomma = g_strdup (alsa->device);
|
||||
if (strchr (nocomma, ','))
|
||||
strchr (nocomma, ',')[0] = '\0';
|
||||
|
||||
if ((err = snd_mixer_attach (mixer->mixer_handle, nocomma)) < 0) {
|
||||
GST_ERROR_OBJECT (GST_OBJECT (mixer),
|
||||
"Cannot attach mixer to sound device `%s'.", alsa->device);
|
||||
"Cannot attach mixer to sound device `%s'.", nocomma);
|
||||
goto error;
|
||||
}
|
||||
|
||||
|
@ -161,18 +166,21 @@ gst_alsa_mixer_open (GstAlsaMixer * mixer)
|
|||
|
||||
/* I don't know how to get a device name from a mixer handle. So on
|
||||
* to the ugly hacks here, then... */
|
||||
if (sscanf (alsa->device, "hw:%d", &device) == 1) {
|
||||
if (sscanf (nocomma, "hw:%d", &device) == 1) {
|
||||
gchar *name;
|
||||
|
||||
if (!snd_card_get_name (device, &name))
|
||||
alsa->cardname = name;
|
||||
}
|
||||
|
||||
g_free (nocomma);
|
||||
|
||||
return TRUE;
|
||||
|
||||
error:
|
||||
snd_mixer_close (mixer->mixer_handle);
|
||||
mixer->mixer_handle = (snd_mixer_t *) - 1;
|
||||
g_free (nocomma);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue