diff --git a/Classes/IncallViewController.h b/Classes/IncallViewController.h index 071b37419..55b5fe2eb 100644 --- a/Classes/IncallViewController.h +++ b/Classes/IncallViewController.h @@ -34,6 +34,7 @@ UIButton* pause; UISpeakerButton* speaker; UIButton* contacts; + UIButton* addVideo; UITableView* callTableView; UIButton* addCall, *mergeCalls, *addToConf; @@ -89,6 +90,7 @@ @property (nonatomic, retain) IBOutlet UIButton* pause; @property (nonatomic, retain) IBOutlet UIButton* speaker; @property (nonatomic, retain) IBOutlet UIButton* contacts; +@property (nonatomic, retain) IBOutlet UIButton* addVideo; @property (nonatomic, retain) IBOutlet UITableView* callTableView; @property (nonatomic, retain) IBOutlet UIButton* addCall; @property (nonatomic, retain) IBOutlet UIButton* mergeCalls; diff --git a/Classes/IncallViewController.m b/Classes/IncallViewController.m index 7d9f6adeb..8c7cbcc39 100644 --- a/Classes/IncallViewController.m +++ b/Classes/IncallViewController.m @@ -184,6 +184,24 @@ int callCount(LinphoneCore* lc) { withDisplayName:nil]; } + + + UIDevice* device = [UIDevice currentDevice]; + if ([device respondsToSelector:@selector(isMultitaskingSupported)] + && [device isMultitaskingSupported]) { + bool enableVideo = [[NSUserDefaults standardUserDefaults] boolForKey:@"enable_video_preference"]; + bool startVideo = [[NSUserDefaults standardUserDefaults] boolForKey:@"start_video_preference"]; + if (enableVideo && !startVideo) { + [addVideo setHidden:FALSE]; + [contacts setHidden:TRUE]; + } else { + [addVideo setHidden:TRUE]; + [contacts setHidden:FALSE]; + } + + + } + } } diff --git a/Classes/IncallViewController.xib b/Classes/IncallViewController.xib index 678052028..f04038910 100644 --- a/Classes/IncallViewController.xib +++ b/Classes/IncallViewController.xib @@ -137,7 +137,7 @@ {{107, 70}, {106, 66}} - + NO NO @@ -215,7 +215,7 @@ {{0, 70}, {107, 66}} - + NO NO @@ -241,7 +241,7 @@ {{213, 70}, {107, 66}} - + NO NO @@ -264,6 +264,29 @@ + + + -2147483356 + {{213, 70}, {107, 66}} + + + + + NO + NO + IBCocoaTouchFramework + 0 + 0 + video + + + 1 + MC4xOTYwNzg0MzE0IDAuMzA5ODAzOTIxNiAwLjUyMTU2ODYyNzUAA + + + + + 292 @@ -326,7 +349,7 @@ {{107, 70}, {106, 66}} - + NO NO @@ -908,6 +931,14 @@ 114 + + + addVideo + + + + 125 + doAction: @@ -1127,6 +1158,7 @@ + controls @@ -1173,6 +1205,12 @@ merge + + 123 + + + video + @@ -1191,6 +1229,8 @@ 113.IBPluginDependency 113.IBUIButtonInspectorSelectedStateConfigurationMetadataKey 120.IBPluginDependency + 123.CustomClassName + 123.IBPluginDependency 13.CustomClassName 13.IBPluginDependency 13.IBUIButtonInspectorSelectedStateConfigurationMetadataKey @@ -1245,6 +1285,8 @@ com.apple.InterfaceBuilder.IBCocoaTouchPlugin com.apple.InterfaceBuilder.IBCocoaTouchPlugin + UIAddVideoButton + com.apple.InterfaceBuilder.IBCocoaTouchPlugin UISpeakerButton com.apple.InterfaceBuilder.IBCocoaTouchPlugin @@ -1298,7 +1340,7 @@ - 122 + 125 @@ -1323,6 +1365,7 @@ YES addCall addToConf + addVideo callControlSubView callTableView close @@ -1347,12 +1390,14 @@ star three two + videoViewController zero YES UIButton UIButton + UIButton UIView UITableView UIButton @@ -1377,6 +1422,7 @@ UIButton UIButton UIButton + VideoViewController UIButton @@ -1386,6 +1432,7 @@ YES addCall addToConf + addVideo callControlSubView callTableView close @@ -1410,6 +1457,7 @@ star three two + videoViewController zero @@ -1422,6 +1470,10 @@ addToConf UIButton + + addVideo + UIButton + callControlSubView UIView @@ -1518,6 +1570,10 @@ two UIButton + + videoViewController + VideoViewController + zero UIButton @@ -1529,6 +1585,33 @@ ./Classes/IncallViewController.h + + UIAddVideoButton + UIButton + + IBProjectSource + ./Classes/UIAddVideoButton.h + + + + UICamSwitch + UIButton + + preview + UIView + + + preview + + preview + UIView + + + + IBProjectSource + ./Classes/UICamSwitch.h + + UIDigitButton UIButton @@ -1537,6 +1620,14 @@ ./Classes/UIDigitButton.h + + UIHangUpButton + UIButton + + IBProjectSource + ./Classes/UIHangUpButton.h + + UIMuteButton UIToggleButton @@ -1561,6 +1652,116 @@ ./Classes/UIToggleButton.h + + VideoViewController + UIViewController + + YES + + YES + mCamSwitch + mCamSwitchLand + mDisplay + mDisplayLand + mHangUp + mHangUpLand + mLandscape + mMute + mMuteLand + mPortrait + mPreview + mPreviewLand + + + YES + UICamSwitch + UICamSwitch + UIView + UIView + UIHangUpButton + UIHangUpButton + UIView + UIMuteButton + UIMuteButton + UIView + UIView + UIView + + + + YES + + YES + mCamSwitch + mCamSwitchLand + mDisplay + mDisplayLand + mHangUp + mHangUpLand + mLandscape + mMute + mMuteLand + mPortrait + mPreview + mPreviewLand + + + YES + + mCamSwitch + UICamSwitch + + + mCamSwitchLand + UICamSwitch + + + mDisplay + UIView + + + mDisplayLand + UIView + + + mHangUp + UIHangUpButton + + + mHangUpLand + UIHangUpButton + + + mLandscape + UIView + + + mMute + UIMuteButton + + + mMuteLand + UIMuteButton + + + mPortrait + UIView + + + mPreview + UIView + + + mPreviewLand + UIView + + + + + IBProjectSource + ./Classes/VideoViewController.h + + 0 @@ -1604,7 +1805,7 @@ {82, 75} {164, 104} {164, 104} - {82, 82} + {20, 20} {164, 104} {164, 104} {164, 104} diff --git a/Classes/LinphoneUI/LinphoneManager.m b/Classes/LinphoneUI/LinphoneManager.m index 7db2ccd9e..4de33f114 100644 --- a/Classes/LinphoneUI/LinphoneManager.m +++ b/Classes/LinphoneUI/LinphoneManager.m @@ -560,6 +560,7 @@ void networkReachabilityCallBack(SCNetworkReachabilityRef target, SCNetworkReach bool enableVideo = [[NSUserDefaults standardUserDefaults] boolForKey:@"enable_video_preference"]; linphone_core_enable_video(theLinphoneCore, enableVideo, enableVideo); + bool enableSrtp = [[NSUserDefaults standardUserDefaults] boolForKey:@"enable_srtp_preference"]; linphone_core_set_media_encryption(theLinphoneCore, enableSrtp?LinphoneMediaEncryptionSRTP:LinphoneMediaEncryptionNone); diff --git a/Classes/LinphoneUI/UIAddVideoButton.h b/Classes/LinphoneUI/UIAddVideoButton.h new file mode 100644 index 000000000..275de0672 --- /dev/null +++ b/Classes/LinphoneUI/UIAddVideoButton.h @@ -0,0 +1,24 @@ +/* UIAddVideoButton.h + * + * Copyright (C) 2011 Belledonne Comunications, 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 Library 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. + */ + +#import + +@interface UIAddVideoButton : UIButton +- (id)initWithCoder:(NSCoder *)decoder; +@end diff --git a/Classes/LinphoneUI/UIAddVideoButton.m b/Classes/LinphoneUI/UIAddVideoButton.m new file mode 100644 index 000000000..e34cdfb8f --- /dev/null +++ b/Classes/LinphoneUI/UIAddVideoButton.m @@ -0,0 +1,58 @@ +/* UIAddVideoButton.m + * + * Copyright (C) 2011 Belledonne Comunications, 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 Library 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. + */ + +#import "UIAddVideoButton.h" +#include "LinphoneManager.h" + +@implementation UIAddVideoButton + +-(void) touchUp:(id) sender { + LinphoneCore* lc = [LinphoneManager getLc]; + LinphoneCall* call = linphone_core_get_current_call([LinphoneManager getLc]); + if (call) { + LinphoneCallParams* call_params = linphone_call_params_copy(linphone_call_get_current_params(call)); + linphone_call_params_enable_video(call_params, TRUE); + linphone_core_update_call(lc, call, call_params); + linphone_call_params_destroy(call_params); + } { + ms_warning("Cannot add video, because no current call"); + } +} + +- (id) init { + [self addTarget:self action:@selector(touchUp:) forControlEvents:UIControlEventTouchUpInside]; + return self; +} +- (id)initWithFrame:(CGRect)frame { + + self = [super initWithFrame:frame]; + if (self) { + [self init]; + } + return self; +} +- (id)initWithCoder:(NSCoder *)decoder { + self = [super initWithCoder:decoder]; + if (self) { + [self init]; + } + return self; +} + +@end diff --git a/Classes/LinphoneUI/UICallButton.m b/Classes/LinphoneUI/UICallButton.m index a63167009..82726e6c8 100644 --- a/Classes/LinphoneUI/UICallButton.m +++ b/Classes/LinphoneUI/UICallButton.m @@ -36,10 +36,12 @@ LinphoneProxyConfig* proxyCfg; //get default proxy linphone_core_get_default_proxy([LinphoneManager getLc],&proxyCfg); + bool startVideo = [[NSUserDefaults standardUserDefaults] boolForKey:@"start_video_preference"]; + LinphoneCallParams* lcallParams = linphone_core_create_default_call_parameters([LinphoneManager getLc]); if ([mAddress.text length] == 0) return; //just return if ([mAddress.text hasPrefix:@"sip:"]) { - linphone_core_invite([LinphoneManager getLc], [mAddress.text cStringUsingEncoding:[NSString defaultCStringEncoding]]); + linphone_core_invite_with_params([LinphoneManager getLc],[mAddress.text cStringUsingEncoding:[NSString defaultCStringEncoding]],lcallParams); } else if ( proxyCfg==nil){ UIAlertView* error = [[UIAlertView alloc] initWithTitle:NSLocalizedString(@"Invalid sip address",nil) message:NSLocalizedString(@"Either configure a SIP proxy server from settings prior to place a call or use a valid sip address (I.E sip:john@example.net)",nil) @@ -61,9 +63,14 @@ LinphoneAddress* tmpAddress = linphone_address_new(linphone_core_get_identity([LinphoneManager getLc])); linphone_address_set_username(tmpAddress,normalizedUserName); linphone_address_set_display_name(tmpAddress,[mDisplayName.text length]>0?[mDisplayName.text cStringUsingEncoding:[NSString defaultCStringEncoding]]:nil); - linphone_core_invite([LinphoneManager getLc],linphone_address_as_string(tmpAddress)) ; + + + linphone_call_params_enable_video(lcallParams,startVideo); + linphone_core_invite_address_with_params([LinphoneManager getLc],tmpAddress,lcallParams) ; + linphone_address_destroy(tmpAddress); } + linphone_call_params_destroy(lcallParams); } else if (linphone_core_inc_invite_pending([LinphoneManager getLc])) { linphone_core_accept_call([LinphoneManager getLc],linphone_core_get_current_call([LinphoneManager getLc])); } diff --git a/Settings.bundle/video.plist b/Settings.bundle/video.plist index 6123f2a4b..440f5ad90 100644 --- a/Settings.bundle/video.plist +++ b/Settings.bundle/video.plist @@ -14,6 +14,16 @@ DefaultValue + + Type + PSToggleSwitchSpecifier + Title + Automatically start video + Key + start_video_preference + DefaultValue + + Title Codecs diff --git a/linphone.xcodeproj/project.pbxproj b/linphone.xcodeproj/project.pbxproj index 3e0de55b1..b7a43f251 100755 --- a/linphone.xcodeproj/project.pbxproj +++ b/linphone.xcodeproj/project.pbxproj @@ -114,6 +114,8 @@ 22BB1A69132FF16A005CD7AA /* UIEraseButton.m in Sources */ = {isa = PBXBuildFile; fileRef = 22BB1A68132FF16A005CD7AA /* UIEraseButton.m */; }; 22C755601317E59C007BC101 /* UIBluetoothButton.m in Sources */ = {isa = PBXBuildFile; fileRef = 22C7555F1317E59C007BC101 /* UIBluetoothButton.m */; }; 22D1B68112A3E0BE001AE361 /* libresolv.dylib in Frameworks */ = {isa = PBXBuildFile; fileRef = 22D1B68012A3E0BE001AE361 /* libresolv.dylib */; }; + 22D817AD147A9F33001CFB9C /* UIAddVideoButton.m in Sources */ = {isa = PBXBuildFile; fileRef = 22D817AC147A9F33001CFB9C /* UIAddVideoButton.m */; }; + 22D817AE147A9F33001CFB9C /* UIAddVideoButton.m in Sources */ = {isa = PBXBuildFile; fileRef = 22D817AC147A9F33001CFB9C /* UIAddVideoButton.m */; }; 22D8F11F147548E2008C97DB /* linphonerc in Resources */ = {isa = PBXBuildFile; fileRef = 2274550710700509006EC466 /* linphonerc */; }; 22D8F120147548E2008C97DB /* PhoneViewController.xib in Resources */ = {isa = PBXBuildFile; fileRef = 22F2508D107141E100AC9B3F /* PhoneViewController.xib */; }; 22D8F121147548E2008C97DB /* ringback.wav in Resources */ = {isa = PBXBuildFile; fileRef = 22F254801073D99800AC9B3F /* ringback.wav */; }; @@ -547,6 +549,8 @@ 22C7564A13265C6A007BC101 /* x509_vfy.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = x509_vfy.h; sourceTree = ""; }; 22C7564B13265C6A007BC101 /* x509v3.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = x509v3.h; sourceTree = ""; }; 22D1B68012A3E0BE001AE361 /* libresolv.dylib */ = {isa = PBXFileReference; lastKnownFileType = "compiled.mach-o.dylib"; name = libresolv.dylib; path = usr/lib/libresolv.dylib; sourceTree = SDKROOT; }; + 22D817AB147A9F33001CFB9C /* UIAddVideoButton.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = UIAddVideoButton.h; sourceTree = ""; }; + 22D817AC147A9F33001CFB9C /* UIAddVideoButton.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = UIAddVideoButton.m; sourceTree = ""; }; 22D8F187147548E2008C97DB /* linphone-no-gpl-thirdparties.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = "linphone-no-gpl-thirdparties.app"; sourceTree = BUILT_PRODUCTS_DIR; }; 22D8F189147548E3008C97DB /* linphone copy-Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; name = "linphone copy-Info.plist"; path = "/Users/jehanmonnier/workspaces/workspace-iphone-port/linphone-iphone/linphone copy-Info.plist"; sourceTree = ""; }; 22E028B413B4CCBD0068A713 /* VideoViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = VideoViewController.h; sourceTree = ""; }; @@ -947,6 +951,8 @@ 223963161393CFAF001DE689 /* FastAddressBook.m */, 22AA8AFF13D83F6300B30535 /* UICamSwitch.h */, 22AA8B0013D83F6300B30535 /* UICamSwitch.m */, + 22D817AB147A9F33001CFB9C /* UIAddVideoButton.h */, + 22D817AC147A9F33001CFB9C /* UIAddVideoButton.m */, ); path = LinphoneUI; sourceTree = ""; @@ -1357,6 +1363,7 @@ 2211DBBC14769C8300DEE054 /* AdvancedPhoneViewController.m in Sources */, 2211DBBE14769C8300DEE054 /* CallDelegate.m in Sources */, 2211DBC014769CB200DEE054 /* IncallViewController.m in Sources */, + 22D817AD147A9F33001CFB9C /* UIAddVideoButton.m in Sources */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -1389,6 +1396,7 @@ 2211DBBD14769C8300DEE054 /* AdvancedPhoneViewController.m in Sources */, 2211DBBF14769C8300DEE054 /* CallDelegate.m in Sources */, 2211DBC114769CB300DEE054 /* IncallViewController.m in Sources */, + 22D817AE147A9F33001CFB9C /* UIAddVideoButton.m in Sources */, ); runOnlyForDeploymentPostprocessing = 0; };