Merge ms2. Fix i18n in ms2. Activate 2.3 in Version.
This commit is contained in:
parent
4dc43b827d
commit
f9a1266bac
8 changed files with 132 additions and 74 deletions
|
@ -17,6 +17,7 @@ APP_MODULES +=libmsilbc libavutil libavcore libavcodec libswscale libx264 l
|
||||||
endif
|
endif
|
||||||
APP_BUILD_SCRIPT:=$(call my-dir)/Android.mk
|
APP_BUILD_SCRIPT:=$(call my-dir)/Android.mk
|
||||||
APP_PLATFORM := android-8
|
APP_PLATFORM := android-8
|
||||||
APP_ABI := armeabi armeabi-v7a
|
APP_ABI := armeabi-v7a
|
||||||
|
#APP_ABI := armeabi armeabi-v7a
|
||||||
#APP_OPTIM := debug
|
#APP_OPTIM := debug
|
||||||
|
|
||||||
|
|
|
@ -26,8 +26,7 @@ import android.os.Build;
|
||||||
*/
|
*/
|
||||||
public class Version {
|
public class Version {
|
||||||
|
|
||||||
private static final int buildVersion = Integer.parseInt(Build.VERSION.SDK) >= 9?
|
private static final int buildVersion = Integer.parseInt(Build.VERSION.SDK);
|
||||||
8 : Integer.parseInt(Build.VERSION.SDK); // Force versions above 9 to 8
|
|
||||||
// 7; // 2.1
|
// 7; // 2.1
|
||||||
|
|
||||||
public static final boolean sdkAboveOrEqual(int value) {
|
public static final boolean sdkAboveOrEqual(int value) {
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
/*
|
/*
|
||||||
AndroidCameraConf.java
|
AndroidCameraConf.java
|
||||||
Copyright (C) 2010 Belledonne Communications, Grenoble, France
|
Copyright (C) 2011 Belledonne Communications, Grenoble, France
|
||||||
|
|
||||||
This program is free software; you can redistribute it and/or
|
This program is free software; you can redistribute it and/or
|
||||||
modify it under the terms of the GNU General Public License
|
modify it under the terms of the GNU General Public License
|
||||||
|
@ -15,64 +15,31 @@ GNU General Public License for more details.
|
||||||
You should have received a copy of the GNU General Public License
|
You should have received a copy of the GNU General Public License
|
||||||
along with this program; if not, write to the Free Software
|
along with this program; if not, write to the Free Software
|
||||||
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||||
*/
|
*/
|
||||||
package org.linphone.core.video;
|
package org.linphone.core.video;
|
||||||
|
|
||||||
import org.linphone.core.Hacks;
|
|
||||||
|
|
||||||
import android.util.Log;
|
/**
|
||||||
|
* @author Guillaume Beraudo
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
interface AndroidCameraConf {
|
||||||
|
|
||||||
class AndroidCameraConf {
|
AndroidCameras getFoundCameras();
|
||||||
private static final String tag = "Linphone";
|
|
||||||
|
|
||||||
public void findFrontAndRearCameraIds(int[] frontCameraId, int[] rearCameraId, int[] cameraId) {
|
int getNumberOfCameras();
|
||||||
Log.i(tag, "Detecting cameras");
|
|
||||||
if (Hacks.isGalaxySOrTab()) {
|
int getCameraOrientation(int cameraId);
|
||||||
Log.d(tag, "Hack Galaxy S : has 2 cameras front=2; rear=1");
|
|
||||||
frontCameraId[0] = 2;
|
boolean isFrontCamera(int cameraId);
|
||||||
rearCameraId[0] = 1;
|
|
||||||
cameraId[0] = rearCameraId[0];
|
class AndroidCameras {
|
||||||
return;
|
Integer front;
|
||||||
|
Integer rear;
|
||||||
|
Integer defaultC;
|
||||||
|
|
||||||
|
boolean hasFrontCamera() { return front != null; }
|
||||||
|
boolean hasRearCamera() { return rear != null; }
|
||||||
|
boolean hasSeveralCameras() { return front != rear && front != null; }
|
||||||
}
|
}
|
||||||
|
|
||||||
// default to 0/0
|
|
||||||
}
|
|
||||||
|
|
||||||
public int getNumberOfCameras() {
|
|
||||||
Log.i(tag, "Detecting the number of cameras");
|
|
||||||
// Use hacks to guess the number of cameras
|
|
||||||
if (Hacks.isGalaxySOrTab()) {
|
|
||||||
Log.d(tag, "Hack Galaxy S : has 2 cameras");
|
|
||||||
return 2;
|
|
||||||
} else
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
public int getCameraOrientation(int cameraId) {
|
|
||||||
// Use hacks to guess orientation of the camera
|
|
||||||
if (cameraId == 2 && Hacks.isGalaxySOrTab()) {
|
|
||||||
Log.d(tag, "Hack Galaxy S : rear camera id=2 ; mounted landscape");
|
|
||||||
// mounted in landscape for a portrait phone orientation
|
|
||||||
return 90;
|
|
||||||
}
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
public boolean isFrontCamera(int cameraId) {
|
|
||||||
// Use hacks to guess facing of the camera
|
|
||||||
if (cameraId == 2 && Hacks.isGalaxySOrTab()) {
|
|
||||||
Log.d(tag, "Hack Galaxy S : front camera has id=2");
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
88
src/org/linphone/core/video/AndroidCameraConf5.java
Normal file
88
src/org/linphone/core/video/AndroidCameraConf5.java
Normal file
|
@ -0,0 +1,88 @@
|
||||||
|
/*
|
||||||
|
AndroidCameraConf.java
|
||||||
|
Copyright (C) 2010 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.
|
||||||
|
*/
|
||||||
|
package org.linphone.core.video;
|
||||||
|
|
||||||
|
import org.linphone.core.Hacks;
|
||||||
|
|
||||||
|
import android.util.Log;
|
||||||
|
|
||||||
|
class AndroidCameraConf5 implements AndroidCameraConf {
|
||||||
|
private static final String tag = "Linphone";
|
||||||
|
private AndroidCameras foundCameras;
|
||||||
|
public AndroidCameras getFoundCameras() {return foundCameras;}
|
||||||
|
|
||||||
|
public AndroidCameraConf5() {
|
||||||
|
Log.i(tag, "Detecting cameras");
|
||||||
|
|
||||||
|
// Defaults 0/0/0
|
||||||
|
foundCameras = new AndroidCameras();
|
||||||
|
|
||||||
|
if (Hacks.isGalaxySOrTab()) {
|
||||||
|
Log.d(tag, "Hack Galaxy S : has 2 cameras front=2; rear=1");
|
||||||
|
foundCameras.front = 2;
|
||||||
|
foundCameras.rear = 1;
|
||||||
|
foundCameras.defaultC = foundCameras.rear;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getNumberOfCameras() {
|
||||||
|
Log.i(tag, "Detecting the number of cameras");
|
||||||
|
if (Hacks.isGalaxySOrTab()) {
|
||||||
|
Log.d(tag, "Hack Galaxy S : has 2 cameras");
|
||||||
|
return 2;
|
||||||
|
} else
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
public int getCameraOrientation(int cameraId) {
|
||||||
|
// Use hacks to guess orientation of the camera
|
||||||
|
if (Hacks.isGalaxySOrTab() && !isFrontCamera(cameraId)) {
|
||||||
|
Log.d(tag, "Hack Galaxy S : rear camera mounted landscape");
|
||||||
|
// mounted in landscape for a portrait phone orientation
|
||||||
|
// |^^^^^^^^|
|
||||||
|
// | ____ |
|
||||||
|
// | |____| |
|
||||||
|
// | |
|
||||||
|
// | |
|
||||||
|
// | Phone |
|
||||||
|
// |________|
|
||||||
|
return 90;
|
||||||
|
}
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
public boolean isFrontCamera(int cameraId) {
|
||||||
|
// Use hacks to guess facing of the camera
|
||||||
|
if (cameraId == 2 && Hacks.isGalaxySOrTab()) {
|
||||||
|
Log.d(tag, "Hack Galaxy S : front camera has id=2");
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
|
@ -20,14 +20,21 @@ package org.linphone.core.video;
|
||||||
|
|
||||||
import android.hardware.Camera;
|
import android.hardware.Camera;
|
||||||
|
|
||||||
class AndroidCameraConf9 extends AndroidCameraConf {
|
class AndroidCameraConf9 implements AndroidCameraConf {
|
||||||
|
private AndroidCameras foundCameras;
|
||||||
|
public AndroidCameras getFoundCameras() {return foundCameras;}
|
||||||
|
|
||||||
|
public AndroidCameraConf9() {
|
||||||
|
foundCameras = new AndroidCameras();
|
||||||
|
|
||||||
public void findFrontAndRearCameraIds9(Integer frontCameraId, Integer rearCameraId, Integer cameraId) {
|
|
||||||
for (int id=0; id < getNumberOfCameras(); id++) {
|
for (int id=0; id < getNumberOfCameras(); id++) {
|
||||||
|
if (foundCameras.defaultC == null)
|
||||||
|
foundCameras.defaultC = id;
|
||||||
|
|
||||||
if (isFrontCamera(id)) {
|
if (isFrontCamera(id)) {
|
||||||
frontCameraId = id;
|
foundCameras.front = id;
|
||||||
} else {
|
} else {
|
||||||
rearCameraId = id;
|
foundCameras.rear = id;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -39,7 +46,7 @@ class AndroidCameraConf9 extends AndroidCameraConf {
|
||||||
public int getCameraOrientation(int cameraId) {
|
public int getCameraOrientation(int cameraId) {
|
||||||
android.hardware.Camera.CameraInfo info = new android.hardware.Camera.CameraInfo();
|
android.hardware.Camera.CameraInfo info = new android.hardware.Camera.CameraInfo();
|
||||||
Camera.getCameraInfo(cameraId, info);
|
Camera.getCameraInfo(cameraId, info);
|
||||||
return info.orientation;
|
return (info.orientation - 90) %360;
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isFrontCamera(int cameraId) {
|
public boolean isFrontCamera(int cameraId) {
|
||||||
|
@ -47,4 +54,5 @@ class AndroidCameraConf9 extends AndroidCameraConf {
|
||||||
Camera.getCameraInfo(cameraId, info);
|
Camera.getCameraInfo(cameraId, info);
|
||||||
return info.facing == android.hardware.Camera.CameraInfo.CAMERA_FACING_FRONT ? true : false;
|
return info.facing == android.hardware.Camera.CameraInfo.CAMERA_FACING_FRONT ? true : false;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -63,23 +63,18 @@ public class AndroidCameraRecordManager {
|
||||||
public int getPhoneOrientation() {return phoneOrientation;}
|
public int getPhoneOrientation() {return phoneOrientation;}
|
||||||
public void setPhoneOrientation(int degrees) {this.phoneOrientation = degrees;}
|
public void setPhoneOrientation(int degrees) {this.phoneOrientation = degrees;}
|
||||||
|
|
||||||
private int frontCameraId;
|
|
||||||
private int rearCameraId;
|
|
||||||
|
|
||||||
// singleton
|
// singleton
|
||||||
private AndroidCameraRecordManager() {
|
private AndroidCameraRecordManager() {
|
||||||
cc = Version.sdkAboveOrEqual(9) ? new AndroidCameraConf9() : new AndroidCameraConf();
|
cc = Version.sdkAboveOrEqual(9) ? new AndroidCameraConf9() : new AndroidCameraConf5();
|
||||||
|
cameraId = cc.getFoundCameras().defaultC;
|
||||||
int[] fId = {-1};int[] rId = {-1};int[] cId = {-1};
|
|
||||||
cc.findFrontAndRearCameraIds(fId, rId, cId);
|
|
||||||
frontCameraId=fId[0];rearCameraId=rId[0];cameraId=cId[0];
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
public boolean hasSeveralCameras() {
|
public boolean hasSeveralCameras() {
|
||||||
return frontCameraId != rearCameraId;
|
return cc.getFoundCameras().hasSeveralCameras();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -93,7 +88,7 @@ public class AndroidCameraRecordManager {
|
||||||
public boolean toggleUseFrontCamera() {
|
public boolean toggleUseFrontCamera() {
|
||||||
boolean previousUseFront = cc.isFrontCamera(cameraId);
|
boolean previousUseFront = cc.isFrontCamera(cameraId);
|
||||||
|
|
||||||
cameraId = previousUseFront ? rearCameraId : frontCameraId;
|
cameraId = previousUseFront ? cc.getFoundCameras().rear : cc.getFoundCameras().front;
|
||||||
|
|
||||||
if (parameters != null) {
|
if (parameters != null) {
|
||||||
parameters.cameraId = cameraId;
|
parameters.cameraId = cameraId;
|
||||||
|
|
|
@ -1 +1 @@
|
||||||
Subproject commit 1b5b4827539f56c24b250ebca744ffb886390c3d
|
Subproject commit ceb6cd501759164d34c56d142c38dfbefdc7ad73
|
|
@ -1 +1 @@
|
||||||
Subproject commit 52e11ce3436eab7a8a344d34bef564ff2a9d0a6e
|
Subproject commit 2e10820e9c32fe75f049308d69e4164b46bc0d1a
|
Loading…
Reference in a new issue