From 41a2a3366684da1a04733ada416d7d3f21d162b2 Mon Sep 17 00:00:00 2001 From: Jehan Monnier Date: Thu, 16 Feb 2012 15:46:45 +0100 Subject: [PATCH] g729A integration based on bcg729 --- .gitmodules | 3 ++ Classes/LinphoneAppDelegate.m | 4 +- Classes/LinphoneUI/LinphoneManager.m | 8 ++++ PhoneMainView.xib | 6 +-- README | 6 +-- linphone.xcodeproj/project.pbxproj | 8 ++++ submodules/bcg729 | 1 + submodules/build/builder-iphone-os.mk | 8 ++-- submodules/build/builders.d/msbcg729.mk | 61 +++++++++++++++++++++++++ 9 files changed, 93 insertions(+), 12 deletions(-) create mode 160000 submodules/bcg729 create mode 100644 submodules/build/builders.d/msbcg729.mk diff --git a/.gitmodules b/.gitmodules index 8ba0b2856..48fa6c484 100644 --- a/.gitmodules +++ b/.gitmodules @@ -46,3 +46,6 @@ [submodule "submodules/externals/srtp"] path = submodules/externals/srtp url = git://git.linphone.org/srtp.git +[submodule "submodules/bcg729"] + path = submodules/bcg729 + url = git://git.linphone.org/bcg729.git diff --git a/Classes/LinphoneAppDelegate.m b/Classes/LinphoneAppDelegate.m index 52d29b56b..000ccd476 100644 --- a/Classes/LinphoneAppDelegate.m +++ b/Classes/LinphoneAppDelegate.m @@ -107,7 +107,9 @@ #ifdef HAVE_AMR @"YES",@"amr_8k_preference", // enable amr by default if compiled with #endif - @"NO",@"debugenable_preference", +#ifdef HAVE_G729 + @"YES",@"g729_preference", // enable amr by default if compiled with +#endif @"NO",@"debugenable_preference", //@"+33",@"countrycode_preference", nil]; diff --git a/Classes/LinphoneUI/LinphoneManager.m b/Classes/LinphoneUI/LinphoneManager.m index dcbb3af1a..295aa96c0 100644 --- a/Classes/LinphoneUI/LinphoneManager.m +++ b/Classes/LinphoneUI/LinphoneManager.m @@ -46,6 +46,9 @@ extern void libmsx264_init(); extern void libmssilk_init(); #endif +#if HAVE_G729 +extern void libmsbcg729_init(); +#endif @implementation LinphoneManager @synthesize callDelegate; @synthesize registrationDelegate; @@ -623,6 +626,7 @@ void networkReachabilityCallBack(SCNetworkReachabilityRef target, SCNetworkReach [self configurePayloadType:"PCMU" fromPrefKey:@"pcmu_preference" withRate:8000]; [self configurePayloadType:"PCMA" fromPrefKey:@"pcma_preference" withRate:8000]; [self configurePayloadType:"G722" fromPrefKey:@"g722_preference" withRate:8000]; + [self configurePayloadType:"G729" fromPrefKey:@"g729_preference" withRate:8000]; //get video codecs from linphonerc const MSList *videoCodecs=linphone_core_get_video_codecs(theLinphoneCore); @@ -791,6 +795,10 @@ void networkReachabilityCallBack(SCNetworkReachabilityRef target, SCNetworkReach #ifdef HAVE_X264 libmsx264_init(); //load x264 plugin if present from the liblinphone sdk #endif + +#if HAVE_G729 + libmsbcg729_init(); // load g729 plugin +#endif /* Initialize linphone core*/ theLinphoneCore = linphone_core_new (&linphonec_vtable diff --git a/PhoneMainView.xib b/PhoneMainView.xib index 3953ea8da..b4c3174c1 100644 --- a/PhoneMainView.xib +++ b/PhoneMainView.xib @@ -47,6 +47,7 @@ {320, 480} + 1 MSAxIDEAA @@ -140,6 +141,7 @@ 266 {{0, 431}, {320, 49}} + 3 MCAwAA @@ -366,10 +368,6 @@ com.apple.InterfaceBuilder.CocoaTouchPlugin.iPhoneOS - - com.apple.InterfaceBuilder.CocoaTouchPlugin.iPhoneOS - - com.apple.InterfaceBuilder.CocoaTouchPlugin.InterfaceBuilder3 diff --git a/README b/README index 69c6e6e7e..b2deec6fc 100644 --- a/README +++ b/README @@ -63,9 +63,9 @@ After the SDK is built, just open the linphone xcode project with Xcode, and pre * Note regarding third party components subject to license -The liblinphone-sdk is compiled with third parties code that are subject to patent license, specially: AMR, SILK and X264 codecs. -Linphone controls the embedding of these codecs thanks to the preprocessor macros HAVE_SILK, HAVE_AMR, HAVE_X264 positioned in xcode project. -Before embeding these 3 codecs in the final application, make sure to have the right to do so. +The liblinphone-sdk is compiled with third parties code that are subject to patent license, specially: AMR, SILK G729 and X264 codecs. +Linphone controls the embedding of these codecs thanks to the preprocessor macros HAVE_SILK, HAVE_AMR, HAVE_G729 HAVE_X264 positioned in xcode project. +Before embeding these 4 codecs in the final application, make sure to have the right to do so. LIMITATIONS, KNOWN BUGS diff --git a/linphone.xcodeproj/project.pbxproj b/linphone.xcodeproj/project.pbxproj index d5a94982e..a1a9668f2 100755 --- a/linphone.xcodeproj/project.pbxproj +++ b/linphone.xcodeproj/project.pbxproj @@ -93,6 +93,8 @@ 226183B0147259670037138E /* libmssilk.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 226183AF147259670037138E /* libmssilk.a */; }; 2264B6D211200342002C2C53 /* SystemConfiguration.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 2264B6D111200342002C2C53 /* SystemConfiguration.framework */; }; 226B563F13CAF1CD00921595 /* audio.plist in Resources */ = {isa = PBXBuildFile; fileRef = 226B563E13CAF1CD00921595 /* audio.plist */; }; + 226CDADF14E2D0B800513B67 /* libbcg729.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 226CDADD14E2D0B800513B67 /* libbcg729.a */; }; + 226CDAE014E2D0B800513B67 /* libmsbcg729.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 226CDADE14E2D0B800513B67 /* libmsbcg729.a */; }; 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 */; }; @@ -482,6 +484,8 @@ 226183AF147259670037138E /* libmssilk.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; name = libmssilk.a; path = "liblinphone-sdk/apple-darwin/lib/mediastreamer/plugins/libmssilk.a"; sourceTree = ""; }; 2264B6D111200342002C2C53 /* SystemConfiguration.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = SystemConfiguration.framework; path = System/Library/Frameworks/SystemConfiguration.framework; sourceTree = SDKROOT; }; 226B563E13CAF1CD00921595 /* audio.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; name = audio.plist; path = Settings.bundle/audio.plist; sourceTree = ""; }; + 226CDADD14E2D0B800513B67 /* libbcg729.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; name = libbcg729.a; path = "liblinphone-sdk/apple-darwin/lib/libbcg729.a"; sourceTree = ""; }; + 226CDADE14E2D0B800513B67 /* libmsbcg729.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; name = libmsbcg729.a; path = "liblinphone-sdk/apple-darwin/lib/mediastreamer/plugins/libmsbcg729.a"; sourceTree = ""; }; 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 = ""; }; @@ -649,6 +653,8 @@ isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; files = ( + 226CDADF14E2D0B800513B67 /* libbcg729.a in Frameworks */, + 226CDAE014E2D0B800513B67 /* libmsbcg729.a in Frameworks */, 344ABDF114850AE9007420B6 /* libc++.1.dylib in Frameworks */, 344ABDF214850AE9007420B6 /* libstdc++.6.dylib in Frameworks */, 344ABDE81484E723007420B6 /* libzrtpcpp.a in Frameworks */, @@ -1110,6 +1116,8 @@ 29B97314FDCFA39411CA2CEA /* CustomTemplate */ = { isa = PBXGroup; children = ( + 226CDADD14E2D0B800513B67 /* libbcg729.a */, + 226CDADE14E2D0B800513B67 /* libmsbcg729.a */, 344ABDEF14850AE9007420B6 /* libc++.1.dylib */, 344ABDF014850AE9007420B6 /* libstdc++.6.dylib */, 344ABDE71484E723007420B6 /* libzrtpcpp.a */, diff --git a/submodules/bcg729 b/submodules/bcg729 new file mode 160000 index 000000000..1ad5aa5ab --- /dev/null +++ b/submodules/bcg729 @@ -0,0 +1 @@ +Subproject commit 1ad5aa5abdf23bb260595b07f0705c9ede1a37d2 diff --git a/submodules/build/builder-iphone-os.mk b/submodules/build/builder-iphone-os.mk index 22362824a..e89de143d 100644 --- a/submodules/build/builder-iphone-os.mk +++ b/submodules/build/builder-iphone-os.mk @@ -45,7 +45,7 @@ BUILDER_BUILD_DIR?=$(shell pwd)/../build-$(host) LINPHONE_SRC_DIR=$(BUILDER_SRC_DIR)/linphone LINPHONE_BUILD_DIR=$(BUILDER_BUILD_DIR)/linphone -all: build-linphone build-msilbc build-msamr build-msx264 build-mssilk +all: build-linphone build-msilbc build-msamr build-msx264 build-mssilk build-msbcg729 $(LINPHONE_BUILD_DIR)/enable_gpl_third_parties: mkdir -p $(LINPHONE_BUILD_DIR) @@ -93,13 +93,13 @@ endif prefix?=$(BUILDER_SRC_DIR)/../liblinphone-sdk/$(host) -clean-makefile: clean-makefile-linphone -clean: clean-linphone +clean-makefile: clean-makefile-linphone clean-makefile-msbcg729 +clean: clean-linphone clean-msbcg729 init: mkdir -p $(prefix)/include mkdir -p $(prefix)/lib/pkgconfig -veryclean: veryclean-linphone +veryclean: veryclean-linphone veryclean-msbcg729 rm -rf $(BUILDER_BUILD_DIR) diff --git a/submodules/build/builders.d/msbcg729.mk b/submodules/build/builders.d/msbcg729.mk new file mode 100644 index 000000000..727be6148 --- /dev/null +++ b/submodules/build/builders.d/msbcg729.mk @@ -0,0 +1,61 @@ +############################################################################ +# msbcg729.mk +# Copyright (C) 2011 Belledonne Communications,Grenoble France +# +############################################################################ +# +# 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. +# +############################################################################ +msbcg729_dir?=bcg729 +enable_bcg729?=yes + +$(BUILDER_SRC_DIR)/$(msbcg729_dir)/configure: + @echo -e "\033[01;32m Running autogen for msbcg729 in $(BUILDER_SRC_DIR)/$(msbcg729_dir) \033[0m" + cd $(BUILDER_SRC_DIR)/$(msbcg729_dir) && ./autogen.sh + +$(BUILDER_BUILD_DIR)/$(msbcg729_dir)/Makefile: $(BUILDER_SRC_DIR)/$(msbcg729_dir)/configure + @echo -e "\033[01;32m Running configure in $(BUILDER_BUILD_DIR)/$(msbcg729_dir) \033[0m" + mkdir -p $(BUILDER_BUILD_DIR)/$(msbcg729_dir) + cd $(BUILDER_BUILD_DIR)/$(msbcg729_dir)/ \ + && PKG_CONFIG_PATH=$(prefix)/lib/pkgconfig CONFIG_SITE=$(BUILDER_SRC_DIR)/build/$(config_site) \ + $(BUILDER_SRC_DIR)/$(msbcg729_dir)/configure -prefix=$(prefix) --host=$(host) ${library_mode} \ + --enable-static + +ifeq ($(enable_bcg729),yes) + +build-msbcg729: $(BUILDER_BUILD_DIR)/$(msbcg729_dir)/Makefile + @echo -e "\033[01;32m building bcg729 \033[0m" + cd $(BUILDER_BUILD_DIR)/$(msbcg729_dir) \ + && PKG_CONFIG_PATH=$(prefix)/lib/pkgconfig \ + CONFIG_SITE=$(BUILDER_SRC_DIR)/build/$(config_site) \ + make -j1 && make install + + +else +build-msbcg729: + @echo "G729 is disabled" + +endif + +clean-msbcg729: + -cd $(BUILDER_BUILD_DIR)/$(msbcg729_dir) && make clean + +veryclean-msbcg729: + -cd $(BUILDER_BUILD_DIR)/$(msbcg729_dir) && make distclean + rm -f $(BUILDER_SRC_DIR)/$(msbcg729_dir)/configure + +clean-makefile-msbcg729: + -cd $(BUILDER_BUILD_DIR)/$(msbcg729_dir) && rm -f Makefile