From a9ab705dfa0ae1790bf327fe189d267307e089f2 Mon Sep 17 00:00:00 2001 From: Jehan Monnier Date: Mon, 4 Apr 2011 14:54:28 +0200 Subject: [PATCH] add AMR support. Should be use with compilation flag HAVE_AMR --- .gitmodules | 6 ++++++ Classes/LinphoneAppDelegate.m | 3 +++ Classes/LinphoneUI/LinphoneManager.m | 10 +++++++--- linphone.xcodeproj/project.pbxproj | 27 ++++++++++++++++++++++++--- submodules/build/builder-iphone-os.mk | 8 ++++---- submodules/externals/opencore-amr | 1 + submodules/msamr | 1 + 7 files changed, 46 insertions(+), 10 deletions(-) create mode 160000 submodules/externals/opencore-amr create mode 160000 submodules/msamr diff --git a/.gitmodules b/.gitmodules index 997c89307..adcac5915 100644 --- a/.gitmodules +++ b/.gitmodules @@ -19,3 +19,9 @@ [submodule "submodules/libilbc-rfc3951"] path = submodules/libilbc-rfc3951 url = git://git.linphone.org/libilbc-rfc3951.git +[submodule "submodules/externals/opencore-amr"] + path = submodules/externals/opencore-amr + url = git://opencore-amr.git.sourceforge.net/gitroot/opencore-amr/opencore-amr +[submodule "submodules/msamr"] + path = submodules/msamr + url = git://git.linphone.org/msamr.git diff --git a/Classes/LinphoneAppDelegate.m b/Classes/LinphoneAppDelegate.m index 41bb737b9..dc44c57e0 100644 --- a/Classes/LinphoneAppDelegate.m +++ b/Classes/LinphoneAppDelegate.m @@ -64,6 +64,9 @@ NSDictionary *appDefaults = [NSDictionary dictionaryWithObjectsAndKeys: @"NO", @"enable_first_login_view_preference", // +#ifdef HAVE_AMR + @"YES",@"amr_8k_preference", // enable amr by default if compiled with +#endif nil]; [defaultsToRegister addEntriesFromDictionary:appDefaults]; diff --git a/Classes/LinphoneUI/LinphoneManager.m b/Classes/LinphoneUI/LinphoneManager.m index f78ef8daa..014157ebe 100644 --- a/Classes/LinphoneUI/LinphoneManager.m +++ b/Classes/LinphoneUI/LinphoneManager.m @@ -30,8 +30,9 @@ static LinphoneCore* theLinphoneCore=nil; static LinphoneManager* theLinphoneManager=nil; extern void libmsilbc_init(); - - +#ifdef HAVE_AMR +extern void libmsamr_init(); +#endif @implementation LinphoneManager @synthesize callDelegate; @synthesize registrationDelegate; @@ -431,6 +432,7 @@ void networkReachabilityCallBack(SCNetworkReachabilityRef target, SCNetworkReach //read codecs from setting bundle and enable them one by one [self configurePayloadType:"speex" fromPrefKey:@"speex_16k_preference" withRate:16000]; [self configurePayloadType:"speex" fromPrefKey:@"speex_8k_preference" withRate:8000]; + [self configurePayloadType:"AMR" fromPrefKey:@"amr_8k_preference" withRate:8000]; [self configurePayloadType:"GSM" fromPrefKey:@"gsm_8k_preference" withRate:8000]; [self configurePayloadType:"iLBC" fromPrefKey:@"ilbc_preference" withRate:8000]; [self configurePayloadType:"PCMU" fromPrefKey:@"pcmu_preference" withRate:8000]; @@ -585,7 +587,9 @@ void networkReachabilityCallBack(SCNetworkReachabilityRef target, SCNetworkReach libmsilbc_init(); - /* +#ifdef HAVE_AMR + libmsamr_init(); //load amr plugin if present from the liblinphone sdk +#endif /* * Initialize linphone core */ diff --git a/linphone.xcodeproj/project.pbxproj b/linphone.xcodeproj/project.pbxproj index 8f54e6647..a514d84aa 100755 --- a/linphone.xcodeproj/project.pbxproj +++ b/linphone.xcodeproj/project.pbxproj @@ -51,6 +51,9 @@ 225CB2EE11ABB65D00628906 /* clavier-01-160px.png in Resources */ = {isa = PBXBuildFile; fileRef = 225CB2ED11ABB65D00628906 /* clavier-01-160px.png */; }; 225CB2FA11ABB76400628906 /* linphone-banner.png in Resources */ = {isa = PBXBuildFile; fileRef = 225CB2F911ABB76400628906 /* linphone-banner.png */; }; 2264B6D211200342002C2C53 /* SystemConfiguration.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 2264B6D111200342002C2C53 /* SystemConfiguration.framework */; }; + 226F2ED61344B0EF00F6EF27 /* libopencore-amrwb.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 226F2ED31344B0EF00F6EF27 /* libopencore-amrwb.a */; }; + 226F2ED71344B0EF00F6EF27 /* libopencore-amrnb.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 226F2ED41344B0EF00F6EF27 /* libopencore-amrnb.a */; }; + 226F2ED81344B0EF00F6EF27 /* libmsamr.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 226F2ED51344B0EF00F6EF27 /* libmsamr.a */; }; 2274401A106F31BD006EC466 /* CoreAudio.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 22744019106F31BD006EC466 /* CoreAudio.framework */; }; 2274402F106F335E006EC466 /* AudioToolbox.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 2274402E106F335E006EC466 /* AudioToolbox.framework */; }; 2274550810700509006EC466 /* linphonerc in Resources */ = {isa = PBXBuildFile; fileRef = 2274550710700509006EC466 /* linphonerc */; }; @@ -270,6 +273,9 @@ 225CB2ED11ABB65D00628906 /* clavier-01-160px.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = "clavier-01-160px.png"; path = "Resources/clavier-01-160px.png"; sourceTree = ""; }; 225CB2F911ABB76400628906 /* linphone-banner.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = "linphone-banner.png"; path = "liblinphone-sdk/apple-darwin/share/pixmaps/linphone/linphone-banner.png"; sourceTree = ""; }; 2264B6D111200342002C2C53 /* SystemConfiguration.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = SystemConfiguration.framework; path = System/Library/Frameworks/SystemConfiguration.framework; sourceTree = SDKROOT; }; + 226F2ED31344B0EF00F6EF27 /* libopencore-amrwb.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; name = "libopencore-amrwb.a"; path = "liblinphone-sdk/apple-darwin/lib/libopencore-amrwb.a"; sourceTree = ""; }; + 226F2ED41344B0EF00F6EF27 /* libopencore-amrnb.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; name = "libopencore-amrnb.a"; path = "liblinphone-sdk/apple-darwin/lib/libopencore-amrnb.a"; sourceTree = ""; }; + 226F2ED51344B0EF00F6EF27 /* libmsamr.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; name = libmsamr.a; path = "liblinphone-sdk/apple-darwin/lib/mediastreamer/plugins/libmsamr.a"; sourceTree = ""; }; 22744019106F31BD006EC466 /* CoreAudio.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreAudio.framework; path = System/Library/Frameworks/CoreAudio.framework; sourceTree = SDKROOT; }; 2274402E106F335E006EC466 /* AudioToolbox.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = AudioToolbox.framework; path = System/Library/Frameworks/AudioToolbox.framework; sourceTree = SDKROOT; }; 22744043106F33FC006EC466 /* Security.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Security.framework; path = System/Library/Frameworks/Security.framework; sourceTree = SDKROOT; }; @@ -414,6 +420,9 @@ 22A10F3B11F8960300373793 /* libortp.a in Frameworks */, 22D1B68112A3E0BE001AE361 /* libresolv.dylib in Frameworks */, 2252941412F6DAA400DD9BFB /* libmediastreamer.a in Frameworks */, + 226F2ED61344B0EF00F6EF27 /* libopencore-amrwb.a in Frameworks */, + 226F2ED71344B0EF00F6EF27 /* libopencore-amrnb.a in Frameworks */, + 226F2ED81344B0EF00F6EF27 /* libmsamr.a in Frameworks */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -778,6 +787,9 @@ 220FAD2E10765B400068D98F /* libosipparser2.a */, 220FAD2F10765B400068D98F /* libspeex.a */, 220FAD3010765B400068D98F /* libspeexdsp.a */, + 226F2ED31344B0EF00F6EF27 /* libopencore-amrwb.a */, + 226F2ED41344B0EF00F6EF27 /* libopencore-amrnb.a */, + 226F2ED51344B0EF00F6EF27 /* libmsamr.a */, 220FAC77107654FC0068D98F /* include */, 080E96DDFE201D6D7F000001 /* Classes */, 29B97315FDCFA39411CA2CEA /* Other Sources */, @@ -994,7 +1006,10 @@ GCC_OPTIMIZATION_LEVEL = 0; GCC_PRECOMPILE_PREFIX_HEADER = YES; GCC_PREFIX_HEADER = linphone_Prefix.pch; - GCC_PREPROCESSOR_DEFINITIONS = IN_LINPHONE; + GCC_PREPROCESSOR_DEFINITIONS = ( + IN_LINPHONE, + HAVE_AMR, + ); HEADER_SEARCH_PATHS = ( submodules/linphone/coreapi, submodules/linphone/mediastreamer2/include, @@ -1061,7 +1076,10 @@ GCC_OPTIMIZATION_LEVEL = 0; GCC_PRECOMPILE_PREFIX_HEADER = YES; GCC_PREFIX_HEADER = linphone_Prefix.pch; - GCC_PREPROCESSOR_DEFINITIONS = IN_LINPHONE; + GCC_PREPROCESSOR_DEFINITIONS = ( + IN_LINPHONE, + HAVE_AMR, + ); HEADER_SEARCH_PATHS = ( submodules/linphone/coreapi, submodules/linphone/mediastreamer2/include, @@ -1128,7 +1146,10 @@ GCC_OPTIMIZATION_LEVEL = 0; GCC_PRECOMPILE_PREFIX_HEADER = YES; GCC_PREFIX_HEADER = linphone_Prefix.pch; - GCC_PREPROCESSOR_DEFINITIONS = IN_LINPHONE; + GCC_PREPROCESSOR_DEFINITIONS = ( + IN_LINPHONE, + HAVE_AMR, + ); HEADER_SEARCH_PATHS = ( submodules/linphone/coreapi, submodules/linphone/mediastreamer2/include, diff --git a/submodules/build/builder-iphone-os.mk b/submodules/build/builder-iphone-os.mk index 298582d87..56e3c6fc4 100644 --- a/submodules/build/builder-iphone-os.mk +++ b/submodules/build/builder-iphone-os.mk @@ -68,7 +68,7 @@ endif prefix?=$(BUILDER_SRC_DIR)/../liblinphone-sdk/$(host) -all: build-linphone build-msilbc +all: build-linphone build-msilbc build-msamr clean-makefile: clean-makefile-linphone clean: clean-linphone @@ -82,14 +82,14 @@ veryclean: .NOTPARALLEL build-linphone: init build-openssl build-osip2 build-eXosip2 build-speex build-libgsm $(LINPHONE_BUILD_DIR)/Makefile cd $(LINPHONE_BUILD_DIR) && export PKG_CONFIG_PATH=$(prefix)/lib/pkgconfig export CONFIG_SITE=$(BUILDER_SRC_DIR)/build/$(config_site) make newdate && make && make install -clean-linphone: clean-osip2 clean-eXosip2 clean-speex clean-libgsm clean-msilbc clean-libilbc clean-openssl +clean-linphone: clean-osip2 clean-eXosip2 clean-speex clean-libgsm clean-msilbc clean-libilbc clean-openssl clean-msamr cd $(LINPHONE_BUILD_DIR) && make clean -veryclean-linphone: clean-linphone veryclean-osip2 veryclean-eXosip2 veryclean-speex veryclean-libgsm veryclean-msilbc veryclean-libilbc veryclean-openssl +veryclean-linphone: clean-linphone veryclean-osip2 veryclean-eXosip2 veryclean-speex veryclean-libgsm veryclean-msilbc veryclean-libilbc veryclean-openssl veryclean-msamr cd $(LINPHONE_BUILD_DIR) && make distclean cd $(LINPHONE_SRC_DIR) && rm -f configure -clean-makefile-linphone: clean-makefile-osip2 clean-makefile-eXosip2 clean-makefile-speex clean-makefile-libilbc clean-makefile-msilbc clean-makefile-openssl +clean-makefile-linphone: clean-makefile-osip2 clean-makefile-eXosip2 clean-makefile-speex clean-makefile-libilbc clean-makefile-msilbc clean-makefile-openssl clean-makefile-msamr cd $(LINPHONE_BUILD_DIR) && rm -f Makefile && rm -f oRTP/Makefile && rm -f mediastreamer2/Makefile diff --git a/submodules/externals/opencore-amr b/submodules/externals/opencore-amr new file mode 160000 index 000000000..cf4409e03 --- /dev/null +++ b/submodules/externals/opencore-amr @@ -0,0 +1 @@ +Subproject commit cf4409e03ec56b1cd85a2f9532f58bc1fa9db274 diff --git a/submodules/msamr b/submodules/msamr new file mode 160000 index 000000000..17391e324 --- /dev/null +++ b/submodules/msamr @@ -0,0 +1 @@ +Subproject commit 17391e32465c25feec9b3b44b6967775ea9a56a9