[-]
[+]
|
Changed |
_service:tar_git:pulseaudio-modules-droid-glue.changes
|
|
[-]
[+]
|
Changed |
_service:tar_git:pulseaudio-modules-droid-glue.spec
^
|
|
[-]
[+]
|
Changed |
_service:tar_git:pulseaudio-modules-droid-glue-12.2.4.tar.bz2/configure.ac
^
|
@@ -172,8 +172,6 @@
AC_SUBST(PULSEAUDIO_CFLAGS)
AC_SUBST(PULSEAUDIO_LIBS)
-pulseaudiodir=`pkg-config --variable=prefix pulsecore`
-
PKG_CHECK_MODULES([DROIDHEADERS], [android-headers])
AC_SUBST(DROIDHEADERS_CFLAGS)
@@ -181,7 +179,7 @@
AC_SUBST(HYBRIS_CFLAGS)
AC_SUBST(HYBRIS_LIBS)
-PKG_CHECK_MODULES([DROIDUTIL], [libdroid-util >= 6.0.41])
+PKG_CHECK_MODULES([DROIDUTIL], [libdroid-util >= 63])
AC_SUBST(DROIDUTIL_CFLAGS)
AC_SUBST(DROIDUTIL_LIBS)
@@ -189,12 +187,28 @@
[],
[AC_MSG_ERROR([Could not find or include audioflingerglue.h])])
-AC_ARG_WITH([module-dir],
- AS_HELP_STRING([--with-module-dir],[Directory where to install the modules to (defaults to ${pulseaudiodir}/lib/pulse-${PA_MAJORMINOR}/modules/]),
- [modlibexecdir=$withval], [modlibexecdir="${pulseaudiodir}/lib/pulse-${PA_MAJORMINOR}/modules"])
+AC_ARG_WITH(
+ [module-dir],
+ AS_HELP_STRING([--with-module-dir],[Directory where to install the modules to (defaults to ${libdir}/pulse-${PA_MAJORMINOR}/modules]),
+ [modlibexecdir=$withval], [modlibexecdir="${libdir}/pulse-${PA_MAJORMINOR}/modules"])
AC_SUBST(modlibexecdir)
+audioflingergluename="libaudioflingerglue.so"
+AC_ARG_WITH([audioflingerglue-name],
+ AS_HELP_STRING([--with-audioflingerglue-name], [Audioglingerglue library name (default libaudioflingerglue.so)]),
+ [afname=$withval], [afname=$audioflingergluename]
+ )
+LIB_AF_CFLAGS="-DLIB_AF_NAME=\"\\\"${afname}\\\"\""
+
+audioflingergluebase="/usr/libexec/droid-hybris/system"
+AC_ARG_WITH([audioflingerglue-base],
+ AS_HELP_STRING([--with-audioflingerglue-base], [Audioglingerglue library base path (default /usr/libexec/droid-hybris/system)]),
+ [afpath=$withval], [afpath=$audioflingergluebase]
+ )
+LIB_AF_CFLAGS+=" -DLIB_AF_BASE_PATH=\"\\\"${afpath}\\\"\""
+AC_SUBST([LIB_AF_CFLAGS])
+
############################################
# Droid device type
droiddevice="generic"
@@ -235,8 +249,10 @@
CFLAGS: ${CFLAGS}
prefix: ${prefix}
- PulseAudio prefix: ${pulseaudiodir}
modules directory: ${modlibexecdir}
+ Audioflingerglue name: ${afname}
+ library base path: ${afpath}
+
Droid device ${droiddevice}
"
|
[-]
[+]
|
Changed |
_service:tar_git:pulseaudio-modules-droid-glue-12.2.4.tar.bz2/src/glue/Makefile.am
^
|
@@ -7,6 +7,7 @@
$(PULSEAUDIO_CFLAGS) \
$(DROIDHEADERS_CFLAGS) \
$(HYBRIS_CFLAGS) \
+ $(LIB_AF_CFLAGS) \
$(DROIDUTIL_CFLAGS) \
-DPULSEAUDIO_VERSION=@PA_MAJOR@ \
-I$(top_srcdir)/src/glue
|
[-]
[+]
|
Changed |
_service:tar_git:pulseaudio-modules-droid-glue-12.2.4.tar.bz2/src/glue/module-droid-glue.c
^
|
@@ -25,6 +25,7 @@
#include <signal.h>
#include <stdio.h>
+#include <dlfcn.h>
#ifdef HAVE_VALGRIND_MEMCHECK_H
#include <valgrind/memcheck.h>
@@ -45,6 +46,7 @@
#include "module-droid-glue-symdef.h"
+#include <hybris/common/binding.h>
#include <audioflingerglue.h>
PA_MODULE_AUTHOR("Juho Hämäläinen");
@@ -52,15 +54,28 @@
PA_MODULE_VERSION(PACKAGE_VERSION);
PA_MODULE_USAGE(
"module_id=<which droid hw module to load, default primary> "
+ "lib=<absolute path to audioflingerglue library. if not defined try to autodetect>"
);
static const char* const valid_modargs[] = {
"module_id",
+ "lib",
NULL,
};
+#define AF_LIB32 LIB_AF_BASE_PATH "/lib/" LIB_AF_NAME
+#define AF_LIB64 LIB_AF_BASE_PATH "/lib64/" LIB_AF_NAME
+
+static const char* const lib_paths[] = {
+ AF_LIB32,
+ AF_LIB64,
+ NULL
+};
+
#define DEFAULT_MODULE_ID "primary"
+static void *audioflingerglue_handle;
+
struct userdata {
pa_core *core;
pa_module *module;
@@ -96,14 +111,39 @@
*reply = u->hw_module->device->get_parameters(u->hw_module->device, keys);
pa_droid_hw_module_unlock(u->hw_module);
- pa_log_debug("Glue get_parameters(\"%s\"): \"%s\"", keys, *reply ?: "<null>");
+ pa_log_debug("Glue get_parameters(\"%s\"): \"%s\"", keys, *reply ? *reply : "<null>");
return *reply ? 0 : 1;
}
+static bool audioflingerglue_initialize(const char *path) {
+ if ((audioflingerglue_handle = android_dlopen(path, RTLD_LAZY)))
+ return true;
+
+ return false;
+}
+
+static bool file_exists(const char *path) {
+ return access(path, F_OK) == 0 ? true : false;
+}
+
+static const char *detect_lib_path(void) {
+ int i;
+
+ for (i = 0; lib_paths[i]; i++) {
+ bool found = file_exists(lib_paths[i]);
+ pa_log_debug("look for %s...%s", lib_paths[i], found ? "found" : "no");
+ if (found)
+ return lib_paths[i];
+ }
+
+ return NULL;
+}
+
int pa__init(pa_module *m) {
pa_modargs *ma = NULL;
const char *module_id;
+ const char *lib_path;
DroidAfGlueCallbacks cb;
pa_assert(m);
@@ -113,6 +153,24 @@
goto fail;
}
+ if ((lib_path = pa_modargs_get_value(ma, "lib", NULL))) {
+ if (!file_exists(lib_path)) {
+ pa_log("Audioflingerglue library with path '%s' not found.", lib_path);
+ goto fail;
+ }
+ } else
+ lib_path = detect_lib_path();
+
+ if (!lib_path) {
+ pa_log("Could not find audioflingerglue library.");
+ goto fail;
+ }
+
+ if (!audioflingerglue_initialize(lib_path)) {
+ pa_log("Could not load audioflingerglue library.");
+ goto fail;
+ }
+
struct userdata *u = pa_xnew0(struct userdata, 1);
u->core = m->core;
m->userdata = u;
|