Enlightenment CVS committal
Author : devilhorns
Project : e_modules
Module : mixer
Dir : e_modules/mixer
Modified Files:
alsa_mixer.c
Log Message:
Stop mixer module from segfaulting w/ recent alsa.
Really this code all needs to be redone, just no time :(
===================================================================
RCS file: /cvs/e/e_modules/mixer/alsa_mixer.c,v
retrieving revision 1.26
retrieving revision 1.27
diff -u -3 -r1.26 -r1.27
--- alsa_mixer.c 19 Sep 2007 01:40:09 -0000 1.26
+++ alsa_mixer.c 12 Nov 2007 17:58:01 -0000 1.27
@@ -20,12 +20,6 @@
snd_ctl_card_info_t *hw_info;
int err, i;
char buf[1024];
-
- if ((err = snd_mixer_open(&handle, 0)) < 0)
- {
- printf("Cannot open mixer: %s\n", snd_strerror(err));
- return NULL;
- }
snd_ctl_card_info_alloca(&hw_info);
@@ -34,16 +28,10 @@
Mixer_Card *card;
snprintf(buf, sizeof(buf), "hw:%d", i);
- if ((err = snd_mixer_attach(handle, buf)) < 0) break;
- if ((err = snd_mixer_detach(handle, buf)) < 0)
- {
- snd_mixer_close(handle);
- break;
- }
if ((err = snd_ctl_open(&control, buf, 0)) < 0)
{
- printf("Cannot control: %s: %s\n", buf, snd_strerror(err));
- continue;
+// printf("Cannot control: %s: %s\n", buf, snd_strerror(err));
+ break;
}
if ((err = snd_ctl_card_info(control, hw_info)) < 0)
{
@@ -54,16 +42,32 @@
}
snd_ctl_close(control);
-
+ if ((err = snd_mixer_open(&handle, 0)) < 0)
+ {
+ printf("Cannot open mixer\n");
+ continue;
+ }
+ if ((err = snd_mixer_attach(handle, buf)) < 0)
+ {
+ printf("Cannot attach mixer\n");
+ snd_mixer_close(handle);
+ continue;
+ }
+ if ((err = snd_mixer_detach(handle, buf)) < 0)
+ {
+ printf("Cannot detach mixer\n");
+ snd_mixer_close(handle);
+ continue;
+ }
+
card = E_NEW(Mixer_Card, 1);
if (!card) continue;
card->name = evas_stringshare_add(buf);
card->real = evas_stringshare_add(snd_ctl_card_info_get_name(hw_info));
card->id = _alsa_get_card_id(card->real);
-
+ snd_mixer_close(handle);
cards = evas_list_append(cards, card);
}
- snd_mixer_close(handle);
return cards;
}
@@ -108,40 +112,44 @@
int err, i;
char buf[1024];
- if ((err = snd_mixer_open(&handle, 0)) < 0)
- {
- printf("Cannot open mixer: %s\n", snd_strerror(err));
- return NULL;
- }
-
- snd_ctl_card_info_alloca(&hw_info);
+ snd_ctl_card_info_alloca(&hw_info);
for (i = 0; i < 32; i++)
{
Mixer_Card *card;
snprintf(buf, sizeof(buf), "hw:%d", i);
- if ((err = snd_mixer_attach(handle, buf)) < 0) break;
- if ((err = snd_mixer_detach(handle, buf)) < 0)
+ if ((err = snd_ctl_open(&control, buf, 0)) < 0)
{
- snd_mixer_close(handle);
+// printf("Cannot control: %s: %s\n", buf, snd_strerror(err));
+ break;
+ }
+ if ((err = snd_ctl_card_info(control, hw_info)) < 0)
+ {
+ printf("Cannot get hardware info: %s: %s\n", buf,
+ snd_strerror(err));
+ snd_ctl_close(control);
continue;
}
- if ((err = snd_ctl_open(&control, buf, 0)) < 0)
+
+ snd_ctl_close(control);
+ if ((err = snd_mixer_open(&handle, 0)) < 0)
+ {
+ printf("Cannot open mixer\n");
+ continue;
+ }
+ if ((err = snd_mixer_attach(handle, buf)) < 0)
{
- printf("Cannot control: %s: %s\n", buf, snd_strerror(err));
+ printf("Cannot attach mixer\n");
snd_mixer_close(handle);
continue;
}
- if ((err = snd_ctl_card_info(control, hw_info)) < 0)
+ if ((err = snd_mixer_detach(handle, buf)) < 0)
{
- printf("Cannot get hardware info: %s: %s\n", buf,
snd_strerror(err));
- snd_ctl_close(control);
+ printf("Cannot detach mixer\n");
snd_mixer_close(handle);
continue;
}
-
- snd_ctl_close(control);
snd_mixer_close(handle);
card = E_NEW(Mixer_Card, 1);
@@ -156,7 +164,7 @@
return card;
}
//snd_ctl_close(control);
- snd_mixer_close(handle);
+// snd_mixer_close(handle);
return NULL;
}
-------------------------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems? Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now >> http://get.splunk.com/
_______________________________________________
enlightenment-cvs mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/enlightenment-cvs