summaryrefslogtreecommitdiff
path: root/src/mixer/simple_abst.c
diff options
context:
space:
mode:
authorJaroslav Kysela <perex@perex.cz>2005-06-07 11:44:25 +0000
committerJaroslav Kysela <perex@perex.cz>2005-06-07 11:44:25 +0000
commit4c4849230c739ab5f412160f0a7b9c98a204b8aa (patch)
tree447d136c8a965bcd938dbda471d6bfba87bd086e /src/mixer/simple_abst.c
parentc9d343a0ccc55e6298c1f60cb5355337f3403daa (diff)
downloadalsa-lib-4c4849230c739ab5f412160f0a7b9c98a204b8aa.tar.gz
initial & empty smixer-ac97.so module (only the build framework)
Diffstat (limited to 'src/mixer/simple_abst.c')
-rw-r--r--src/mixer/simple_abst.c21
1 files changed, 15 insertions, 6 deletions
diff --git a/src/mixer/simple_abst.c b/src/mixer/simple_abst.c
index 29f421f2..13a59585 100644
--- a/src/mixer/simple_abst.c
+++ b/src/mixer/simple_abst.c
@@ -39,27 +39,33 @@
#include "asoundlib.h"
#include "mixer_simple.h"
-#define SO_PATH PKGLIBDIR "/smixer/"
+#define SO_PATH PKGLIBDIR "/smixer"
typedef struct _class_priv {
char *device;
snd_ctl_t *ctl;
snd_hctl_t *hctl;
snd_ctl_card_info_t *info;
-} class_priv_t;
+ void *dlhandle;
+} class_priv_t;
static int try_open(snd_mixer_class_t *class, const char *lib)
{
+ class_priv_t *priv = snd_mixer_class_get_private(class);
snd_mixer_event_t event_func;
- char *xlib;
+ char *xlib, *path;
void *h;
- xlib = malloc(strlen(lib) + strlen(SO_PATH) + 1);
+ path = getenv("ALSA_MIXER_SIMPLE_MODULES");
+ if (!path)
+ path = SO_PATH;
+ xlib = malloc(strlen(lib) + strlen(path) + 1 + 1);
if (xlib == NULL)
return -ENOMEM;
- strcpy(xlib, SO_PATH);
+ strcpy(xlib, path);
+ strcat(xlib, "/");
strcat(xlib, lib);
- h = snd_dlopen(lib, RTLD_NOW);
+ h = snd_dlopen(xlib, RTLD_NOW);
if (h == NULL) {
SNDERR("Unable to open library '%s'", xlib);
free(xlib);
@@ -74,6 +80,7 @@ static int try_open(snd_mixer_class_t *class, const char *lib)
}
free(xlib);
snd_mixer_class_set_event(class, event_func);
+ priv->dlhandle = h;
return 0;
}
@@ -140,6 +147,8 @@ static void private_free(snd_mixer_class_t *class)
{
class_priv_t *priv = snd_mixer_class_get_private(class);
+ if (priv->dlhandle)
+ snd_dlclose(priv->dlhandle);
if (priv->info)
snd_ctl_card_info_free(priv->info);
if (priv->hctl)