mirror of
https://gitlab.linphone.org/BC/public/linphone-iphone.git
synced 2026-02-02 11:19:30 +00:00
Enhancements:
- Numpad component factorizing setAddressWidget - Digit uses style - No more NewOutgoingCallReceiver and the associated magic Now uses CALL_PRIVILEDGED - Move Video classes to core.video package and lower visibility - Merged AndroidCameraRecord5Impl and AndroidCameraRecordImpl
This commit is contained in:
parent
099907b8ee
commit
5ffaf9c434
12 changed files with 71 additions and 89 deletions
|
|
@ -1,64 +0,0 @@
|
|||
/*
|
||||
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 AndroidCameraRecord5Impl extends AndroidCameraRecordImpl {
|
||||
|
||||
public AndroidCameraRecord5Impl(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();
|
||||
}
|
||||
}
|
||||
|
|
@ -38,4 +38,8 @@ public class Version {
|
|||
return buildVersion < value;
|
||||
}
|
||||
|
||||
public static int sdk() {
|
||||
return buildVersion;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -23,11 +23,12 @@ import android.widget.TextView;
|
|||
|
||||
/**
|
||||
* Write notifications to a TextView widget.
|
||||
* This is an helper class, not a test activity.
|
||||
*
|
||||
* @author Guillaume Beraudo
|
||||
*
|
||||
*/
|
||||
public class AndroidTutorialNotifier extends TutorialNotifier {
|
||||
class AndroidTutorialNotifier extends TutorialNotifier {
|
||||
|
||||
private Handler mHandler;
|
||||
private TextView outputTextView;
|
||||
|
|
|
|||
|
|
@ -18,7 +18,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
|||
*/
|
||||
package org.linphone.core.tutorials;
|
||||
|
||||
import org.linphone.core.AndroidCameraRecord;
|
||||
import org.linphone.core.video.AndroidCameraRecord;
|
||||
|
||||
import android.hardware.Camera;
|
||||
import android.hardware.Camera.PreviewCallback;
|
||||
|
|
@ -26,7 +26,13 @@ import android.hardware.Camera.Size;
|
|||
import android.util.Log;
|
||||
import android.widget.TextView;
|
||||
|
||||
public class JavaCameraRecordImpl extends AndroidCameraRecord implements PreviewCallback {
|
||||
/**
|
||||
* This is an helper class, not a test activity.
|
||||
*
|
||||
* @author Guillaume Beraudo
|
||||
*
|
||||
*/
|
||||
class JavaCameraRecordImpl extends AndroidCameraRecord implements PreviewCallback {
|
||||
|
||||
private TextView debug;
|
||||
private long count = 0;
|
||||
|
|
|
|||
|
|
@ -21,8 +21,8 @@ package org.linphone.core.tutorials;
|
|||
import java.util.Stack;
|
||||
|
||||
import org.linphone.R;
|
||||
import org.linphone.core.AndroidCameraRecord;
|
||||
import org.linphone.core.VideoSize;
|
||||
import org.linphone.core.video.AndroidCameraRecord;
|
||||
|
||||
import android.app.Activity;
|
||||
import android.os.Bundle;
|
||||
|
|
|
|||
|
|
@ -16,13 +16,13 @@ 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;
|
||||
package org.linphone.core.video;
|
||||
|
||||
import org.linphone.Hacks;
|
||||
|
||||
import android.util.Log;
|
||||
|
||||
public class AndroidCameraConf {
|
||||
class AndroidCameraConf {
|
||||
private static final String tag = "Linphone";
|
||||
|
||||
public void findFrontAndRearCameraIds(int[] frontCameraId, int[] rearCameraId, int[] cameraId) {
|
||||
|
|
@ -39,6 +39,7 @@ public class AndroidCameraConf {
|
|||
}
|
||||
|
||||
public int getNumberOfCameras() {
|
||||
Log.i(tag, "Detecting the number of cameras");
|
||||
// Use hacks to guess the number of cameras
|
||||
if (Hacks.isGalaxyS()) {
|
||||
Log.d(tag, "Hack Galaxy S : has 2 cameras");
|
||||
|
|
@ -46,7 +47,7 @@ public class AndroidCameraConf {
|
|||
} else
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
public int getCameraOrientation(int cameraId) {
|
||||
|
|
@ -16,11 +16,11 @@ 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;
|
||||
package org.linphone.core.video;
|
||||
|
||||
import android.hardware.Camera;
|
||||
|
||||
public class AndroidCameraConf9 extends AndroidCameraConf {
|
||||
class AndroidCameraConf9 extends AndroidCameraConf {
|
||||
|
||||
public void findFrontAndRearCameraIds9(Integer frontCameraId, Integer rearCameraId, Integer cameraId) {
|
||||
for (int id=0; id < getNumberOfCameras(); id++) {
|
||||
|
|
@ -16,7 +16,7 @@ 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;
|
||||
package org.linphone.core.video;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
|
|
@ -16,7 +16,7 @@ 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;
|
||||
package org.linphone.core.video;
|
||||
|
||||
import android.hardware.Camera;
|
||||
import android.hardware.Camera.Parameters;
|
||||
|
|
@ -30,10 +30,10 @@ import android.util.Log;
|
|||
* @author Guillaume Beraudo
|
||||
*
|
||||
*/
|
||||
public class AndroidCameraRecord8Impl extends AndroidCameraRecord5Impl {
|
||||
class AndroidCameraRecord8 extends AndroidCameraRecordImpl {
|
||||
|
||||
|
||||
public AndroidCameraRecord8Impl(RecorderParams parameters) {
|
||||
public AndroidCameraRecord8(RecorderParams parameters) {
|
||||
super(parameters);
|
||||
}
|
||||
|
||||
|
|
@ -16,7 +16,7 @@ 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;
|
||||
package org.linphone.core.video;
|
||||
|
||||
import android.hardware.Camera;
|
||||
|
||||
|
|
@ -26,10 +26,10 @@ import android.hardware.Camera;
|
|||
* @author Guillaume Beraudo
|
||||
*
|
||||
*/
|
||||
public class AndroidCameraRecord9Impl extends AndroidCameraRecord8Impl {
|
||||
class AndroidCameraRecord9 extends AndroidCameraRecord8 {
|
||||
|
||||
|
||||
public AndroidCameraRecord9Impl(RecorderParams parameters) {
|
||||
public AndroidCameraRecord9(RecorderParams parameters) {
|
||||
super(parameters);
|
||||
}
|
||||
|
||||
|
|
@ -16,19 +16,24 @@ 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;
|
||||
package org.linphone.core.video;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import android.hardware.Camera;
|
||||
import android.hardware.Camera.Parameters;
|
||||
import android.hardware.Camera.PreviewCallback;
|
||||
import android.hardware.Camera.Size;
|
||||
import android.util.Log;
|
||||
|
||||
/**
|
||||
* Record from Android camera.
|
||||
* Android >= 5 (2.0) version.
|
||||
*
|
||||
* @author Guillaume Beraudo
|
||||
*
|
||||
*/
|
||||
public class AndroidCameraRecordImpl extends AndroidCameraRecord implements PreviewCallback {
|
||||
class AndroidCameraRecordImpl extends AndroidCameraRecord implements PreviewCallback {
|
||||
|
||||
private long filterCtxPtr;
|
||||
private double timeElapsedBetweenFrames = 0;
|
||||
|
|
@ -85,7 +90,35 @@ public class AndroidCameraRecordImpl extends AndroidCameraRecord implements Prev
|
|||
putImage(filterCtxPtr, data, rotation);
|
||||
}
|
||||
|
||||
@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();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void lowLevelSetPreviewCallback(Camera camera, PreviewCallback cb) {
|
||||
|
|
@ -16,11 +16,12 @@ 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;
|
||||
package org.linphone.core.video;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import org.linphone.core.AndroidCameraRecord.RecorderParams;
|
||||
import org.linphone.core.Version;
|
||||
import org.linphone.core.video.AndroidCameraRecord.RecorderParams;
|
||||
|
||||
import android.hardware.Camera.Size;
|
||||
import android.util.Log;
|
||||
|
|
@ -173,13 +174,13 @@ public class AndroidCameraRecordManager {
|
|||
|
||||
parameters.surfaceView = surfaceView;
|
||||
if (Version.sdkAboveOrEqual(9)) {
|
||||
recorder = new AndroidCameraRecord9Impl(parameters);
|
||||
recorder = new AndroidCameraRecord9(parameters);
|
||||
} else if (Version.sdkAboveOrEqual(8)) {
|
||||
recorder = new AndroidCameraRecord8Impl(parameters);
|
||||
recorder = new AndroidCameraRecord8(parameters);
|
||||
} else if (Version.sdkAboveOrEqual(5)) {
|
||||
recorder = new AndroidCameraRecord5Impl(parameters);
|
||||
} else {
|
||||
recorder = new AndroidCameraRecordImpl(parameters);
|
||||
} else {
|
||||
throw new RuntimeException("SDK version unsupported " + Version.sdk());
|
||||
}
|
||||
|
||||
recorder.startPreview();
|
||||
|
|
@ -209,7 +210,7 @@ public class AndroidCameraRecordManager {
|
|||
}
|
||||
|
||||
if (Version.sdkAboveOrEqual(5)) {
|
||||
supportedVideoSizes = AndroidCameraRecord5Impl.oneShotSupportedVideoSizes();
|
||||
supportedVideoSizes = AndroidCameraRecordImpl.oneShotSupportedVideoSizes();
|
||||
}
|
||||
|
||||
// eventually null
|
||||
Loading…
Add table
Reference in a new issue