Ticket #1025: Support for using different PortAudio installation/path

- added --with-pa-path configure option
 - remove the use of PaUtil_SetDebugPrintFunction() since this is not always available across all PA versions (?)


git-svn-id: https://svn.pjsip.org/repos/pjproject/trunk@3058 74dad513-b988-da41-8d7b-12977e46ad98
This commit is contained in:
Benny Prijono 2010-01-13 16:28:15 +00:00
parent d523370d48
commit fe0c127516
7 changed files with 1923 additions and 8006 deletions

9880
aconfigure

File diff suppressed because it is too large Load Diff

View File

@ -388,6 +388,30 @@ AC_ARG_ENABLE(sound,
fi]
)
dnl # PortAudio path. If ac_pa_path is not empty, we're using PortAudio
dnl # in external location (not under third_party)
AC_SUBST(ac_pa_path)
AC_ARG_WITH(pa-path,
AC_HELP_STRING([--with-pa-path=DIR],
[Specify PortAudio alternate location (e.g. /usr). When this option is set, we will not use our copy of PortAudio in third_party directory.]),
[
if test "x$with_pa_path" != "xno"; then
ac_pa_path=$with_pa_path
# Remove trailing backslash
ac_pa_path=`echo $ac_pa_path | sed 's/\/$//'`
# Test the path
#if test ! -f $ac_pa_path/include/portaudio.h; then
# AC_MSG_ERROR([Wrong --with-pa-path value, $ac_pa_path/include/portaudio.h does not exist])
#fi
#if test ! -d $ac_pa_path/lib; then
# AC_MSG_ERROR([Wrong --with-pa-path value, $ac_pa_path/lib does not exist])
#fi
AC_MSG_RESULT([** Using PortAudio in $ac_pa_path **])
fi
]
)
AC_SUBST(ac_pa_cflags)
AC_CHECK_HEADER(sys/soundcard.h,
[ac_pa_cflags="$ac_pa_cflags -DHAVE_SYS_SOUNDCARD_H"])

View File

@ -33,10 +33,16 @@ APP_THIRD_PARTY_LIBS += -lg7221codec-$(TARGET_NAME)
APP_THIRD_PARTY_LIB_FILES += $(PJ_DIR)/third_party/lib/libg7221codec-$(LIB_SUFFIX)
endif
ifneq (x@ac_pa_path@,x)
# We're using external PortAudio
APP_THIRD_PARTY_LIBS += -L@ac_pa_path@/lib -lportaudio
APP_THIRD_PARTY_LIB_FILES +=
else
ifneq ($(findstring pa,@ac_pjmedia_snd@),)
APP_THIRD_PARTY_LIBS += -lportaudio-$(TARGET_NAME)
APP_THIRD_PARTY_LIB_FILES += $(PJ_DIR)/third_party/lib/libportaudio-$(LIB_SUFFIX)
endif
endif
# Additional flags
@ac_build_mak_vars@

View File

@ -1,7 +1,6 @@
include ../../build.mak
THIRD_PARTY:=$(PJDIR)/third_party
PA_DIR := $(THIRD_PARTY)/build/portaudio/src
SRTP_INC=$(CC_INC)$(THIRD_PARTY)/build/srtp \
$(CC_INC)$(THIRD_PARTY)/srtp/crypto/include \

View File

@ -86,7 +86,13 @@ endif
# PortAudio
#
ifneq ($(findstring pa,$(AC_PJMEDIA_SND)),)
ifeq (x@ac_pa_path@,x)
# Our PA in third_party
export CFLAGS += -I$(THIRD_PARTY)/build/portaudio -I$(THIRD_PARTY)/portaudio/include -DPJMEDIA_AUDIO_DEV_HAS_PORTAUDIO=1
else
# External PA
export CFLAGS += -I@ac_pa_path@/include -DPJMEDIA_AUDIO_DEV_HAS_PORTAUDIO=1
endif
endif
#

View File

@ -30,6 +30,11 @@
#define THIS_FILE "pa_dev.c"
#define DRIVER_NAME "PA"
/* Enable call to PaUtil_SetDebugPrintFunction, but this is not always
* available across all PortAudio versions (?)
*/
/*#define USE_PA_DEBUG_PRINT */
struct pa_aud_factory
{
pjmedia_aud_dev_factory base;
@ -404,6 +409,7 @@ static int PaRecorderPlayerCallback( const void *input,
return rc;
}
#ifdef USE_PA_DEBUG_PRINT
/* Logging callback from PA */
static void pa_log_cb(const char *log)
{
@ -415,6 +421,7 @@ static void pa_log_cb(const char *log)
*/
typedef void (*PaUtilLogCallback ) (const char *log);
void PaUtil_SetDebugPrintFunction(PaUtilLogCallback cb);
#endif
/*
@ -442,7 +449,9 @@ static pj_status_t pa_init(pjmedia_aud_dev_factory *f)
PJ_UNUSED_ARG(f);
#ifdef USE_PA_DEBUG_PRINT
PaUtil_SetDebugPrintFunction(&pa_log_cb);
#endif
err = Pa_Initialize();

View File

@ -15,7 +15,10 @@ ifneq (@ac_no_g7221_codec@,1)
DIRS += g7221
endif
ifeq (x@ac_pa_path@,x)
# Only if we're using our own PA in third_party
ifneq ($(findstring pa,@ac_pjmedia_snd@),)
DIRS += portaudio
endif
endif