From 6cd52eb0159613e9b99858df897a44db13752611 Mon Sep 17 00:00:00 2001 From: Jehan Monnier Date: Wed, 20 Jul 2011 16:36:13 +0200 Subject: [PATCH] enable x264 --- Classes/LinphoneUI/LinphoneManager.m | 13 ++++-- README | 1 + Settings.bundle/video.plist | 26 +++++++---- linphone.xcodeproj/project.pbxproj | 12 +++++ submodules/build/builder-iphone-os.mk | 6 +-- submodules/build/builders.d/ffmpeg.mk | 6 +-- submodules/build/builders.d/x264.mk | 63 +++++++++++++++++++++++++++ 7 files changed, 110 insertions(+), 17 deletions(-) create mode 100644 submodules/build/builders.d/x264.mk diff --git a/Classes/LinphoneUI/LinphoneManager.m b/Classes/LinphoneUI/LinphoneManager.m index fd183eb53..a67f41362 100644 --- a/Classes/LinphoneUI/LinphoneManager.m +++ b/Classes/LinphoneUI/LinphoneManager.m @@ -33,6 +33,10 @@ extern void libmsilbc_init(); #ifdef HAVE_AMR extern void libmsamr_init(); #endif +#ifdef HAVE_X264 +extern void libmsx264_init(); +#endif + @implementation LinphoneManager @synthesize callDelegate; @synthesize registrationDelegate; @@ -511,6 +515,7 @@ void networkReachabilityCallBack(SCNetworkReachabilityRef target, SCNetworkReach linphone_core_enable_payload_type(theLinphoneCore,pt,FALSE); } [self configurePayloadType:"MP4V-ES" fromPrefKey:@"mp4v-es_preference" withRate:90000]; + [self configurePayloadType:"H264" fromPrefKey:@"h264_preference" withRate:90000]; UIDevice* device = [UIDevice currentDevice]; @@ -669,9 +674,11 @@ void networkReachabilityCallBack(SCNetworkReachabilityRef target, SCNetworkReach #ifdef HAVE_AMR libmsamr_init(); //load amr plugin if present from the liblinphone sdk -#endif /* - * Initialize linphone core - */ +#endif +#ifdef HAVE_X264 + libmsx264_init(); //load x264 plugin if present from the liblinphone sdk +#endif + /* Initialize linphone core*/ theLinphoneCore = linphone_core_new (&linphonec_vtable , [confiFileName cStringUsingEncoding:[NSString defaultCStringEncoding]] diff --git a/README b/README index eadb9a98e..51a95ce31 100644 --- a/README +++ b/README @@ -13,6 +13,7 @@ Linphone for iPhone depends on liblinphone sdk. To build this sdk, you must inst gas-preprosessor.pl (http://github.com/yuvi/gas-preprocessor/ ) to be copied into /opt/local/bin Link macport libtoolize to glibtoolize (sudo ln -s /opt/local/bin/glibtoolize /opt/local/bin/libtoolize) +Link host's strings to simulator SDK (ln -s /usr/bin/strings /Developer/Platforms/iPhoneSimulator.platform/Developer/usr/bin/strings) You may update variable SDK_VERSION from file submodules/build/iphone-config.site according to your iPhone SDK version. Current is 4.0 diff --git a/Settings.bundle/video.plist b/Settings.bundle/video.plist index b8f578b92..9af1c4bb4 100644 --- a/Settings.bundle/video.plist +++ b/Settings.bundle/video.plist @@ -5,20 +5,30 @@ PreferenceSpecifiers - Type - PSGroupSpecifier Title Codecs + Type + PSGroupSpecifier - Type - PSToggleSwitchSpecifier - Title - mpeg4 - Key - mp4v-es_preference DefaultValue + Key + mp4v-es_preference + Title + mpeg4 + Type + PSToggleSwitchSpecifier + + + DefaultValue + + Key + h264_preference + Title + h264 + Type + PSToggleSwitchSpecifier diff --git a/linphone.xcodeproj/project.pbxproj b/linphone.xcodeproj/project.pbxproj index b2e7eb85b..b88f1b2c5 100755 --- a/linphone.xcodeproj/project.pbxproj +++ b/linphone.xcodeproj/project.pbxproj @@ -71,6 +71,8 @@ 22968A5F12F875C600588287 /* UISpeakerButton.m in Sources */ = {isa = PBXBuildFile; fileRef = 22968A5E12F875C600588287 /* UISpeakerButton.m */; }; 22968A8812F87C2000588287 /* UIDuration.m in Sources */ = {isa = PBXBuildFile; fileRef = 22968A8712F87C2000588287 /* UIDuration.m */; }; 22A10F3B11F8960300373793 /* libortp.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 220FAD2C10765B400068D98F /* libortp.a */; }; + 22AA8AFD13D7125600B30535 /* libx264.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 22AA8AFB13D7125500B30535 /* libx264.a */; }; + 22AA8AFE13D7125600B30535 /* libmsx264.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 22AA8AFC13D7125500B30535 /* libmsx264.a */; }; 22B5EFA310CE50BD00777D97 /* AddressBookUI.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 22B5EFA210CE50BD00777D97 /* AddressBookUI.framework */; }; 22B5EFE510CE5E5800777D97 /* ContactPickerDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = 22B5EFE410CE5E5800777D97 /* ContactPickerDelegate.m */; }; 22B5F03510CE6B2F00777D97 /* AddressBook.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 22B5F03410CE6B2F00777D97 /* AddressBook.framework */; }; @@ -325,6 +327,8 @@ 22968A8612F87C2000588287 /* UIDuration.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = UIDuration.h; sourceTree = ""; }; 22968A8712F87C2000588287 /* UIDuration.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = UIDuration.m; sourceTree = ""; }; 22A10D9E11F88C1F00373793 /* liblinphone.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = liblinphone.xcodeproj; path = submodules/liblinphone.xcodeproj; sourceTree = ""; }; + 22AA8AFB13D7125500B30535 /* libx264.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; name = libx264.a; path = "liblinphone-sdk/apple-darwin/lib/libx264.a"; sourceTree = ""; }; + 22AA8AFC13D7125500B30535 /* libmsx264.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; name = libmsx264.a; path = "liblinphone-sdk/apple-darwin/lib/mediastreamer/plugins/libmsx264.a"; sourceTree = ""; }; 22B5EFA210CE50BD00777D97 /* AddressBookUI.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = AddressBookUI.framework; path = System/Library/Frameworks/AddressBookUI.framework; sourceTree = SDKROOT; }; 22B5EFE310CE5E5800777D97 /* ContactPickerDelegate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ContactPickerDelegate.h; sourceTree = ""; }; 22B5EFE410CE5E5800777D97 /* ContactPickerDelegate.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = ContactPickerDelegate.m; sourceTree = ""; }; @@ -468,6 +472,8 @@ 226F2ED61344B0EF00F6EF27 /* libopencore-amrwb.a in Frameworks */, 226F2ED71344B0EF00F6EF27 /* libopencore-amrnb.a in Frameworks */, 226F2ED81344B0EF00F6EF27 /* libmsamr.a in Frameworks */, + 22AA8AFD13D7125600B30535 /* libx264.a in Frameworks */, + 22AA8AFE13D7125600B30535 /* libmsx264.a in Frameworks */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -827,6 +833,8 @@ 29B97314FDCFA39411CA2CEA /* CustomTemplate */ = { isa = PBXGroup; children = ( + 22AA8AFB13D7125500B30535 /* libx264.a */, + 22AA8AFC13D7125500B30535 /* libmsx264.a */, 22F3D57D13CCC89600A0DA02 /* liblinphone.a */, 22E1A9E713CAF4AA00219531 /* video.plist */, 226B563E13CAF1CD00921595 /* audio.plist */, @@ -1104,6 +1112,7 @@ GCC_PREPROCESSOR_DEFINITIONS = ( IN_LINPHONE, VIDEO_ENABLED, + HAVE_X264, ); HEADER_SEARCH_PATHS = ( submodules/linphone/coreapi, @@ -1164,6 +1173,7 @@ GCC_PREPROCESSOR_DEFINITIONS = ( IN_LINPHONE, VIDEO_ENABLED, + HAVE_X264, ); HEADER_SEARCH_PATHS = ( submodules/linphone/coreapi, @@ -1222,6 +1232,7 @@ GCC_PREPROCESSOR_DEFINITIONS = ( IN_LINPHONE, VIDEO_ENABLED, + HAVE_X264, ); HEADER_SEARCH_PATHS = ( submodules/linphone/coreapi, @@ -1282,6 +1293,7 @@ GCC_PREPROCESSOR_DEFINITIONS = ( IN_LINPHONE, VIDEO_ENABLED, + HAVE_X264, ); HEADER_SEARCH_PATHS = ( submodules/linphone/coreapi, diff --git a/submodules/build/builder-iphone-os.mk b/submodules/build/builder-iphone-os.mk index 1fd9d8782..0ff3366ca 100644 --- a/submodules/build/builder-iphone-os.mk +++ b/submodules/build/builder-iphone-os.mk @@ -70,7 +70,7 @@ endif prefix?=$(BUILDER_SRC_DIR)/../liblinphone-sdk/$(host) -all: build-linphone build-msilbc build-msamr +all: build-linphone build-msilbc build-msamr build-msx264 clean-makefile: clean-makefile-linphone clean: clean-linphone @@ -84,10 +84,10 @@ veryclean: .NOTPARALLEL build-linphone: init build-openssl build-osip2 build-eXosip2 build-speex build-libgsm build-ffmpeg $(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-msamr clean-ffmpeg +clean-linphone: clean-osip2 clean-eXosip2 clean-speex clean-libgsm clean-msilbc clean-libilbc clean-openssl clean-msamr clean-ffmpeg clean-msx264 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-msamr +veryclean-linphone: clean-linphone veryclean-osip2 veryclean-eXosip2 veryclean-speex veryclean-libgsm veryclean-msilbc veryclean-libilbc veryclean-openssl veryclean-msamr veryclean-msx264 cd $(LINPHONE_BUILD_DIR) && make distclean cd $(LINPHONE_SRC_DIR) && rm -f configure diff --git a/submodules/build/builders.d/ffmpeg.mk b/submodules/build/builders.d/ffmpeg.mk index 4ca60c237..ff9f38e6c 100644 --- a/submodules/build/builders.d/ffmpeg.mk +++ b/submodules/build/builders.d/ffmpeg.mk @@ -23,13 +23,13 @@ ifneq (,$(findstring armv7,$(host))) endif ffmpeg_dir?=externals/ffmpeg -$(BUILDER_BUILD_DIR)/$(ffmpeg_dir)/Makefile: $(BUILDER_SRC_DIR)/$(ffmpeg_dir)/configure +$(BUILDER_BUILD_DIR)/$(ffmpeg_dir)/config.mak: mkdir -p $(BUILDER_BUILD_DIR)/$(ffmpeg_dir) cd $(BUILDER_BUILD_DIR)/$(ffmpeg_dir)/ \ && host_alias=${host} . $(BUILDER_SRC_DIR)/build/$(config_site) \ && $(BUILDER_SRC_DIR)/$(ffmpeg_dir)/configure --prefix=$(prefix) $(ffmpeg_configure_options) -build-ffmpeg: $(BUILDER_BUILD_DIR)/$(ffmpeg_dir)/Makefile +build-ffmpeg: $(BUILDER_BUILD_DIR)/$(ffmpeg_dir)/config.mak cd $(BUILDER_BUILD_DIR)/$(ffmpeg_dir) && PKG_CONFIG_PATH=$(prefix)/lib/pkgconfig CONFIG_SITE=$(BUILDER_SRC_DIR)/build/$(config_site) make && make install clean-ffmpeg: @@ -39,5 +39,5 @@ veryclean-ffmpeg: cd $(BUILDER_BUILD_DIR)/$(ffmpeg_dir) && make distclean clean-makefile-ffmpeg: - cd $(BUILDER_BUILD_DIR)/$(ffmpeg_dir) && rm -f Makefile + cd $(BUILDER_BUILD_DIR)/$(ffmpeg_dir) && rm -f config.mak diff --git a/submodules/build/builders.d/x264.mk b/submodules/build/builders.d/x264.mk new file mode 100644 index 000000000..eb6d1d086 --- /dev/null +++ b/submodules/build/builders.d/x264.mk @@ -0,0 +1,63 @@ +############################################################################ +# x264.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. +# +############################################################################ +x264-configure-option= \ + --host=$(host)\ + --cross-prefix=$$SDK_BIN_PATH/ \ + --extra-ldflags="-arch $$ARCH -isysroot $$SYSROOT_PATH" + + + +ifneq (,$(findstring i386,$(host))) + x264-configure-option+= --extra-cflags="-arch $$ARCH -isysroot $$SYSROOT_PATH" +endif +ifneq (,$(findstring armv6,$(host))) + x264-configure-option+= --extra-cflags="-arch $$ARCH -mcpu=arm1176jzf-s -marm -isysroot $$SYSROOT_PATH" + x264-configure-option+= --disable-asm +endif + +ifneq (,$(findstring armv7,$(host))) + x264-configure-option+= --extra-cflags="-arch $$ARCH -mcpu=cortex-a8 -mfpu=neon -mfloat-abi=softfp -isysroot $$SYSROOT_PATH" +endif + +x264_dir?=externals/x264 +$(BUILDER_BUILD_DIR)/$(x264_dir)/configure: + mkdir -p $(BUILDER_BUILD_DIR)/$(x264_dir) + cd $(BUILDER_BUILD_DIR)/$(x264_dir)/ \ + && rsync -av --exclude ".git" $(BUILDER_SRC_DIR)/$(x264_dir)/* . + +$(BUILDER_BUILD_DIR)/$(x264_dir)/config.mak: $(BUILDER_BUILD_DIR)/$(x264_dir)/configure + cd $(BUILDER_BUILD_DIR)/$(x264_dir)/ \ + && host_alias=$(host) . $(BUILDER_SRC_DIR)/build/$(config_site) \ + && ./configure --prefix=$(prefix) ${x264-configure-option} + +build-x264: $(BUILDER_BUILD_DIR)/$(x264_dir)/config.mak + cd $(BUILDER_BUILD_DIR)/$(x264_dir) make && make install + +clean-x264: + cd $(BUILDER_BUILD_DIR)/$(x264_dir) && make clean + +veryclean-x264: + -cd $(BUILDER_BUILD_DIR)/$(x264_dir) && make distclean + rm -rf $(BUILDER_BUILD_DIR)/$(x264_dir) + +clean-makefile-x264: + cd $(BUILDER_BUILD_DIR)/$(x264_dir) && rm -f config.mak