Merge branch 'master' into apple_store

Conflicts:
	Classes/SettingsViewController.m
This commit is contained in:
Guillaume BIENKOWSKI 2013-10-14 17:11:07 +02:00
commit 7f944c91d0
6 changed files with 100 additions and 27 deletions

View file

@ -112,6 +112,7 @@ typedef struct _LinphoneManagerSounds {
+ (BOOL)runningOnIpad;
+ (BOOL)isNotIphone3G;
+ (NSString *)getPreferenceForCodec: (const char*) name withRate: (int) rate;
+ (BOOL)isCodecSupported: (const char*)codecName;
+ (NSSet *)unsupportedCodecs;
+ (NSString *)getUserAgent;

View file

@ -149,14 +149,30 @@ struct codec_name_pref_table codec_pref_table[]={
+ (NSSet *)unsupportedCodecs {
NSMutableSet *set = [NSMutableSet set];
for(int i=0;codec_pref_table[i].name!=NULL;++i) {
if(linphone_core_find_payload_type(theLinphoneCore,codec_pref_table[i].name
, codec_pref_table[i].rate,LINPHONE_FIND_PAYLOAD_IGNORE_CHANNELS) == NULL) {
PayloadType* available = linphone_core_find_payload_type(theLinphoneCore,
codec_pref_table[i].name,
codec_pref_table[i].rate,
LINPHONE_FIND_PAYLOAD_IGNORE_CHANNELS);
if( (available == NULL)
// these two codecs should not be hidden, even if not supported
&& [codec_pref_table[i].prefname isEqualToString:@"h264_preference"]
&& [codec_pref_table[i].prefname isEqualToString:@"mp4v-es_preference"]
)
{
[set addObject:codec_pref_table[i].prefname];
}
}
return set;
}
+ (BOOL)isCodecSupported: (const char *)codecName {
return (codecName != NULL) &&
(NULL != linphone_core_find_payload_type(theLinphoneCore, codecName,
LINPHONE_FIND_PAYLOAD_IGNORE_RATE,
LINPHONE_FIND_PAYLOAD_IGNORE_CHANNELS));
}
+ (BOOL)runningOnIpad {
#ifdef UI_USER_INTERFACE_IDIOM
return (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPad);

View file

@ -547,13 +547,18 @@ static UICompositeViewDescription *compositeDescription = nil;
+ (IASKSpecifier*)disableCodecSpecifier:(IASKSpecifier *)specifier {
NSMutableDictionary *dict = [NSMutableDictionary dictionaryWithDictionary:[specifier specifierDict]];
NSMutableString *type = [NSMutableString stringWithString:[dict objectForKey:@"Type"]];
[type setString:@"PSTitleValueSpecifier"];
[dict setObject:type forKey:@"Type"];
NSMutableArray *values = [NSMutableArray arrayWithObject:[NSNumber numberWithInt:0]];
[dict setObject:values forKey:@"Values"];
NSMutableArray *titles = [NSMutableArray arrayWithObject:NSLocalizedString(@"Disabled, build from sources to enable", nil)];
[dict setObject:titles forKey:@"Titles"];
NSMutableString *type = [NSMutableString stringWithString:[dict objectForKey:kIASKType]];
[type setString:kIASKPSTitleValueSpecifier];
[dict setObject:type forKey:kIASKType];
NSMutableArray *values = [NSMutableArray arrayWithObjects:[NSNumber numberWithInt:0], [NSNumber numberWithInt:1], nil ];
[dict setObject:values forKey:kIASKValues];
NSString* title = NSLocalizedString(@"Disabled, build from sources to enable", nil);
NSMutableArray *titles = [NSMutableArray arrayWithObjects:title, title, nil];
[dict setObject:titles forKey:kIASKTitles];
return [[[IASKSpecifier alloc] initWithSpecifier:dict] autorelease];
}
@ -594,13 +599,12 @@ static UICompositeViewDescription *compositeDescription = nil;
}
#endif //HAVE_SSL
// Disable H264
if ([[specifier key] isEqualToString:@"h264_preference"]) {
// Add "build from source" if MPEG4 or H264 disabled
if ([[specifier key] isEqualToString:@"h264_preference"] && ![LinphoneManager isCodecSupported:"h264"]) {
return [SettingsViewController disableCodecSpecifier:specifier];
}
// Disable MPEG4
if ([[specifier key] isEqualToString:@"mp4v-es_preference"]) {
if ([[specifier key] isEqualToString:@"mp4v-es_preference"] && ![LinphoneManager isCodecSupported:"mp4v-es"]) {
return [SettingsViewController disableCodecSpecifier:specifier];
}

53
ImageOptim.sh Executable file
View file

@ -0,0 +1,53 @@
#!/bin/sh
# ImageOptim.sh
# linphone
#
# Created by guillaume on 14/10/13.
#
if [ "$CONFIGURATION" == "Debug" ]; then
exit 0
fi
CONVERT=/opt/local/bin/convert
CONVERTFILTER="-sharpen 1x0.0 -filter Catrom"
OPTIPNG=/opt/local/bin/optipng
CMDS="${CONVERT} ${OPTIPNG}"
for i in $CMDS; do
command -v $i > /dev/null && continue || { echo "$i command not found"; exit 1; }
done
exit 0
DIR=${CONFIGURATION_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}
PNGS=$(find $DIR -type f -name *.png)
echo "Running PNG optimization in $DIR"
for PNG in $PNGS; do
BASENAME=$(basename $PNG ".png")
PROCESS=false # put true here when the resizing is fixed
if [ -f $DIR/$BASENAME"@2x.png" ]; then
echo "Don't process $BASENAME";
PROCESS=false
fi
case $BASENAME in *@2x)
echo "Skip $BASENAME";
continue
esac
if $PROCESS ; then
echo -n "Processing ${BASENAME} (${CONVERTFILTER})..."
mv $DIR/$BASENAME".png" $DIR/$BASENAME"@2x.png"
$CONVERT $DIR/$BASENAME"@2x.png" $CONVERTFILTER -resize "50%" $DIR/$BASENAME".png" > /dev/null
fi
echo "Optimizing ${BASENAME} and ${BASENAME}@2x ..."
$OPTIPNG -quiet $DIR/$BASENAME"@2x.png" > /dev/null
$OPTIPNG -quiet $DIR/$BASENAME".png" > /dev/null
done

View file

@ -1340,6 +1340,8 @@
D3F9A9DB15AEEB940045320F /* history_notification.png in Resources */ = {isa = PBXBuildFile; fileRef = D3F9A9DA15AEEB940045320F /* history_notification.png */; };
D3F9A9EE15AF277E0045320F /* UACellBackgroundView.m in Sources */ = {isa = PBXBuildFile; fileRef = D3F9A9ED15AF277D0045320F /* UACellBackgroundView.m */; };
D3F9A9EF15AF277E0045320F /* UACellBackgroundView.m in Sources */ = {isa = PBXBuildFile; fileRef = D3F9A9ED15AF277D0045320F /* UACellBackgroundView.m */; };
F04892FF180C3296002FED35 /* ImageOptim.sh in Resources */ = {isa = PBXBuildFile; fileRef = F04892FE180C3296002FED35 /* ImageOptim.sh */; };
F0489300180C3296002FED35 /* ImageOptim.sh in Resources */ = {isa = PBXBuildFile; fileRef = F04892FE180C3296002FED35 /* ImageOptim.sh */; };
F04F1E9D1806A41800D080F2 /* libpolarssl.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 57B0E35F173C010400A476B8 /* libpolarssl.a */; };
F066515517F9A02E0064280C /* UITransparentTVCell.m in Sources */ = {isa = PBXBuildFile; fileRef = F066515417F9A02E0064280C /* UITransparentTVCell.m */; };
F066515617F9A02E0064280C /* UITransparentTVCell.m in Sources */ = {isa = PBXBuildFile; fileRef = F066515417F9A02E0064280C /* UITransparentTVCell.m */; };
@ -2491,6 +2493,7 @@
D3F9A9DA15AEEB940045320F /* history_notification.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = history_notification.png; path = Resources/history_notification.png; sourceTree = "<group>"; };
D3F9A9EC15AF277D0045320F /* UACellBackgroundView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = UACellBackgroundView.h; path = Utils/UACellBackgroundView/UACellBackgroundView.h; sourceTree = "<group>"; };
D3F9A9ED15AF277D0045320F /* UACellBackgroundView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = UACellBackgroundView.m; path = Utils/UACellBackgroundView/UACellBackgroundView.m; sourceTree = "<group>"; };
F04892FE180C3296002FED35 /* ImageOptim.sh */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.script.sh; path = ImageOptim.sh; sourceTree = "<group>"; };
F066515317F9A02E0064280C /* UITransparentTVCell.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = UITransparentTVCell.h; sourceTree = "<group>"; };
F066515417F9A02E0064280C /* UITransparentTVCell.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = UITransparentTVCell.m; sourceTree = "<group>"; };
F0818E7B17FC5160005A3330 /* linphone_icon_120.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = linphone_icon_120.png; path = Resources/linphone_icon_120.png; sourceTree = "<group>"; };
@ -3284,6 +3287,7 @@
29B97314FDCFA39411CA2CEA /* CustomTemplate */ = {
isa = PBXGroup;
children = (
F04892FE180C3296002FED35 /* ImageOptim.sh */,
154227D017BA81CE005E686A /* libzrtpcppcore.a */,
15017E6F1773578400784ACB /* libxml2.a */,
57B0E35F173C010400A476B8 /* libpolarssl.a */,
@ -4594,6 +4598,7 @@
2234C8E915EE2F7F00E18E83 /* chat_message_delivered.png in Resources */,
2234C8EB15EE2F7F00E18E83 /* chat_message_not_delivered.png in Resources */,
2234C8EE15EE744200E18E83 /* chat_message_inprogress.png in Resources */,
F04892FF180C3296002FED35 /* ImageOptim.sh in Resources */,
D37EE10D16035793003608A6 /* ImageViewController.xib in Resources */,
D381881115FE3F0B00C3EDCA /* UICallCell.xib in Resources */,
D381881915FE3FCA00C3EDCA /* InCallViewController.xib in Resources */,
@ -5132,6 +5137,7 @@
2234C8EA15EE2F7F00E18E83 /* chat_message_delivered.png in Resources */,
2234C8EC15EE2F7F00E18E83 /* chat_message_not_delivered.png in Resources */,
2234C8EF15EE744200E18E83 /* chat_message_inprogress.png in Resources */,
F0489300180C3296002FED35 /* ImageOptim.sh in Resources */,
D37EE10E16035793003608A6 /* ImageViewController.xib in Resources */,
D381881215FE3F0B00C3EDCA /* UICallCell.xib in Resources */,
D381881A15FE3FCA00C3EDCA /* InCallViewController.xib in Resources */,
@ -5250,7 +5256,7 @@
);
runOnlyForDeploymentPostprocessing = 0;
shellPath = /bin/sh;
shellScript = "if [ \"$CONFIGURATION\" == \"Debug\" ]; then\n exit 0\nfi\n\nCONVERT=/opt/local/bin/convert\nCONVERTFILTER=\"-sharpen 1x0.0 -filter Catrom\"\nOPTIPNG=/opt/local/bin/optipng\nCMDS=\"${CONVERT} ${OPTIPNG}\"\nfor i in $CMDS; do\ncommand -v $i > /dev/null && continue || { echo \"$i command not found\"; exit 1; }\ndone\n\nDIR=${CONFIGURATION_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}\nPNGS=$(find $DIR -type f -name *.png)\nfor PNG in $PNGS; do\n BASENAME=$(basename $PNG \".png\")\n PROCESS=true\n if [ -f $DIR/$BASENAME\"@2x.png\" ]; then\n echo \"Ignoring $BASENAME\";\n PROCESS=false\n fi\n case $BASENAME in *@2x)\n echo \"Ignoring $BASENAME\";\n continue\n esac\n\n if $PROCESS ; then\n echo \"Processing ${BASENAME} (${CONVERTFILTER})...\"\n mv $DIR/$BASENAME\".png\" $DIR/$BASENAME\"@2x.png\"\n $CONVERT $DIR/$BASENAME\"@2x.png\" $CONVERTFILTER -resize \"50%\" $DIR/$BASENAME\".png\" > /dev/null\n fi\n\n echo \"Optimizing ${BASENAME} and ${BASENAME}@2x ...\"\n $OPTIPNG -quiet $DIR/$BASENAME\"@2x.png\" > /dev/null\n $OPTIPNG -quiet $DIR/$BASENAME\".png\" > /dev/null\n\ndone";
shellScript = $SRCROOT/ImageOptim.sh;
};
D33CF35115D3AC9800CD4B85 /* ShellScript */ = {
isa = PBXShellScriptBuildPhase;
@ -5263,7 +5269,7 @@
);
runOnlyForDeploymentPostprocessing = 0;
shellPath = /bin/sh;
shellScript = "if [ \"$CONFIGURATION\" == \"Debug\" ]; then\n exit 0\nfi\n\nCONVERT=/opt/local/bin/convert\nCONVERTFILTER=\"-sharpen 1x0.0 -filter Catrom\"\nOPTIPNG=/opt/local/bin/optipng\nCMDS=\"${CONVERT} ${OPTIPNG}\"\nfor i in $CMDS; do\n command -v $i > /dev/null && continue || { echo \"$i command not found\"; exit 1; }\ndone\n\nDIR=${CONFIGURATION_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}\nPNGS=$(find $DIR -type f -name *.png)\nfor PNG in $PNGS; do\n BASENAME=$(basename $PNG \".png\")\n PROCESS=true\n if [ -f $DIR/$BASENAME\"@2x.png\" ]; then\n echo \"Ignoring $BASENAME\";\n PROCESS=false\n fi\n case $BASENAME in *@2x)\n echo \"Ignoring $BASENAME\";\n continue\n esac\n\n if $PROCESS ; then\n echo \"Processing ${BASENAME} (${CONVERTFILTER})...\"\n mv $DIR/$BASENAME\".png\" $DIR/$BASENAME\"@2x.png\"\n $CONVERT $DIR/$BASENAME\"@2x.png\" $CONVERTFILTER -resize \"50%\" $DIR/$BASENAME\".png\" > /dev/null\n fi\n\n echo \"Optimizing ${BASENAME} and ${BASENAME}@2x ...\"\n $OPTIPNG -quiet $DIR/$BASENAME\"@2x.png\" > /dev/null\n $OPTIPNG -quiet $DIR/$BASENAME\".png\" > /dev/null\n\ndone";
shellScript = $SRCROOT/ImageOptim.sh;
};
/* End PBXShellScriptBuildPhase section */

View file

@ -92,18 +92,11 @@ SWITCHES := $(addprefix $(LINPHONE_BUILD_DIR)/,$(SWITCHES))
mode_switch_check: $(SWITCHES)
$(LINPHONE_BUILD_DIR)/disable_%:
$(LINPHONE_BUILD_DIR)/enable_% $(LINPHONE_BUILD_DIR)/disable_%:
mkdir -p $(LINPHONE_BUILD_DIR)
touch $(LINPHONE_BUILD_DIR)/disable_$*
rm -f $(LINPHONE_BUILD_DIR)/enable_$*
cd $(LINPHONE_BUILD_DIR) && rm -f Makefile && rm -f oRTP/Makefile && rm -f mediastreamer2/Makefile
$(LINPHONE_BUILD_DIR)/enable_%:
mkdir -p $(LINPHONE_BUILD_DIR)
touch $(LINPHONE_BUILD_DIR)/enable_$*
rm -f $(LINPHONE_BUILD_DIR)/disable_$*
cd $(LINPHONE_BUILD_DIR) && rm -f Makefile && rm -f oRTP/Makefile && rm -f mediastreamer2/Makefile
cd $(LINPHONE_BUILD_DIR) && rm -f *able_$*
touch $@
cd $(LINPHONE_BUILD_DIR) && rm -f Makefile && rm -f oRTP/Makefile && rm -f mediastreamer2/Makefile
# end of switches parsing