Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 20 additions & 6 deletions configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -41,9 +41,12 @@ AC_ARG_WITH([use_default_acdb_path],
[with_use_default_acdb_path=no])
AM_CONDITIONAL([USE_DEFAULT_ACDB_PATH], [test "x${with_use_default_acdb_path}" = "xyes"])

AC_ARG_WITH([glib],
AC_HELP_STRING([--with-glib],
[enable glib, Build against glib. Use this when building for HLOS systems which use glib]))
AC_ARG_WITH([card-def-native],
AS_HELP_STRING([--with-card-def-native=PATH],
[path to native card-defs xml (default /etc/card-defs-native.xml)]),
[card_def_native=$withval],
[card_def_native="/etc/card-defs-native.xml"])
AC_SUBST([CARD_DEF_FILE_NATIVE], [$card_def_native])

# Optional ALSALIB build support
AC_ARG_ENABLE([alsalib],
Expand All @@ -52,6 +55,16 @@ AC_ARG_ENABLE([alsalib],
[enable_alsalib=no])
AM_CONDITIONAL([BUILD_ALSALIB], [test "x$enable_alsalib" = "xyes"])

AC_ARG_WITH([cutils],
AS_HELP_STRING([Use cutils (default is no)]),
[with_cutils=$withval],
[with_cutils=no])
AM_CONDITIONAL([CUTILS_SUPPORTED], [test "x${with_cutils}" = "xyes"])

AC_ARG_WITH([glib],
AC_HELP_STRING([--with-glib],
[enable glib, Build against glib. Use this when building for HLOS systems which use glib]))

if (test "x${with_glib}" = "xyes"); then
PKG_CHECK_MODULES(GTHREAD, gthread-2.0 >= 2.16, dummy=yes,
AC_MSG_ERROR(GThread >= 2.16 is required))
Expand All @@ -66,6 +79,10 @@ fi

AM_CONDITIONAL(USE_GLIB, test "x${with_glib}" = "xyes")

AC_CHECK_FUNCS([strlcpy])
AM_CONDITIONAL(USE_G_STR_FUNC,
[test "x${with_glib}" = "xyes" && ! test "x$ac_cv_func_strlcpy" = "xyes"])

AC_ARG_WITH([no_ipc],
AS_HELP_STRING([--with-no-ipc],[disable ipc communication to AGM (default is no)]),
[with_no_ipc=$withval],
Expand All @@ -89,9 +106,6 @@ fi
AC_SUBST(DBUS_CFLAGS)
AC_SUBST(DBUS_LIBS)

AC_CHECK_FUNCS([strlcpy])
AM_CONDITIONAL(USE_G_STR_FUNC, ! test "x$ac_cv_func_strlcpy" = "xyes")

AC_CONFIG_FILES(
Makefile
service/Makefile
Expand Down
19 changes: 14 additions & 5 deletions ipc/DBus/agm_client/Makefile.am
Original file line number Diff line number Diff line change
@@ -1,11 +1,20 @@
lib_LTLIBRARIES = libagmclient.la
libagmclient_la_CPPFLAGS = -I $(top_srcdir)/service/inc/public -DAGM_USE_SYSLOG
libagmclient_la_CPPFLAGS = -I $(top_srcdir)/service/inc/public
libagmclient_la_CPPFLAGS += -I $(top_srcdir)/service/inc/public/agm
libagmclient_ladir = $(libdir)
libagmclient_la_LDFLAGS = -ldl -lrt -shared -version-number @LT_VERSION_NUMBER@
libagmclient_la_SOURCES = src/agm_client_wrapper_dbus.cpp
libagmclient_la_LIBADD =

if USE_SYSLOG
libagmclient_la_CPPFLAGS += -DAGM_USE_SYSLOG
endif

if USE_GLIB
libagmclient_la_CPPFLAGS += $(GLIB_CFLAGS)
libagmclient_la_LIBADD += $(GLIB_LIBS) -lgobject-2.0 -lgio-2.0
endif

if USE_G_STR_FUNC
libagmclient_la_CPPFLAGS += -Dstrlcpy=g_strlcpy -Dstrlcat=g_strlcat
endif
libagmclient_ladir = $(libdir)
libagmclient_la_LDFLAGS = -ldl -lrt -shared -version-number @LT_VERSION_NUMBER@
libagmclient_la_SOURCES = src/agm_client_wrapper_dbus.cpp
libagmclient_la_LDFLAGS += $(GLIB_LIBS) -lgobject-2.0 -lgio-2.0
20 changes: 17 additions & 3 deletions ipc/DBus/agm_server/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,27 @@ AM_CPPFLAGS += -D__unused=__attribute__\(\(__unused__\)\)

lib_LTLIBRARIES = libagmserverwrapper.la
libagmserverwrapper_la_SOURCES = ./src/agm-dbus-utils.cpp ./src/agm_server_wrapper_dbus.cpp
libagmserverwrapper_la_CPPFLAGS = $(AM_CPPFLAGS) $(DBUS_CFLAGS) $(GLIB_CFLAGS) -DAGM_USE_SYSLOG
libagmserverwrapper_la_CPPFLAGS = $(AM_CPPFLAGS) $(DBUS_CFLAGS)
libagmserverwrapper_la_LIBADD = -lagm -L$(top_builddir)/service/.libs
libagmserverwrapper_la_LDFLAGS = -ldl -lpthread -lar-osal -shared -avoid-version $(DBUS_LIBS)

bin_PROGRAMS = agm_server

agm_server_SOURCES = ./src/agm-server-daemon.cpp
agm_server_CPPFLAGS = $(AM_CPPFLAGS) $(GLIB_CFLAGS) -DAGM_USE_SYSLOG -Wno-write-strings
agm_server_LDADD = libagmserverwrapper.la $(GLIB_LIBS)
agm_server_CPPFLAGS = $(AM_CPPFLAGS) -Wno-write-strings
agm_server_LDADD = libagmserverwrapper.la
agm_server_LDFLAGS = -ldl -shared -avoid-version

if USE_G_STR_FUNC
AM_CPPFLAGS += -Dstrlcpy=g_strlcpy -Dstrlcat=g_strlcat
endif

if USE_SYSLOG
AM_CPPFLAGS += -DAGM_USE_SYSLOG
endif

if USE_GLIB
AM_CPPFLAGS += $(GLIB_CFLAGS)
libagmserverwrapper_la_LIBADD += $(GLIB_LIBS)
agm_server_LDADD += $(GLIB_LIBS)
endif
18 changes: 12 additions & 6 deletions ipc/SwBinders/agm_client/Makefile.am
Original file line number Diff line number Diff line change
@@ -1,9 +1,15 @@

AM_CPPFLAGS := -I $(top_srcdir) -I $(PKG_CONFIG_SYSROOT_DIR)/usr/include/agm/
AM_CPPFLAGS = -I $(srcdir) \
-I $(PKG_CONFIG_SYSROOT_DIR)/usr/include/agm/ \
-I $(top_srcdir)/ipc/SwBinders/agm_server/inc/ \
-I $(top_srcdir)/service/inc/public/
AM_CPPFLAGS += -DDYNAMIC_LOG_ENABLED
lib_LTLIBRARIES = libagmclientwrapper.la
libagmclientwrapper_ladir = $(libdir)
libagmclientwrapper_la_SOURCES = src/agm_client_wrapper.cpp
libagmclientwrapper_la_CPPFLAGS := $(AM_CPPFLAGS)
libagmclientwrapper_la_LDFLAGS = -lcutils -llog -ldl -lbinder -shared -avoid-version -lutils -lrt
libagmclientwrapper_la_LIBADD = -lagmproxy -laudio_log_utils
libagmclientwrapper_la_SOURCES = src/agm_client_wrapper.cpp
libagmclientwrapper_la_CPPFLAGS = $(AM_CPPFLAGS)
libagmclientwrapper_la_LDFLAGS = -ldl -lbinder -shared -avoid-version -lutils -lrt
libagmclientwrapper_la_LIBADD = -L$(top_builddir)/ipc/SwBinders/agm_server/.libs -lagmproxy -laudio_log_utils

if CUTILS_SUPPORTED
libagmclientwrapper_la_LIBADD += -lcutils -llog
endif
31 changes: 21 additions & 10 deletions ipc/SwBinders/agm_server/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -17,21 +17,32 @@ library_include_HEADERS = $(h_sources)
library_includedir = $(includedir)/qti-agm-service/

lib_LTLIBRARIES = libagmserverwrapper.la
libagmserverwrapper_la_SOURCES = ${top_srcdir}/src/agm_death_notifier.cpp ${top_srcdir}/src/agm_server_wrapper.cpp ${top_srcdir}/src/agm_callback.cpp
libagmserverwrapper_la_SOURCES = ${srcdir}/src/agm_death_notifier.cpp ${srcdir}/src/agm_server_wrapper.cpp ${srcdir}/src/agm_callback.cpp

libagmserverwrapper_la_CPPFLAGS := $(AM_CPPFLAGS)
libagmserverwrapper_la_LIBADD = -lagm -laudio_log_utils
libagmserverwrapper_la_LDFLAGS = -lcutils -llog -ldl -lbinder -shared -avoid-version -lutils -lpthread
libagmserverwrapper_la_CPPFLAGS = $(AM_CPPFLAGS)
libagmserverwrapper_la_LDFLAGS = -ldl -lbinder -shared -avoid-version -lutils -lpthread

lib_LTLIBRARIES += libagmproxy.la
libagmproxy_la_SOURCES = ${top_srcdir}/src/ipc_proxy_server.cpp
libagmproxy_la_CPPFLAGS := $(AM_CPPFLAGS)
libagmproxy_la_SOURCES = ${srcdir}/src/ipc_proxy_server.cpp
libagmproxy_la_CPPFLAGS = $(AM_CPPFLAGS)
libagmproxy_la_LIBADD = libagmserverwrapper.la
libagmproxy_la_LDFLAGS = -lcutils -llog -ldl -lbinder -shared -avoid-version -lutils -lpthread
libagmproxy_la_LDFLAGS = -ldl -lbinder -shared -avoid-version -lutils -lpthread

bin_PROGRAMS := agm_server
agm_server_SOURCES := ${top_srcdir}/src/agm_server_daemon.cpp

agm_server_la_CPPFLAGS := $(AM_CPPFLAGS)
agm_server_LDADD := libagmproxy.la -laudio_log_utils
agm_server_la_LDFLAGS = -lcutils -llog -ldl -lbinder -shared -avoid-version -lutils
agm_server_CPPFLAGS = $(AM_CPPFLAGS)
agm_server_LDADD = libagmproxy.la -laudio_log_utils
libagmserverwrapper_la_LIBADD = -L$(top_builddir)/service/.libs -lagm -laudio_log_utils
agm_server_LDFLAGS = -ldl -lbinder -shared -avoid-version -lutils

if CUTILS_SUPPORTED
AM_CPPFLAGS += -DAGM_USE_CUTILS
libagmserverwrapper_la_LIBADD += -lcutils -llog
libagmproxy_la_LIBADD += -lcutils -llog
agm_server_LDADD += -lcutils -llog
endif

if USE_SYSLOG
AM_CPPFLAGS += -DAGM_USE_SYSLOG
endif
18 changes: 9 additions & 9 deletions ipc/aidl/server/AgmServerWrapper.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -92,14 +92,13 @@ void ClientInfo::setAgmServerWrapper(AgmServerWrapper *wrapper) {
sAgmServerWrapper = wrapper;
}

// cookie carries the dying client's pid, never a ClientInfo* - onDeath must
// not touch an object an earlier, duplicate obituary for the same client
// may already have freed.
void ClientInfo::onDeath(void *cookie) {
ClientInfo *client = static_cast<ClientInfo *>(cookie);
ALOGI("Client died (pid): %llu", client->getPid());
client->onDeath();
}

void ClientInfo::onDeath() {
sAgmServerWrapper->removeClient(mPid);
int pid = static_cast<int>(reinterpret_cast<intptr_t>(cookie));
ALOGI("Client died (pid): %d", pid);
sAgmServerWrapper->removeClient(pid);
}

void ClientInfo::registerCallback(const std::shared_ptr<IAGMCallback> &callback,
Expand All @@ -111,8 +110,9 @@ void ClientInfo::registerCallback(const std::shared_ptr<IAGMCallback> &callback,
agm_session_register_cb(in_sessionId, &ClientInfo::onCallback, (enum event_type)in_eventType,
(void *)callback.get());

auto linkRet = AIBinder_linkToDeath(callback->asBinder().get(), mDeathRecipient.get(),
this /* cookie */);
auto linkRet = AIBinder_linkToDeath(
callback->asBinder().get(), mDeathRecipient.get(),
reinterpret_cast<void *>(static_cast<intptr_t>(mPid)) /* cookie */);
if (linkRet != STATUS_OK) {
ALOGV("%s, linkToDeath failed pid %d", __func__, mPid);
} else {
Expand Down
1 change: 0 additions & 1 deletion ipc/aidl/server/AgmServerWrapper.h
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,6 @@ class ClientInfo : public ISessionOps {
int removeSharedMemoryFdPairs(uint32_t sessionId, int dupFd) override;

static void onDeath(void *cookie);
void onDeath();

static void onCallback(uint32_t sessionId, struct agm_event_cb_params *eventParams,
void *clientData);
Expand Down
8 changes: 7 additions & 1 deletion plugins/alsalib/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,9 @@ library_includedir = $(includedir)
AM_CFLAGS = -Wno-unused-parameter
AM_CFLAGS += -I $(top_srcdir)/include -I $(PKG_CONFIG_SYSROOT_DIR)/usr/include
AM_CFLAGS += -I $(top_srcdir)/service/inc/public -I $(top_srcdir)/snd_parser/inc
if USE_GLIB
AM_CFLAGS += $(GLIB_CFLAGS)
endif
AM_CFLAGS += -D__unused=__attribute__\(\(__unused__\)\) -D__LINUX__
AM_CFLAGS += -I $(top_srcdir)/../../snd_parser/inc

Expand All @@ -19,7 +21,6 @@ if USE_G_STR_FUNC
AM_CFLAGS += -Dstrlcpy=g_strlcpy -Dstrlcat=g_strlcat
endif


if BUILD_ALSALIB

alsaplugindir = $(libdir)/alsa-lib
Expand Down Expand Up @@ -54,4 +55,9 @@ libasound_module_ctl_agm_la_LDFLAGS += -L$(top_builddir)/ipc/DBus/agm_client/.li
libasound_module_ctl_agm_la_LIBADD = -lasound -lsndcardparser -lagmclient
endif

if USE_GLIB
libasound_module_pcm_agm_la_LIBADD += $(GLIB_LIBS)
libasound_module_ctl_agm_la_LIBADD += $(GLIB_LIBS)
endif

endif
19 changes: 16 additions & 3 deletions plugins/tinyalsa/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,16 @@ library_includedir = $(includedir)

AM_CFLAGS = -Wno-unused-parameter
AM_CFLAGS += -I $(top_srcdir)/service/inc/public -I $(top_srcdir)/snd_parser/inc

if USE_GLIB
AM_CFLAGS += $(GLIB_CFLAGS) -include glib.h
endif

if USE_G_STR_FUNC
AM_CFLAGS += -Dstrlcpy=g_strlcpy -Dstrlcat=g_strlcat
endif
AM_CFLAGS += -DAGM_USE_SYSLOG

if !MEMLOGGER_SUPPORTED
AM_CFLAGS += @KVH2XML_CFLAGS@
AM_CFLAGS += -D__unused=__attribute__\(\(__unused__\)\)
AM_CFLAGS += -Wl,-z,defs
Expand Down Expand Up @@ -48,8 +53,8 @@ lib_LTLIBRARIES += libagm_mixer_plugin.la
libagm_mixer_plugin_la_SOURCES = src/agm_mixer_plugin.c
libagm_mixer_plugin_la_CFLAGS = $(AM_CFLAGS)
libagm_mixer_plugin_la_CFLAGS += -D__unused=__attribute__\(\(__unused__\)\)
libagm_mixer_plugin_la_LDFLAGS = -shared -version-number @LT_VERSION_NUMBER@ -L$(top_builddir)/snd_parser/.libs
libagm_mixer_plugin_la_LIBADD = -ltinyalsa -lsndcardparser $(GLIB_LIBS)
libagm_mixer_plugin_la_LDFLAGS =-avoid-version -shared -L$(top_builddir)/snd_parser/.libs
libagm_mixer_plugin_la_LIBADD = -ltinyalsa -lsndcardparser
if AGM_NO_IPC
libagm_mixer_plugin_la_CFLAGS += -DAGM_NO_IPC
libagm_mixer_plugin_la_LDFLAGS += -L$(top_builddir)/service/.libs
Expand All @@ -58,3 +63,11 @@ else
libagm_mixer_plugin_la_LIBADD += -lagmclient
libagm_mixer_plugin_la_LDFLAGS += -L$(top_builddir)/ipc/DBus/agm_client/.libs
endif

if AGM_IPC_SWBINDER
libagm_mixer_plugin_la_LIBADD += -L$(top_builddir)/ipc/SwBinders/agm_client/.libs/ -lagmclientwrapper
endif

if USE_GLIB
libagm_mixer_plugin_la_LIBADD += $(GLIB_LIBS)
endif
6 changes: 1 addition & 5 deletions plugins/tinyalsa/src/agm_pcm_plugin.c
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@ struct pcm_plugin_hw_constraints agm_pcm_constrs = {
.max = 8,
},
.period_bytes = {
.min = 96,
.min = 16,
.max = 122880,
},
};
Expand Down Expand Up @@ -719,10 +719,6 @@ static int agm_pcm_close(struct pcm_plugin *plugin)
priv->mmap_status = false;
}
if (priv->buf_info) {
if (priv->buf_info->data_buf_fd != -1)
close(priv->buf_info->data_buf_fd);
if (priv->buf_info->pos_buf_fd != -1)
close(priv->buf_info->pos_buf_fd);
free(priv->buf_info);
}
free(plugin->priv);
Expand Down
17 changes: 12 additions & 5 deletions plugins/tinyalsa/test/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,11 @@ pkgconfig_DATA = agmtest.pc
EXTRA_DIST = $(pkgconfig_DATA)

AM_CFLAGS = -Wno-unused-parameter -Wno-unused-result
AM_CFLAGS += -I$(top_srcdir)/service/inc/public
AM_CFLAGS += $(GLIB_CFLAGS) -include glib.h @KVH2XML_CFLAGS@
AM_CFLAGS += -I${includedir}/acdbdata -I$(top_srcdir)/service/inc/public
if USE_GLIB
AM_CFLAGS += $(GLIB_CFLAGS) -include glib.h
endif
AM_CFLAGS += @KVH2XML_CFLAGS@

if USE_G_STR_FUNC
AM_CFLAGS += -Dstrlcpy=g_strlcpy -Dstrlcat=g_strlcat
Expand All @@ -14,8 +17,12 @@ AM_CFLAGS += -DBACKEND_CONF_FILE=\"/etc/backend_conf.xml\"
lib_LTLIBRARIES = libagmmixer.la
libagmmixer_la_SOURCES = agmmixer.c
libagmmixer_la_CFLAGS = $(AM_CFLAGS)
libagmmixer_la_LDFLAGS = -shared -version-number @LT_VERSION_NUMBER@
libagmmixer_la_LIBADD = -ltinyalsa -ldl -lexpat @GLIB_LIBS@
libagmmixer_la_LDFLAGS = -avoid-version -shared
libagmmixer_la_LIBADD = -ltinyalsa -ldl -lexpat

if USE_GLIB
libagmmixer_la_LIBADD += @GLIB_LIBS@
endif

bin_PROGRAMS = agmplay
agmplay_SOURCES = agmplay.c
Expand All @@ -33,4 +40,4 @@ agmcap_LDADD = -ltinyalsa libagmmixer.la
root_etcdir = "/etc"
root_etc_SCRIPTS = backend_conf.xml
install-data-hook:
chmod go-x $(DESTDIR)$(root_etcdir)/backend_conf.xml
chmod go-x $(DESTDIR)$(root_etcdir)/backend_conf.xml
9 changes: 5 additions & 4 deletions plugins/tinyalsa/test/agmcap.c
Original file line number Diff line number Diff line change
Expand Up @@ -80,9 +80,9 @@ static void sigint_handler(int sig)
capturing = 0;
}

static void usage(char *progname)
static void usage(const char *progname)
{
printf(" Usage: file.wav in /data [-help print usage] [-D card] [-d device]\n"
printf(" Usage: %s file.wav in /data [-help print usage] [-D card] [-d device]\n"
" [-c channels] [-r rate] [-b bits] [-p period_size]\n"
" [-n n_periods] [-T capture time] [-i intf_name] [-dkv device_kv]\n"
" [-dppkv deviceppkv] : Assign 0 if no device pp in the graph\n"
Expand All @@ -98,6 +98,7 @@ int main(int argc, char **argv)
{
FILE *file;
struct wav_header header;
const char *progname = argv[0];
unsigned int card = 100;
unsigned int device = 101;
unsigned int usb_device = 1;
Expand All @@ -120,7 +121,7 @@ int main(int argc, char **argv)
bool is_24_LE = false;

if (argc < 2) {
usage(argv[0]);
usage(progname);
return 1;
}

Expand Down Expand Up @@ -208,7 +209,7 @@ int main(int argc, char **argv)
if (*argv)
usb_device = atoi(*argv);
}else if (strcmp(*argv, "-help") == 0) {
usage(argv[0]);
usage(progname);
}
if (*argv)
argv++;
Expand Down
Loading
Loading