Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(137)

Unified Diff: webrtc/api/java/android/org/webrtc/CameraEnumerationAndroid.java

Issue 2071803002: Move Camera1 specific methods to Camera1Enumerator and create CameraEnumerator interface. (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@size_master
Patch Set: Rebase. Created 4 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: webrtc/api/java/android/org/webrtc/CameraEnumerationAndroid.java
diff --git a/webrtc/api/java/android/org/webrtc/CameraEnumerationAndroid.java b/webrtc/api/java/android/org/webrtc/CameraEnumerationAndroid.java
index f3e08f6f33bb449485db79e490b07856f0831cbd..b3c5062a760bbbdfe0fdcbb8fe5d9aece2c1857e 100644
--- a/webrtc/api/java/android/org/webrtc/CameraEnumerationAndroid.java
+++ b/webrtc/api/java/android/org/webrtc/CameraEnumerationAndroid.java
@@ -114,57 +114,48 @@ public class CameraEnumerationAndroid {
}
}
- // Returns device names that can be used to create a new VideoCapturerAndroid.
+ /**
+ * @deprecated
+ * Please use Camera1Enumerator.getDeviceNames() instead.
+ */
+ @Deprecated
public static String[] getDeviceNames() {
- String[] names = new String[android.hardware.Camera.getNumberOfCameras()];
- for (int i = 0; i < android.hardware.Camera.getNumberOfCameras(); ++i) {
- names[i] = getDeviceName(i);
- }
- return names;
+ return new Camera1Enumerator().getDeviceNames();
}
- // Returns number of cameras on device.
+
+ /**
+ * @deprecated
+ * Please use Camera1Enumerator.getDeviceNames().length instead.
+ */
+ @Deprecated
public static int getDeviceCount() {
- return android.hardware.Camera.getNumberOfCameras();
+ return new Camera1Enumerator().getDeviceNames().length;
}
- // Returns the name of the camera with camera index. Returns null if the
- // camera can not be used.
+ /**
+ * @deprecated
+ * Please use Camera1Enumerator.getDeviceNames().get(index) instead.
+ */
+ @Deprecated
public static String getDeviceName(int index) {
- android.hardware.Camera.CameraInfo info = new android.hardware.Camera.CameraInfo();
- try {
- android.hardware.Camera.getCameraInfo(index, info);
- } catch (Exception e) {
- Logging.e(TAG, "getCameraInfo failed on index " + index,e);
- return null;
- }
-
- String facing =
- (info.facing == android.hardware.Camera.CameraInfo.CAMERA_FACING_FRONT) ? "front" : "back";
- return "Camera " + index + ", Facing " + facing
- + ", Orientation " + info.orientation;
- }
-
- // Returns the camera index for camera with name |deviceName|, or throws IllegalArgumentException
- // if no such camera can be found.
- public static int getCameraIndex(String deviceName) {
- Logging.d(TAG, "getCameraIndex: " + deviceName);
- for (int i = 0; i < android.hardware.Camera.getNumberOfCameras(); ++i) {
- if (deviceName.equals(CameraEnumerationAndroid.getDeviceName(i))) {
- return i;
- }
- }
- throw new IllegalArgumentException("No such camera: " + deviceName);
+ return new Camera1Enumerator().getDeviceName(index);
}
- // Returns the name of the front facing camera. Returns null if the
- // camera can not be used or does not exist.
+ /**
+ * @deprecated
+ * Please use Camera1Enumerator.isFrontFacing(String deviceName) instead.
+ */
+ @Deprecated
public static String getNameOfFrontFacingDevice() {
return getNameOfDevice(android.hardware.Camera.CameraInfo.CAMERA_FACING_FRONT);
}
- // Returns the name of the back facing camera. Returns null if the
- // camera can not be used or does not exist.
+ /**
+ * @deprecated
+ * Please use Camera1Enumerator.isBackFacing(String deviceName) instead.
+ */
+ @Deprecated
public static String getNameOfBackFacingDevice() {
return getNameOfDevice(android.hardware.Camera.CameraInfo.CAMERA_FACING_BACK);
}
« no previous file with comments | « webrtc/api/java/android/org/webrtc/Camera1Enumerator.java ('k') | webrtc/api/java/android/org/webrtc/CameraEnumerator.java » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698