-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathlibOpenSLES.iid.c
45 lines (40 loc) · 1.01 KB
/
libOpenSLES.iid.c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
#define LOG_TAG "OpenSLES-nb"
#include <dlfcn.h>
#include <cutils/log.h>
#define DEFINE_IID(iid) \
const void *iid __attribute__((visibility("default"))) = NULL;
#include "libOpenSLES.iid.h"
#undef DEFINE_IID
static void *libOpenSLES;
__attribute__((constructor))
static void initialize_IID()
{
ALOGI("initializing OpenSLES IID list");
libOpenSLES = dlopen("/system/lib/arm/libOpenSLES.so", RTLD_LAZY);
if (libOpenSLES) {
void *sym;
#define DEFINE_IID(iid) \
sym = dlsym(libOpenSLES, #iid); \
if (sym) \
iid = *(void **) sym; \
else \
ALOGE("unable to find " #iid ": %s", dlerror());
#include "libOpenSLES.iid.h"
#undef DEFINE_IID
}
else {
ALOGE("unable to open libOpenSLES.so: %s", dlerror());
}
}
__attribute__((destructor))
static void uninitialize_IID()
{
if (libOpenSLES) {
dlclose(libOpenSLES);
libOpenSLES = NULL;
#define DEFINE_IID(iid) \
iid = NULL;
#include "libOpenSLES.iid.h"
#undef DEFINE_IID
}
}