Commit 46d894ca authored by Ghislain MARY's avatar Ghislain MARY

Use correct macro to detect Android build.

parent ab3c8573
......@@ -241,9 +241,6 @@ endif()
if(ENABLE_DEBUG_LOGS)
add_definitions("-DDEBUG")
endif()
if(ANDROID)
add_definitions("-DANDROID")
endif()
set(STRICT_OPTIONS_CPP )
set(STRICT_OPTIONS_C )
......
......@@ -18,7 +18,7 @@
#include "linphone/core_utils.h"
#include "private.h"
#ifdef ANDROID
#ifdef __ANDROID__
#include <android/log.h>
#endif
......@@ -429,7 +429,7 @@ void TunnelManager::sOnIterate(TunnelManager *zis){
zis->onIterate();
}
#ifdef ANDROID
#ifdef __ANDROID__
extern void linphone_android_log_handler(int prio, char *str);
static void linphone_android_tunnel_log_handler(int lev, const char *fmt, va_list args) {
char str[4096];
......@@ -447,7 +447,7 @@ static void linphone_android_tunnel_log_handler(int lev, const char *fmt, va_lis
}
linphone_android_log_handler(prio, str);
}
#endif /*ANDROID*/
#endif /* __ANDROID__ */
void TunnelManager::enableLogs(bool value) {
enableLogs(value,NULL);
......@@ -455,7 +455,7 @@ void TunnelManager::enableLogs(bool value) {
void TunnelManager::enableLogs(bool isEnabled,LogHandler logHandler) {
if (logHandler != NULL) SetLogHandler(logHandler);
#ifdef ANDROID
#ifdef __ANDROID__
else SetLogHandler(linphone_android_tunnel_log_handler);
#else
else SetLogHandler(tunnel_default_log_handler);
......
......@@ -24,7 +24,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#ifdef SQLITE_STORAGE_ENABLED
#ifndef _WIN32
#if !defined(ANDROID) && !defined(__QNXNTO__)
#if !defined(__ANDROID__) && !defined(__QNXNTO__)
# include <langinfo.h>
# include <iconv.h>
# include <string.h>
......
......@@ -28,7 +28,7 @@
#ifdef SQLITE_STORAGE_ENABLED
#ifndef _WIN32
#if !defined(ANDROID) && !defined(__QNXNTO__)
#if !defined(__ANDROID__) && !defined(__QNXNTO__)
# include <langinfo.h>
# include <iconv.h>
# include <string.h>
......
......@@ -1719,7 +1719,7 @@ void linphone_call_set_state(LinphoneCall *call, LinphoneCallState cstate, const
switch (cstate) {
case LinphoneCallOutgoingInit:
case LinphoneCallIncomingReceived:
#ifdef ANDROID
#ifdef __ANDROID__
ms_message("Call [%p] acquires both wifi and multicast lock",call);
linphone_core_wifi_lock_acquire(call->core);
linphone_core_multicast_lock_acquire(call->core); /*does no affect battery more than regular rtp traffic*/
......@@ -1744,7 +1744,7 @@ void linphone_call_set_state(LinphoneCall *call, LinphoneCallState cstate, const
call->log->connected_date_time = ms_time(NULL);
break;
case LinphoneCallReleased:
#ifdef ANDROID
#ifdef __ANDROID__
ms_message("Call [%p] releases wifi/multicast lock",call);
linphone_core_wifi_lock_release(call->core);
linphone_core_multicast_lock_release(call->core);
......
......@@ -1576,7 +1576,7 @@ static void video_config_read(LinphoneCore *lc){
linphone_core_set_preferred_framerate(lc,lp_config_get_float(lc->config,"video","framerate",0));
#if defined(ANDROID) || defined(__ios)
#if defined(__ANDROID__) || defined(__ios)
automatic_video=0;
#endif
capture=lp_config_get_int(lc->config,"video","capture",1);
......@@ -4846,18 +4846,18 @@ int linphone_core_get_camera_sensor_rotation(LinphoneCore *lc) {
}
static MSVideoSizeDef supported_resolutions[]={
#if !ANDROID && !TARGET_OS_IPHONE
#if !defined(__ANDROID__) && !TARGET_OS_IPHONE
{ { MS_VIDEO_SIZE_1080P_W, MS_VIDEO_SIZE_1080P_H } , "1080p" },
#endif
#if !ANDROID && !TARGET_OS_MAC /*limit to most common sizes because mac video API cannot list supported resolutions*/
#if !defined(__ANDROID__) && !TARGET_OS_MAC /*limit to most common sizes because mac video API cannot list supported resolutions*/
{ { MS_VIDEO_SIZE_UXGA_W, MS_VIDEO_SIZE_UXGA_H } , "uxga" },
{ { MS_VIDEO_SIZE_SXGA_MINUS_W, MS_VIDEO_SIZE_SXGA_MINUS_H } , "sxga-" },
#endif
{ { MS_VIDEO_SIZE_720P_W, MS_VIDEO_SIZE_720P_H } , "720p" },
#if !ANDROID && !TARGET_OS_MAC
#if !defined(__ANDROID__) && !TARGET_OS_MAC
{ { MS_VIDEO_SIZE_XGA_W, MS_VIDEO_SIZE_XGA_H } , "xga" },
#endif
#if !ANDROID && !TARGET_OS_IPHONE
#if !defined(__ANDROID__) && !TARGET_OS_IPHONE
{ { MS_VIDEO_SIZE_SVGA_W, MS_VIDEO_SIZE_SVGA_H } , "svga" },
{ { MS_VIDEO_SIZE_4CIF_W, MS_VIDEO_SIZE_4CIF_H } , "4cif" },
#endif
......@@ -6330,7 +6330,7 @@ const char * linphone_core_get_video_preset(const LinphoneCore *lc) {
return lp_config_get_string(lc->config, "video", "preset", NULL);
}
#ifdef ANDROID
#ifdef __ANDROID__
static int linphone_core_call_void_method(jobject obj, jmethodID id) {
JNIEnv *env=ms_get_jni_env();
if (env && obj) {
......
......@@ -41,11 +41,10 @@ extern "C" {
#include "linphone/lpconfig.h"
#ifdef ANDROID
#ifdef __ANDROID__
#include <android/log.h>
#include <belle-sip/wakelock.h>
#endif /*ANDROID*/
#endif /* __ANDROID__ */
#define RETURN_USER_DATA_OBJECT(javaclass, funcprefix, cobj) \
{ \
......@@ -75,7 +74,7 @@ static jobject create_java_linphone_buffer(JNIEnv *env, const LinphoneBuffer *bu
static LinphoneBuffer* create_c_linphone_buffer_from_java_linphone_buffer(JNIEnv *env, jobject jbuffer);
static jobject getTunnelConfig(JNIEnv *env, LinphoneTunnelConfig *cfg);
#ifdef ANDROID
#ifdef __ANDROID__
void linphone_android_log_handler(int prio, char *str) {
char *current;
char *next;
......@@ -159,15 +158,14 @@ extern "C" void setMediastreamerAndroidContext(JNIEnv *env, void *context) {
jmethodID set_context = env->GetStaticMethodID(ms_class, "setContext", "(Ljava/lang/Object;)V");
env->CallStaticVoidMethod(ms_class, set_context, (jobject)context);
}
#endif /*ANDROID*/
#endif /* __ANDROID__ */
JNIEXPORT jint JNICALL JNI_OnLoad(JavaVM *ajvm, void *reserved)
{
#ifdef ANDROID
#ifdef __ANDROID__
ms_set_jvm(ajvm);
#endif /*ANDROID*/
#endif /* __ANDROID__ */
jvm=ajvm;
return JNI_VERSION_1_2;
}
......@@ -5750,7 +5748,7 @@ extern "C" void Java_org_linphone_core_LinphoneCoreImpl_setAudioDscp(JNIEnv* env
}
extern "C" void Java_org_linphone_core_LinphoneCoreImpl_setAndroidPowerManager(JNIEnv *env, jclass cls, jobject pm) {
#ifdef ANDROID
#ifdef __ANDROID__
if(pm != NULL) belle_sip_wake_lock_init(env, pm);
else belle_sip_wake_lock_uninit(env);
#endif
......@@ -5758,7 +5756,7 @@ extern "C" void Java_org_linphone_core_LinphoneCoreImpl_setAndroidPowerManager(J
/*released in Java_org_linphone_core_LinphoneCoreImpl_delete*/
extern "C" void Java_org_linphone_core_LinphoneCoreImpl_setAndroidWifiLock(JNIEnv *env, jobject thiz, jlong ptr, jobject wifi_lock) {
#ifdef ANDROID
#ifdef __ANDROID__
LinphoneCore *lc=(LinphoneCore*)ptr;
if (lc->wifi_lock) {
env->DeleteGlobalRef(lc->wifi_lock);
......@@ -5778,7 +5776,7 @@ extern "C" void Java_org_linphone_core_LinphoneCoreImpl_setAndroidWifiLock(JNIEn
}
/*released in Java_org_linphone_core_LinphoneCoreImpl_delete*/
extern "C" void Java_org_linphone_core_LinphoneCoreImpl_setAndroidMulticastLock(JNIEnv *env, jobject thiz, jlong ptr, jobject multicast_lock) {
#ifdef ANDROID
#ifdef __ANDROID__
LinphoneCore *lc=(LinphoneCore*)ptr;
if (lc->multicast_lock) {
env->DeleteGlobalRef(lc->multicast_lock);
......
......@@ -97,7 +97,7 @@ BELLE_SIP_DECLARE_VPTR_NO_EXPORT(LinphoneConfig);
char* lp_realpath(const char* file, char* name) {
#if defined(_WIN32) || defined(__QNX__) || defined(ANDROID)
#if defined(_WIN32) || defined(__QNX__) || defined(__ANDROID__)
return ms_strdup(file);
#else
char * output = realpath(file, name);
......
......@@ -28,7 +28,8 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#endif
#ifndef _WIN32
#if !defined(__QNXNTO__)
#if !defined(__QNXNTO__) && !(defined(__ANDROID__) && defined(__LP64__))
#include <ctype.h>
#include <langinfo.h>
#include <locale.h>
#include <iconv.h>
......@@ -50,7 +51,7 @@ static char *utf8_convert(const char *filename){
wchar_t db_file_utf16[MAX_PATH_SIZE]={0};
MultiByteToWideChar(CP_ACP, MB_PRECOMPOSED, filename, -1, db_file_utf16, MAX_PATH_SIZE);
WideCharToMultiByte(CP_UTF8, 0, db_file_utf16, -1, db_file_utf8, sizeof(db_file_utf8), NULL, NULL);
#elif defined(__QNXNTO__) || (defined(ANDROID) && defined(__LP64__))
#elif defined(__QNXNTO__) || (defined(__ANDROID__) && defined(__LP64__))
strncpy(db_file_utf8, filename, MAX_PATH_SIZE - 1);
#else
char db_file_locale[MAX_PATH_SIZE] = {'\0'};
......
......@@ -88,7 +88,7 @@
#define ngettext(singular, plural, number) (((number)==1)?(singular):(plural))
#endif
#endif
#ifdef ANDROID
#ifdef __ANDROID__
#include <jni.h>
#endif
......@@ -1074,7 +1074,7 @@ struct _LinphoneCore
LinphoneContent *log_collection_upload_information;
LinphoneCoreCbs *current_cbs; // the latest LinphoneCoreCbs object to call a callback, see linphone_core_get_current_cbs()
LinphoneRingtonePlayer *ringtoneplayer;
#ifdef ANDROID
#ifdef __ANDROID__
jobject wifi_lock;
jclass wifi_lock_class;
jmethodID wifi_lock_acquire_id;
......@@ -1692,7 +1692,7 @@ void linphone_content_set_key(LinphoneContent *content, const char *key, const s
*/
void ** linphone_content_get_cryptoContext_address(LinphoneContent *content);
#ifdef ANDROID
#ifdef __ANDROID__
void linphone_core_wifi_lock_acquire(LinphoneCore *lc);
void linphone_core_wifi_lock_release(LinphoneCore *lc);
void linphone_core_multicast_lock_acquire(LinphoneCore *lc);
......
......@@ -29,7 +29,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#ifndef _WIN32
#if !defined(__QNXNTO__)
#if !defined(__QNXNTO__) && !(defined(__ANDROID__) && defined(__LP64__))
# include <langinfo.h>
# include <locale.h>
# include <iconv.h>
......@@ -281,7 +281,7 @@ static char* ConvertFromUtf8Filename(const char* fName){
}
bctbx_free(wideFilename);
return convertedFilename;
#elif defined(__QNXNTO__) || (defined(ANDROID) && defined(__LP64__))
#elif defined(__QNXNTO__) || (defined(__ANDROID__) && defined(__LP64__))
return bctbx_strdup(fName);
#else
#define MAX_PATH_SIZE 1024
......
......@@ -36,7 +36,7 @@
static void srtp_call(void);
// prototype definition for call_recording()
#ifdef ANDROID
#ifdef __ANDROID__
#ifdef HAVE_OPENH264
extern void libmsopenh264_init(MSFactory *factory);
#endif
......@@ -829,7 +829,7 @@ static void call_with_specified_codec_bitrate(void) {
#ifdef __arm__
if (ms_factory_get_cpu_count(marie->lc->factory) <2) { /*2 opus codec channel + resampler is too much for a single core*/
#ifndef ANDROID
#ifndef __ANDROID__
codec = "speex";
rate = 8000;
min_bw=20;
......@@ -2151,7 +2151,7 @@ static void call_with_mkv_file_player(void) {
char *hellowav;
char *recordpath;
bool_t call_ok;
#if !defined(__arm__) && !defined(__arm64__) && !TARGET_IPHONE_SIMULATOR && !defined(ANDROID)
#if !defined(__arm__) && !defined(__arm64__) && !TARGET_IPHONE_SIMULATOR && !defined(__ANDROID__)
double similar=0.0;
const double threshold = 0.9;
#define DO_AUDIO_CMP
......@@ -3039,7 +3039,7 @@ void record_call(const char *filename, bool_t enableVideo, const char *video_cod
disable_all_video_codecs_except_one(marie->lc,"h264");
}
#if defined(HAVE_OPENH264) && defined(ANDROID)
#if defined(HAVE_OPENH264) && defined(__ANDROID__)
libmsopenh264_init(linphone_core_get_ms_factory(marie->lc));
linphone_core_reload_ms_plugins(marie->lc, NULL);
libmsopenh264_init(linphone_core_get_ms_factory(pauline->lc));
......@@ -3558,7 +3558,7 @@ static void unsucessfull_call_with_transport_change_after_released(void) {
call_with_transport_change_base(FALSE);
}
#if !defined(__arm__) && !defined(__arm64__) && !TARGET_IPHONE_SIMULATOR && !defined(ANDROID)
#if !defined(__arm__) && !defined(__arm64__) && !TARGET_IPHONE_SIMULATOR && !defined(__ANDROID__)
static void completion_cb(void *user_data, int percentage){
fprintf(stdout,"%i %% completed\r",percentage);
fflush(stdout);
......@@ -3610,7 +3610,7 @@ static void simple_stereo_call(const char *codec_name, int clock_rate, int bitra
if (clock_rate!=48000) {
ms_warning("Similarity checking not implemented for files not having the same sampling rate");
}else{
#if !defined(__arm__) && !defined(__arm64__) && !TARGET_IPHONE_SIMULATOR && !defined(ANDROID)
#if !defined(__arm__) && !defined(__arm64__) && !TARGET_IPHONE_SIMULATOR && !defined(__ANDROID__)
double similar;
double min_threshold = .75f; /*should be above 0.8 in best conditions*/
double max_threshold = 1.f;
......
......@@ -42,7 +42,7 @@
static FILE * log_file = NULL;
#ifdef ANDROID
#ifdef __ANDROID__
#include <android/log.h>
#include <jni.h>
......@@ -148,7 +148,7 @@ JNIEXPORT void JNICALL Java_org_linphone_tester_Tester_keepAccounts(JNIEnv *env,
JNIEXPORT void JNICALL Java_org_linphone_tester_Tester_clearAccounts(JNIEnv *env, jclass c) {
liblinphone_tester_clear_accounts();
}
#endif /* ANDROID */
#endif /* __ANDROID__ */
static void log_handler(int lev, const char *fmt, va_list args) {
#ifdef _WIN32
......@@ -157,7 +157,7 @@ static void log_handler(int lev, const char *fmt, va_list args) {
#else
va_list cap;
va_copy(cap,args);
#ifdef ANDROID
#ifdef __ANDROID__
/* IMPORTANT: needed by liblinphone tester to retrieve suite list...*/
bcunit_android_trace_handler(lev == ORTP_ERROR, fmt, cap);
#else
......@@ -174,7 +174,7 @@ static void log_handler(int lev, const char *fmt, va_list args) {
void liblinphone_tester_init(void(*ftester_printf)(int level, const char *fmt, va_list args)) {
if (! log_file) {
#if defined(ANDROID)
#if defined(__ANDROID__)
linphone_core_set_log_handler(liblinphone_android_ortp_log_handler);
bctbx_set_log_handler(liblinphone_android_bctbx_log_handler);
#endif
......
......@@ -30,7 +30,7 @@
/*getline is POSIX 2008, not available on many systems.*/
#if (defined(ANDROID) && !defined(__LP64__)) || defined(_WIN32) || defined(__QNX__)
#if (defined(__ANDROID__) && !defined(__LP64__)) || defined(_WIN32) || defined(__QNX__)
/* This code is public domain -- Will Hartung 4/9/09 */
static ssize_t getline(char **lineptr, size_t *n, FILE *stream) {
char *bufptr = NULL;
......
......@@ -108,7 +108,7 @@ static void remote_provisioning_file(void) {
#if TARGET_OS_IPHONE
ms_message("Skipping remote provisioning from file on iOS");
return;
#elif defined(ANDROID)
#elif defined(__ANDROID__)
marie = linphone_core_manager_new2("marie_remote_localfile_android_rc", FALSE);
#elif defined(LINPHONE_WINDOWS_UNIVERSAL)
marie = linphone_core_manager_new2("marie_remote_localfile_win10_rc", FALSE);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment