mirror of
https://gitlab.linphone.org/BC/public/linphone-iphone.git
synced 2026-01-25 23:28:09 +00:00
Fix links to ABI>=5 in video code preventing use with old telephones.
Disable video when ABI<5 or ILBC not found. Automatically open preference activity on linphone first launch.
This commit is contained in:
parent
bf7f4a0286
commit
fb6a4a0bb5
4 changed files with 89 additions and 22 deletions
|
|
@ -19,6 +19,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
|||
package org.linphone.core;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
||||
import android.hardware.Camera;
|
||||
|
|
@ -39,7 +40,7 @@ public abstract class AndroidCameraRecord {
|
|||
private PreviewCallback storedPreviewCallback;
|
||||
private boolean previewStarted;
|
||||
protected int orientationCode;
|
||||
private static final String tag="Linphone";
|
||||
protected static final String tag="Linphone";
|
||||
private List <Size> supportedVideoSizes;
|
||||
|
||||
public AndroidCameraRecord(RecorderParams parameters) {
|
||||
|
|
@ -47,7 +48,9 @@ public abstract class AndroidCameraRecord {
|
|||
setRotation(parameters.rotation);
|
||||
}
|
||||
|
||||
|
||||
protected List<Size> getSupportedPreviewSizes(Camera.Parameters parameters) {
|
||||
return Collections.emptyList();
|
||||
}
|
||||
|
||||
public void startPreview() { // FIXME throws exception?
|
||||
if (previewStarted) {
|
||||
|
|
@ -73,7 +76,7 @@ public abstract class AndroidCameraRecord {
|
|||
|
||||
Camera.Parameters parameters=camera.getParameters();
|
||||
if (supportedVideoSizes == null) {
|
||||
supportedVideoSizes = camera.getParameters().getSupportedPreviewSizes();
|
||||
supportedVideoSizes = getSupportedPreviewSizes(camera.getParameters());
|
||||
}
|
||||
|
||||
parameters.set("camera-id", params.cameraId);
|
||||
|
|
@ -83,18 +86,7 @@ public abstract class AndroidCameraRecord {
|
|||
parameters.setPreviewSize(params.height, params.width);
|
||||
}
|
||||
parameters.setPreviewFrameRate(Math.round(params.fps));
|
||||
if (parameters.getSupportedFocusModes().contains(Camera.Parameters.FOCUS_MODE_AUTO)) {
|
||||
Log.w(tag, "Auto Focus supported by camera device");
|
||||
parameters.setFocusMode(Camera.Parameters.FOCUS_MODE_AUTO);
|
||||
} else {
|
||||
Log.w(tag, "Auto Focus not supported by camera device");
|
||||
if (parameters.getSupportedFocusModes().contains(Camera.Parameters.FOCUS_MODE_INFINITY)) {
|
||||
Log.w(tag, "Infinity Focus supported by camera device");
|
||||
parameters.setFocusMode(Camera.Parameters.FOCUS_MODE_INFINITY);
|
||||
} else {
|
||||
Log.w(tag, "Infinity Focus not supported by camera device");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
onSettingCameraParameters(parameters);
|
||||
camera.setParameters(parameters);
|
||||
|
|
|
|||
|
|
@ -30,7 +30,7 @@ import android.util.Log;
|
|||
* @author Guillaume Beraudo
|
||||
*
|
||||
*/
|
||||
public class AndroidCameraRecordBufferedImpl extends AndroidCameraRecordImpl {
|
||||
public class AndroidCameraRecordBufferedImpl extends AndroidCameraRecordImplAPI5 {
|
||||
|
||||
|
||||
public AndroidCameraRecordBufferedImpl(RecorderParams parameters) {
|
||||
|
|
|
|||
64
AndroidCameraRecordImplAPI5.java
Normal file
64
AndroidCameraRecordImplAPI5.java
Normal file
|
|
@ -0,0 +1,64 @@
|
|||
/*
|
||||
AndroidCameraRecordImplAPI5.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;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import android.hardware.Camera;
|
||||
import android.hardware.Camera.Parameters;
|
||||
import android.hardware.Camera.Size;
|
||||
import android.util.Log;
|
||||
|
||||
|
||||
public class AndroidCameraRecordImplAPI5 extends AndroidCameraRecordImpl {
|
||||
|
||||
public AndroidCameraRecordImplAPI5(RecorderParams parameters) {
|
||||
super(parameters);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onSettingCameraParameters(Parameters parameters) {
|
||||
super.onSettingCameraParameters(parameters);
|
||||
|
||||
if (parameters.getSupportedFocusModes().contains(Camera.Parameters.FOCUS_MODE_AUTO)) {
|
||||
Log.w(tag, "Auto Focus supported by camera device");
|
||||
parameters.setFocusMode(Camera.Parameters.FOCUS_MODE_AUTO);
|
||||
} else {
|
||||
Log.w(tag, "Auto Focus not supported by camera device");
|
||||
if (parameters.getSupportedFocusModes().contains(Camera.Parameters.FOCUS_MODE_INFINITY)) {
|
||||
Log.w(tag, "Infinity Focus supported by camera device");
|
||||
parameters.setFocusMode(Camera.Parameters.FOCUS_MODE_INFINITY);
|
||||
} else {
|
||||
Log.w(tag, "Infinity Focus not supported by camera device");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static List<Size> oneShotSupportedVideoSizes() {
|
||||
Camera camera = Camera.open();
|
||||
List<Size> supportedVideoSizes =camera.getParameters().getSupportedPreviewSizes();
|
||||
camera.release();
|
||||
return supportedVideoSizes;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected List<Size> getSupportedPreviewSizes(Parameters parameters) {
|
||||
return parameters.getSupportedPreviewSizes();
|
||||
}
|
||||
}
|
||||
|
|
@ -24,7 +24,6 @@ import java.util.Map;
|
|||
|
||||
import org.linphone.core.AndroidCameraRecord.RecorderParams;
|
||||
|
||||
import android.hardware.Camera;
|
||||
import android.hardware.Camera.Size;
|
||||
import android.os.Build;
|
||||
import android.util.Log;
|
||||
|
|
@ -41,7 +40,6 @@ import android.view.SurfaceHolder.Callback;
|
|||
*
|
||||
*/
|
||||
public class AndroidCameraRecordManager {
|
||||
public static final int CAMERA_ID_FIXME_USE_PREFERENCE = 0;
|
||||
private static final int version = Integer.parseInt(Build.VERSION.SDK);
|
||||
private static Map<Integer, AndroidCameraRecordManager> instances = new HashMap<Integer, AndroidCameraRecordManager>();
|
||||
|
||||
|
|
@ -52,7 +50,8 @@ public class AndroidCameraRecordManager {
|
|||
}
|
||||
|
||||
/**
|
||||
* @param cameraId : see max_camera_id
|
||||
* Instance for a given camera
|
||||
* @param cameraId : starting from 0
|
||||
* @return
|
||||
*/
|
||||
public static final synchronized AndroidCameraRecordManager getInstance(int cameraId) {
|
||||
|
|
@ -69,6 +68,9 @@ public class AndroidCameraRecordManager {
|
|||
return m;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return instance for the default camera
|
||||
*/
|
||||
public static final synchronized AndroidCameraRecordManager getInstance() {
|
||||
return getInstance(0);
|
||||
}
|
||||
|
|
@ -148,6 +150,8 @@ public class AndroidCameraRecordManager {
|
|||
parameters.surfaceView = surfaceView;
|
||||
if (version >= 8) {
|
||||
recorder = new AndroidCameraRecordBufferedImpl(parameters);
|
||||
} else if (version >= 5) {
|
||||
recorder = new AndroidCameraRecordImplAPI5(parameters);
|
||||
} else {
|
||||
recorder = new AndroidCameraRecordImpl(parameters);
|
||||
}
|
||||
|
|
@ -164,6 +168,10 @@ public class AndroidCameraRecordManager {
|
|||
|
||||
|
||||
// FIXME select right camera
|
||||
/**
|
||||
* Eventually null if API < 5.
|
||||
*
|
||||
*/
|
||||
public List<Size> supportedVideoSizes() {
|
||||
if (supportedVideoSizes != null) {
|
||||
return supportedVideoSizes;
|
||||
|
|
@ -174,9 +182,12 @@ public class AndroidCameraRecordManager {
|
|||
if (supportedVideoSizes != null) return supportedVideoSizes;
|
||||
}
|
||||
|
||||
Camera camera = Camera.open();
|
||||
supportedVideoSizes = camera.getParameters().getSupportedPreviewSizes();
|
||||
camera.release();
|
||||
if (version >= 5) {
|
||||
supportedVideoSizes = AndroidCameraRecordImplAPI5.oneShotSupportedVideoSizes();
|
||||
}
|
||||
|
||||
// eventually null
|
||||
|
||||
return supportedVideoSizes;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue