Commit 747209c6 authored by Gautier Pelloux-Prayer's avatar Gautier Pelloux-Prayer
Browse files

tester: fix compilation on iOS

parent 01919efe
......@@ -882,10 +882,9 @@ static void sound_config_read(LinphoneCore *lc)
linphone_core_set_sound_source(lc,tmpbuf[0]);
*/
tmpbuf = get_default_local_ring(lc);
tmpbuf=lp_config_get_string(lc->config,"sound","local_ring",tmpbuf);
if (ortp_file_exist(tmpbuf)==-1) {
ms_warning("%s does not exist",tmpbuf);
tmpbuf=lp_config_get_string(lc->config,"sound","local_ring",NULL);
if (tmpbuf==NULL||ortp_file_exist(tmpbuf)!=0) {
if (tmpbuf) ms_warning("%s does not exist",tmpbuf);
tmpbuf = get_default_local_ring(lc);
}
linphone_core_set_ring(lc,tmpbuf);
......@@ -1389,12 +1388,9 @@ static void video_config_read(LinphoneCore *lc){
#ifdef VIDEO_ENABLED
int capture, display, self_view, reuse_source;
int automatic_video=1;
#endif
const char *str;
#ifdef VIDEO_ENABLED
LinphoneVideoPolicy vpol;
memset(&vpol, 0, sizeof(LinphoneVideoPolicy));
#endif
build_video_devices_table(lc);
str=lp_config_get_string(lc->config,"video","device",NULL);
......@@ -1409,7 +1405,6 @@ static void video_config_read(LinphoneCore *lc){
linphone_core_set_preferred_framerate(lc,lp_config_get_float(lc->config,"video","framerate",0));
#ifdef VIDEO_ENABLED
#if defined(ANDROID) || defined(__ios)
automatic_video=0;
#endif
......
mediastreamer2 @ e7d1e3ca
Subproject commit acdd30745ad5c5f1e97edec4300c1a6448212a53
Subproject commit e7d1e3ca68df2d9d13c8aa813780b2074de15a96
oRTP @ f0703247
Subproject commit 3d4de2044c3a08e5eefe7e945e82b5e321a6eea1
Subproject commit f070324740b210977e619e716feeb63df0a6d84e
......@@ -20,10 +20,38 @@
#
############################################################################
file(GLOB SOURCE_FILES "*_tester.c")
list(APPEND SOURCE_FILES accountmanager.c tester.c)
if(ENABLE_STATIC)
set(LINPHONE_LIBS_FOR_TOOLS linphone-static)
else()
set(LINPHONE_LIBS_FOR_TOOLS linphone)
endif()
set(RESOURCES_FILES
certificates
flexisip
images
local_tester_hosts
messages.db
rcfiles
sipp
sounds
tester_hosts
vcards
)
file(GLOB SOURCE_FILES_C "*_tester.c")
list(APPEND SOURCE_FILES_C accountmanager.c tester.c)
set(SOURCE_FILES_OBJC )
if(APPLE)
if (IOS)
list(APPEND SOURCE_FILES_OBJC liblinphone_tester_ios.m)
endif()
endif()
apply_compile_flags(SOURCE_FILES_C "CPP" "C")
apply_compile_flags(SOURCE_FILES_OBJC "CPP" "OBJC")
apply_compile_flags(SOURCE_FILES "CPP" "C")
if(MSVC)
get_source_file_property(MESSAGE_TESTER_C_COMPILE_FLAGS message_tester.c COMPILE_FLAGS)
set(MESSAGE_TESTER_C_COMPILE_FLAGS "${MESSAGE_TESTER_C_COMPILE_FLAGS} /wd4996") # Disable "was declared deprecated" warnings
......@@ -42,13 +70,14 @@ if(NOT IOS OR NOT CMAKE_SYSTEM_NAME STREQUAL "WindowsStore")
endif()
endif()
# on mobile platforms, we compile the tester as a library so that we can link with it directly from native applications
if(ANDROID OR IOS)
if(ANDROID)
add_library(linphonetester SHARED ${SOURCE_FILES})
add_library(linphonetester SHARED ${SOURCE_FILES_C})
set_target_properties(linphonetester PROPERTIES OUTPUT_NAME "linphonetester-${CMAKE_SYSTEM_PROCESSOR}")
endif()
if(IOS)
add_library(linphonetester STATIC ${SOURCE_FILES})
add_library(linphonetester STATIC ${SOURCE_FILES_C})
endif()
target_include_directories(linphonetester PUBLIC ${BCTOOLBOX_TESTER_INCLUDE_DIRS})
target_link_libraries(linphonetester linphone ${BCTOOLBOX_TESTER_LIBRARIES})
......@@ -63,7 +92,7 @@ if(ANDROID OR IOS)
PERMISSIONS OWNER_READ OWNER_WRITE GROUP_READ WORLD_READ
)
elseif(CMAKE_SYSTEM_NAME STREQUAL "WindowsStore")
add_library(linphone_tester_static STATIC ${SOURCE_FILES})
add_library(linphone_tester_static STATIC ${SOURCE_FILES_C})
target_include_directories(linphone_tester_static PUBLIC ${BCTOOLBOX_TESTER_INCLUDE_DIRS})
target_link_libraries(linphone_tester_static linphone ${BCTOOLBOX_TESTER_LIBRARIES})
......@@ -91,15 +120,24 @@ elseif(CMAKE_SYSTEM_NAME STREQUAL "WindowsStore")
PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE GROUP_READ GROUP_EXECUTE WORLD_READ WORLD_EXECUTE
)
endif()
else()
add_executable(liblinphone_tester ${SOURCE_FILES})
endif()
# on iOS though, we also build the exectuable so that one can compile it from Xcode and run it directly
if (NOT ANDROID AND NOT CMAKE_SYSTEM_NAME STREQUAL "WindowsStore")
if (IOS)
set_source_files_properties(${RESOURCES_FILES} PROPERTIES MACOSX_PACKAGE_LOCATION Resources)
add_executable(liblinphone_tester MACOSX_BUNDLE ${RESOURCES_FILES} ${SOURCE_FILES_C} ${SOURCE_FILES_OBJC})
set_target_properties(liblinphone_tester PROPERTIES LINK_FLAGS "-framework CoreFoundation -framework AudioToolbox -framework CoreAudio -framework Foundation -framework QuartzCore -framework OpenGLES -framework UIKit -framework AVFoundation -framework CoreGraphics -framework CoreMedia -framework CoreVideo -framework VideoToolbox")
else()
add_executable(liblinphone_tester ${SOURCE_FILES_C} ${SOURCE_FILES_OBJC})
endif()
set_target_properties(liblinphone_tester PROPERTIES LINKER_LANGUAGE CXX)
target_include_directories(liblinphone_tester PUBLIC ${BCTOOLBOX_TESTER_INCLUDE_DIRS})
target_link_libraries(liblinphone_tester linphone ${BCTOOLBOX_TESTER_LIBRARIES})
target_link_libraries(liblinphone_tester ${LINPHONE_LIBS_FOR_TOOLS} ${BCTOOLBOX_TESTER_LIBRARIES})
if (GTK2_FOUND)
target_compile_definitions(liblinphone_tester PRIVATE HAVE_GTK)
target_include_directories(liblinphone_tester PUBLIC ${GTK2_INCLUDE_DIRS})
target_link_libraries(liblinphone_tester linphone ${GTK2_LIBRARIES})
target_link_libraries(liblinphone_tester ${GTK2_LIBRARIES})
if(GTKMACINTEGRATION_FOUND)
target_include_directories(liblinphone_tester PUBLIC ${GTKMACINTEGRATION_INCLUDE_DIRS})
target_link_libraries(liblinphone_tester ${GTKMACINTEGRATION_LIBRARIES})
......
/*
linphone library - modular sound and video processing and streaming
Copyright (C) 2006-2014 Belledonne Communications, Grenoble
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
#if TARGET_OS_IPHONE
#import <Foundation/Foundation.h>
#import <UIKit/UIKit.h>
#include <AudioToolbox/AudioToolbox.h>
#include <CoreFoundation/CFRunLoop.h>
#include "liblinphone_tester.h"
int g_argc;
char** g_argv;
void stop_handler(int sig) {
return;
}
static void* _apple_main(void* data) {
NSString *bundlePath = [[[NSBundle mainBundle] bundlePath] retain];
NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES);
NSString *documentPath = [[paths objectAtIndex:0] retain];
NSLog(@"Bundle path: %@", bundlePath);
NSLog(@"Document path: %@", documentPath);
bc_tester_set_resource_dir_prefix(bundlePath.UTF8String);
bc_tester_set_writable_dir_prefix(documentPath.UTF8String);
liblinphone_tester_init(NULL);
bc_tester_start("toto");
liblinphone_tester_uninit();
[bundlePath release];
[documentPath release];
return NULL;
}
int main(int argc, char * argv[]) {
pthread_t main_thread;
g_argc=argc;
g_argv=argv;
pthread_create(&main_thread,NULL,_apple_main,NULL);
NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
int value = UIApplicationMain(0, nil, nil, nil);
[pool release];
return value;
pthread_join(main_thread,NULL);
return 0;
}
#endif // target IPHONE
<?xml version="1.0" encoding="UTF-8"?>
<config xmlns="http://www.linphone.org/xsds/lpconfig.xsd" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.linphone.org/xsds/lpconfig.xsd lpconfig.xsd">
<section name="sip">
<entry name="sip_port">-1</entry>
<entry name="sip_tcp_port">-1</entry>
<entry name="sip_tls_port">-1</entry>
<entry name="default_proxy">0</entry>
<entry name="ping_with_options">0</entry>
<entry name="register_only_when_network_is_up">0</entry>
<entry name="composing_idle_timeout">1</entry>
</section>
<section name="auth_info_0">
<entry name="username">marie</entry>
<entry name="userid">marie</entry>
<entry name="passwd">secret</entry>
<entry name="realm">sip.example.org</entry>
</section>
<section name="proxy_0">
<entry name="reg_proxy">sip.example.org;transport=tcp</entry>
<entry name="reg_route">sip.example.org;transport=tcp;lr</entry>
<entry name="reg_identity">sip:marie@sip.example.org</entry>
<entry name="reg_expires">3600</entry>
<entry name="reg_sendregister">1</entry>
<entry name="publish">0</entry>
<entry name="dial_escape_plus">0</entry>
</section>
<section name="friend_0">
<entry name="url">"Paupoche" &lt;sip:pauline@sip.example.org&gt;</entry>
<entry name="pol">accept</entry>
<entry name="subscribe">0</entry>
</section>
<section name="rtp">
<entry name="audio_rtp_port">8070</entry>
<entry name="video_rtp_port">9072</entry>
</section>
<section name="video">
<entry name="display">0</entry>
<entry name="capture">0</entry>
<entry name="show_local">0</entry>
<entry name="size">vga</entry>
<entry name="enabled">0</entry>
<entry name="self_view">0</entry>
<entry name="automatically_initiate">0</entry>
<entry name="automatically_accept">0</entry>
<entry name="device">StaticImage: Static picture</entry>
</section>
<section name="sound">
<entry name="echocancellation">0 #to not overload cpu in case of VG</entry>
</section>
</config>
......@@ -156,7 +156,9 @@ LinphoneCore* configure_lc_from(LinphoneCoreVTable* v_table, const char* path, c
sal_enable_test_features(lc->sal,TRUE);
sal_set_dns_user_hosts_file(lc->sal, dnsuserhostspath);
#ifdef VIDEO_ENABLED
linphone_core_set_static_picture(lc,nowebcampath);
#endif
ms_free(ringpath);
ms_free(ringbackpath);
......
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