diff --git a/coreapi/linphonecore.c b/coreapi/linphonecore.c index 1c5bf1f9d..001a83d09 100644 --- a/coreapi/linphonecore.c +++ b/coreapi/linphonecore.c @@ -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 diff --git a/mediastreamer2 b/mediastreamer2 index acdd30745..e7d1e3ca6 160000 --- a/mediastreamer2 +++ b/mediastreamer2 @@ -1 +1 @@ -Subproject commit acdd30745ad5c5f1e97edec4300c1a6448212a53 +Subproject commit e7d1e3ca68df2d9d13c8aa813780b2074de15a96 diff --git a/oRTP b/oRTP index 3d4de2044..f07032474 160000 --- a/oRTP +++ b/oRTP @@ -1 +1 @@ -Subproject commit 3d4de2044c3a08e5eefe7e945e82b5e321a6eea1 +Subproject commit f070324740b210977e619e716feeb63df0a6d84e diff --git a/tester/CMakeLists.txt b/tester/CMakeLists.txt index 992ec309d..10a2668f2 100644 --- a/tester/CMakeLists.txt +++ b/tester/CMakeLists.txt @@ -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}) diff --git a/tester/liblinphone_tester_ios.m b/tester/liblinphone_tester_ios.m new file mode 100644 index 000000000..60b53ee93 --- /dev/null +++ b/tester/liblinphone_tester_ios.m @@ -0,0 +1,67 @@ +/* + 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 +#import +#include +#include +#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 diff --git a/tester/marie_xml b/tester/marie_xml deleted file mode 100644 index 5818930ba..000000000 --- a/tester/marie_xml +++ /dev/null @@ -1,50 +0,0 @@ - - -
- -1 - -1 - -1 - 0 - 0 - 0 - 1 -
-
- marie - marie - secret - sip.example.org -
-
- sip.example.org;transport=tcp - sip.example.org;transport=tcp;lr - sip:marie@sip.example.org - 3600 - 1 - 0 - 0 -
-
- "Paupoche" <sip:pauline@sip.example.org> - accept - 0 -
-
- 8070 - 9072 -
-
- 0 - 0 - 0 - vga - 0 - 0 - 0 - 0 - StaticImage: Static picture -
-
- 0 #to not overload cpu in case of VG -
-
diff --git a/tester/tester.c b/tester/tester.c index 3861cf421..342722b3a 100644 --- a/tester/tester.c +++ b/tester/tester.c @@ -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);