Commit 93f7ee1e authored by Ghislain MARY's avatar Ghislain MARY

Use correct macro to detect Android build.

parent f1999023
......@@ -546,10 +546,6 @@ if(MEDIASTREAMER2_CPPFLAGS)
add_definitions(${MEDIASTREAMER2_CPPFLAGS})
endif()
if(ANDROID)
add_definitions("-DANDROID")
endif()
set(STRICT_OPTIONS_CPP )
set(STRICT_OPTIONS_C )
set(STRICT_OPTIONS_OBJC "-Wno-error")
......
......@@ -577,7 +577,7 @@ MS2_PUBLIC char *ms_load_path_content(const char *path, size_t *nbytes);
#define N_(String) (String)
#endif // MS2_INTERNAL
#ifdef ANDROID
#ifdef __ANDROID__
#include "mediastreamer2/msjava.h"
#endif
#endif
......
......@@ -34,7 +34,7 @@ JavaVM *ms_get_jvm(void);
JNIEnv *ms_get_jni_env(void);
#ifdef ANDROID
#ifdef __ANDROID__
int ms_get_android_sdk_version(void);
#endif
......
......@@ -26,7 +26,7 @@
#elif defined(__APPLE__)
#include <OpenGL/OpenGL.h>
#include <OpenGL/gl.h>
#elif defined(ANDROID)
#elif defined(__ANDROID__)
#include <GLES2/gl2.h>
#include <GLES2/gl2ext.h>
#elif defined(_WIN32)
......
......@@ -22,14 +22,14 @@
#include "mediastreamer2/devices.h"
#ifdef ANDROID
#ifdef __ANDROID__
#include "sys/system_properties.h"
#include <jni.h>
#endif
#ifdef ANDROID
#ifdef __ANDROID__
/*
* 1st column: list of triplet frequency, gain, width
* 2nd column: mic gain in db
......@@ -313,7 +313,7 @@ SoundDeviceDescription* ms_devices_info_get_sound_device_description(MSDevicesIn
bool_t exact_match = FALSE;
bool_t declares_builtin_aec = FALSE;
#ifdef ANDROID
#ifdef __ANDROID__
if (__system_property_get("ro.product.manufacturer", manufacturer) <= 0) {
ms_warning("Could not get product manufacturer.");
......
......@@ -30,7 +30,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#define NO_SAMPLES_THRESHOLD 100 /*ms*/
#if defined(ANDROID) || defined(__ios) /* because android and iOS don't deal well with audio stop and restarts at each dtmf.*/
#if defined(__ANDROID__) || defined(__ios) /* because android and iOS don't deal well with audio stop and restarts at each dtmf.*/
#define TRAILLING_SILENCE 10000 /*ms*/
#else
#define TRAILLING_SILENCE 500 /*ms*/
......
......@@ -26,7 +26,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#include <speex/speex_resampler.h>
#include <speex/speex.h>
#ifdef ANDROID
#ifdef __ANDROID__
#include "cpu-features.h"
#endif
......@@ -63,7 +63,7 @@ static void resample_data_destroy(ResampleData *obj){
static void resample_init(MSFilter *obj){
ResampleData* data=resample_data_new();
#ifdef SPEEX_LIB_SET_CPU_FEATURES
#ifdef ANDROID
#ifdef __ANDROID__
if (((android_getCpuFamily() == ANDROID_CPU_FAMILY_ARM) && ((android_getCpuFeatures() & ANDROID_CPU_ARM_FEATURE_NEON) != 0))
|| (android_getCpuFamily() == ANDROID_CPU_FAMILY_ARM64)) {
data->cpuFeatures = SPEEX_LIB_CPU_FEATURE_NEON;
......
......@@ -22,7 +22,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#include <speex/speex.h>
#ifdef ANDROID
#ifdef __ANDROID__
#include "cpu-features.h"
#endif
......@@ -66,7 +66,7 @@ static void enc_init(MSFilter *f){
#ifdef SPEEX_LIB_SET_CPU_FEATURES
#if MS_HAS_ARM_NEON
#ifdef ANDROID
#ifdef __ANDROID__
if (((android_getCpuFamily() == ANDROID_CPU_FAMILY_ARM) && ((android_getCpuFeatures() & ANDROID_CPU_ARM_FEATURE_NEON) != 0))
|| (android_getCpuFamily() == ANDROID_CPU_FAMILY_ARM64)) {
cpuFeatures = SPEEX_LIB_CPU_FEATURE_NEON;
......
......@@ -40,7 +40,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
//#define EC_DUMP 1
#ifdef ANDROID
#ifdef __ANDROID__
#define EC_DUMP_PREFIX "/sdcard"
#else
#define EC_DUMP_PREFIX "/dynamic/tests"
......
......@@ -284,13 +284,13 @@ void ms_set_payload_max_size(int size){
extern void _android_key_cleanup(void*);
void ms_thread_exit(void* ref_val) {
#ifdef ANDROID
#ifdef __ANDROID__
// due to a bug in old Bionic version
// cleanup of jni manually
// works directly with Android 2.2
_android_key_cleanup(NULL);
#endif
#if !defined(__linux) || defined(ANDROID)
#if !defined(__linux) || defined(__ANDROID__)
ortp_thread_exit(ref_val); // pthread_exit futex issue: http://lkml.indiana.edu/hypermail/linux/kernel/0902.0/00153.html
#endif
}
......
......@@ -202,7 +202,7 @@ void ms_factory_init(MSFactory *obj){
#ifdef __QNX__
ms_factory_add_platform_tag(obj, "qnx");
#endif
#ifdef ANDROID
#ifdef __ANDROID__
ms_factory_add_platform_tag(obj, "android");
#endif
#ifdef TARGET_OS_IPHONE
......@@ -213,7 +213,7 @@ void ms_factory_init(MSFactory *obj){
#else
ms_factory_add_platform_tag(obj, "x86");
#endif
#if defined(ANDROID) || (TARGET_OS_IPHONE == 1) || defined(__arm__) || defined(_M_ARM)
#if defined(__ANDROID__) || (TARGET_OS_IPHONE == 1) || defined(__arm__) || defined(_M_ARM)
ms_factory_add_platform_tag(obj, "embedded");
#else
ms_factory_add_platform_tag(obj, "desktop");
......@@ -865,7 +865,7 @@ void ms_factory_set_image_resources_dir(MSFactory *f, const char *path) {
f->image_resources_dir = bctbx_strdup(path);
}
#ifdef ANDROID
#ifdef __ANDROID__
#include "sys/system_properties.h"
#include <jni.h>
......
......@@ -81,7 +81,7 @@ JNIEnv *ms_get_jni_env(void){
return env;
}
#ifdef ANDROID
#ifdef __ANDROID__
int ms_get_android_sdk_version(void) {
static int sdk_version = 0;
......
......@@ -2,7 +2,7 @@
// =============================================================================
#ifdef ANDROID
#ifdef __ANDROID__
#define CAST(type, fn) (type)fn
#else
#define CAST(type, fn) fn
......
......@@ -660,7 +660,7 @@ void ogl_display_zoom (struct opengles_display *gldisp, float *params) {
gldisp->zoom_cy = params[2] - 0.5f;
}
#ifdef ANDROID
#ifdef __ANDROID__
JNIEXPORT void JNICALL Java_org_linphone_mediastream_video_display_OpenGLESDisplay_init (JNIEnv * env, jobject obj, jlong ptr, jint width, jint height) {
struct opengles_display* d = (struct opengles_display*) ptr;
ogl_display_init(d, NULL, width, height);
......
......@@ -81,7 +81,7 @@ void ogl_display_render (struct opengles_display *gldisp, int deviceAngleFromPor
*/
void ogl_display_zoom (struct opengles_display *gldisp, float *params);
#ifdef ANDROID
#ifdef __ANDROID__
#include <jni.h>
JNIEXPORT void JNICALL Java_org_linphone_mediastream_video_display_OpenGLESDisplay_init (JNIEnv * env, jobject obj, jlong ptr, jint width, jint height);
JNIEXPORT void JNICALL Java_org_linphone_mediastream_video_display_OpenGLESDisplay_render (JNIEnv * env, jobject obj, jlong ptr);
......
......@@ -39,7 +39,7 @@
{ required_bitrate, bitrate_limit, { MS_VIDEO_SIZE_ ## resolution ## _W, MS_VIDEO_SIZE_ ## resolution ## _H }, fps, cpus, NULL }
static const MSVideoConfiguration vp8_conf_list[] = {
#if defined(ANDROID) || (TARGET_OS_IPHONE == 1) || defined(__arm__) || defined(_M_ARM)
#if defined(__ANDROID__) || (TARGET_OS_IPHONE == 1) || defined(__arm__) || defined(_M_ARM)
MS_VP8_CONF(2048000, 2560000, UXGA, 12, 2),
MS_VP8_CONF(1024000, 1536000, SXGA_MINUS, 12, 2),
MS_VP8_CONF( 750000, 1024000, XGA, 12, 2),
......@@ -182,7 +182,7 @@ static void enc_preprocess(MSFilter *f) {
s->cfg.g_lag_in_frames = 0;
#if defined(ANDROID) || (TARGET_OS_IPHONE == 1) || defined(__arm__) || defined(_M_ARM)
#if defined(__ANDROID__) || (TARGET_OS_IPHONE == 1) || defined(__arm__) || defined(_M_ARM)
cpuused = 10 - s->cfg.g_threads; /*cpu/quality tradeoff: positive values decrease CPU usage at the expense of quality*/
if (cpuused < 7) cpuused = 7; /*values beneath 7 consume too much CPU*/
if( s->cfg.g_threads == 1 ){
......
......@@ -39,7 +39,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#include "mediastreamer2/mseventqueue.h"
#include "private.h"
#ifdef ANDROID
#ifdef __ANDROID__
#include "mediastreamer2/devices.h"
#endif
......@@ -1065,7 +1065,7 @@ int audio_stream_start_from_io(AudioStream *stream, RtpProfile *profile, const c
stream->spk_equalizer=NULL;
}
#ifdef ANDROID
#ifdef __ANDROID__
{
/*configure equalizer if needed*/
MSDevicesInfo *devices = ms_factory_get_devices_info(stream->ms.factory);
......@@ -1774,7 +1774,7 @@ int audio_stream_send_dtmf(AudioStream *stream, char dtmf)
static void audio_stream_set_rtp_output_gain_db(AudioStream *stream, float gain_db) {
float gain = gain_db;
#ifdef ANDROID
#ifdef __ANDROID__
MSDevicesInfo *devices = ms_factory_get_devices_info(stream->ms.factory);
SoundDeviceDescription *device = ms_devices_info_get_sound_device_description(devices);
if (device && device->hacks) {
......@@ -1801,7 +1801,7 @@ void audio_stream_mute_rtp(AudioStream *stream, bool_t val)
void audio_stream_set_spk_gain_db(AudioStream *stream, float gain_db) {
float gain = gain_db;
#ifdef ANDROID
#ifdef __ANDROID__
MSDevicesInfo *devices = ms_factory_get_devices_info(stream->ms.factory);
SoundDeviceDescription *device = ms_devices_info_get_sound_device_description(devices);
if (device && device->hacks) {
......
......@@ -630,11 +630,11 @@ static MSScalerDesc android_scaler={
#endif
#ifdef ANDROID
#ifdef __ANDROID__
#include "cpu-features.h"
#endif
#if defined(ANDROID) && defined(MS_HAS_ARM) && !defined(__aarch64__)
#if defined(__ANDROID__) && defined(MS_HAS_ARM) && !defined(__aarch64__)
extern MSScalerDesc ms_android_scaler;
#endif
......@@ -644,7 +644,7 @@ static MSScalerDesc *scaler_impl=NULL;
MSScalerContext *ms_scaler_create_context(int src_w, int src_h, MSPixFmt src_fmt,
int dst_w, int dst_h, MSPixFmt dst_fmt, int flags){
if (!scaler_impl){
#if defined(ANDROID) && defined(MS_HAS_ARM) && !defined(__aarch64__)
#if defined(__ANDROID__) && defined(MS_HAS_ARM) && !defined(__aarch64__)
if (android_getCpuFamily() == ANDROID_CPU_FAMILY_ARM && (android_getCpuFeatures() & ANDROID_CPU_ARM_FEATURE_NEON) != 0){
scaler_impl = &ms_android_scaler;
}
......@@ -708,7 +708,7 @@ static void rotate_plane_down_scale_by_2(int wDest, int hDest, int full_width, c
}
}
#ifdef ANDROID
#ifdef __ANDROID__
static int hasNeon = -1;
#elif MS_HAS_ARM_NEON
......@@ -729,7 +729,7 @@ mblk_t *copy_ycbcrbiplanar_to_true_yuv_with_rotation_and_down_scale_by_2(MSYuvBu
int factor = down_scale?2:1;
mblk_t * yuv_block;
#ifdef ANDROID
#ifdef __ANDROID__
if (hasNeon == -1) {
hasNeon = (((android_getCpuFamily() == ANDROID_CPU_FAMILY_ARM) && ((android_getCpuFeatures() & ANDROID_CPU_ARM_FEATURE_NEON) != 0))
|| (android_getCpuFamily() == ANDROID_CPU_FAMILY_ARM64));
......
......@@ -59,7 +59,7 @@ extern void _register_videotoolbox_if_supported(MSFactory *factory);
#include "TargetConditionals.h"
#endif
#ifdef ANDROID
#ifdef __ANDROID__
#include <android/log.h>
#endif
......@@ -110,7 +110,7 @@ extern MSSndCardDesc pulse_card_desc;
extern MSSndCardDesc au_card_desc;
#endif
#ifdef ANDROID
#ifdef __ANDROID__
extern MSSndCardDesc msandroid_sound_card_desc;
extern MSSndCardDesc android_native_snd_card_desc;
extern MSSndCardDesc android_native_snd_opensles_card_desc;
......@@ -165,7 +165,7 @@ static MSSndCardDesc * ms_snd_card_descs[]={
&aq_card_desc,
#endif
#ifdef ANDROID
#ifdef __ANDROID__
&android_native_snd_card_desc,
&android_native_snd_opensles_card_desc,
&msandroid_sound_card_desc,
......@@ -205,7 +205,7 @@ extern MSWebCamDesc ms_v4m_cam_desc;
extern MSWebCamDesc static_image_desc;
extern MSWebCamDesc ms_mire_webcam_desc;
#ifdef ANDROID
#ifdef __ANDROID__
extern MSWebCamDesc ms_android_video_capture_desc;
extern MSFilterDesc ms_mediacodec_h264_dec_desc;
extern MSFilterDesc ms_mediacodec_h264_enc_desc;
......@@ -224,7 +224,7 @@ extern MSWebCamDesc ms_bb10_camera_desc;
static MSWebCamDesc * ms_web_cam_descs[]={
#ifdef MS2_FILTERS
#if defined (ANDROID)
#if defined (__ANDROID__)
&ms_android_video_capture_desc,
#endif
#ifdef HAVE_LINUX_VIDEODEV2_H
......@@ -276,7 +276,7 @@ void ms_factory_init_voip(MSFactory *obj){
_register_videotoolbox_if_supported(obj);
#endif
#if defined(ANDROID) && defined(VIDEO_ENABLED)
#if defined(__ANDROID__) && defined(VIDEO_ENABLED)
if (AMediaImage_isAvailable()) {
ms_factory_register_filter(obj, &ms_mediacodec_h264_dec_desc);
ms_factory_register_filter(obj, &ms_mediacodec_h264_enc_desc);
......@@ -316,7 +316,7 @@ void ms_factory_init_voip(MSFactory *obj){
}
#endif
#if defined(ANDROID) && defined (VIDEO_ENABLED)
#if defined(__ANDROID__) && defined (VIDEO_ENABLED)
{
MSDevicesInfo *devices = ms_factory_get_devices_info(obj);
SoundDeviceDescription *description = ms_devices_info_get_sound_device_description(devices);
......
......@@ -236,7 +236,7 @@ const char *video_stream_get_default_video_renderer(void){
return "MSWP8Dis";
#elif defined(MS2_WINDOWS_DESKTOP)
return "MSDrawDibDisplay";
#elif defined(ANDROID)
#elif defined(__ANDROID__)
return "MSAndroidDisplay";
#elif __APPLE__ && !defined(__ios)
return "MSOSXGLDisplay";
......
......@@ -882,7 +882,7 @@ static void video_configuration_stream_vp8(void) {
/*Test video rotation (inverted height <-> width). Not supported on desktop
because no real use case yet.*/
#if defined(ANDROID) || defined(TARGET_OS_IPHONE)
#if defined(__ANDROID__) || defined(TARGET_OS_IPHONE)
asked.bitrate_limit=expected.bitrate_limit=1024000;
asked.required_bitrate=expected.required_bitrate=1024000;
asked.fps=expected.fps=12;
......@@ -904,7 +904,7 @@ static void video_configuration_stream_h264(void) {
/*Test video rotation (inverted height <-> width). Not supported on desktop
because no real use case yet.*/
#if defined(ANDROID) || defined(TARGET_OS_IPHONE)
#if defined(__ANDROID__) || defined(TARGET_OS_IPHONE)
asked.bitrate_limit=expected.bitrate_limit=1024000;
asked.required_bitrate=expected.required_bitrate=1024000;
asked.fps=expected.fps=12;
......
......@@ -48,7 +48,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#include <AudioToolbox/AudioToolbox.h>
#endif
#if TARGET_OS_IPHONE || defined (ANDROID)
#if TARGET_OS_IPHONE || defined (__ANDROID__)
extern void ms_set_video_stream(VideoStream* video);
#if TARGET_OS_IPHONE || defined(HAVE_X264)
extern void libmsx264_init();
......@@ -62,9 +62,9 @@ extern void libmssilk_init();
#if TARGET_OS_IPHONE || defined(HAVE_WEBRTC)
extern void libmswebrtc_init();
#endif
#endif // TARGET_OS_IPHONE || defined (ANDROID)
#endif // TARGET_OS_IPHONE || defined (__ANDROID__)
#ifdef ANDROID
#ifdef __ANDROID__
#include <android/log.h>
#include <jni.h>
#endif
......@@ -265,11 +265,11 @@ int main(int argc, char * argv[]) {
static int _main(int argc, char * argv[])
#endif
#if !TARGET_OS_MAC && !ANDROID
#if !TARGET_OS_MAC && !defined(__ANDROID__)
int main(int argc, char * argv[])
#endif
#if !ANDROID && !TARGET_OS_MAC || TARGET_OS_IPHONE
#if !defined(__ANDROID__) && !TARGET_OS_MAC || TARGET_OS_IPHONE
{
MediastreamDatas* args;
cond = 1;
......@@ -710,7 +710,7 @@ void setup_media_streams(MediastreamDatas* args) {
args->factory = factory = ms_factory_new_with_voip();
#if TARGET_OS_IPHONE || defined(ANDROID)
#if TARGET_OS_IPHONE || defined(__ANDROID__)
#if TARGET_OS_IPHONE || (defined(HAVE_X264) && defined(VIDEO_ENABLED))
libmsx264_init(); /*no plugin on IOS/Android */
#endif
......@@ -724,7 +724,7 @@ void setup_media_streams(MediastreamDatas* args) {
libmswebrtc_init();
#endif
#endif /* IPHONE | ANDROID */
#endif /* TARGET_OS_IPHONE || defined(__ANDROID__) */
rtp_profile_set_payload(&av_profile,110,&payload_type_speex_nb);
rtp_profile_set_payload(&av_profile,111,&payload_type_speex_wb);
......@@ -935,7 +935,7 @@ void setup_media_streams(MediastreamDatas* args) {
if (args->video_display_filter)
video_stream_set_display_filter_name(args->video, args->video_display_filter);
#ifdef ANDROID
#ifdef __ANDROID__
if (args->device_rotation >= 0)
video_stream_set_device_rotation(args->video, args->device_rotation);
#endif
......@@ -1155,7 +1155,7 @@ void clear_mediastreams(MediastreamDatas* args) {
}
// ANDROID JNI WRAPPER
#ifdef ANDROID
#ifdef __ANDROID__
JNIEXPORT jint JNICALL JNI_OnLoad(JavaVM *ajvm, void *reserved)
{
ms_set_jvm(ajvm);
......
......@@ -102,8 +102,8 @@ void Java_org_mediastreamer2_test_Ring_echo(JNIEnv* env,jobject this,jint freq
JNIEXPORT jint JNICALL JNI_OnLoad(JavaVM *ajvm, void *reserved)
{
#ifdef ANDROID
#ifdef __ANDROID__
ms_set_jvm(ajvm);
#endif /*ANDROID*/
#endif /* __ANDROID__ */
return JNI_VERSION_1_2;
}
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