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

Side by Side Diff: webrtc/api/android/java/src/org/webrtc/Camera1Enumerator.java

Issue 2377003002: Format all Java in WebRTC. (Closed)
Patch Set: Manual changes. Created 4 years, 2 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 unified diff | Download patch
OLDNEW
1 /* 1 /*
2 * Copyright 2015 The WebRTC project authors. All Rights Reserved. 2 * Copyright 2015 The WebRTC project authors. All Rights Reserved.
3 * 3 *
4 * Use of this source code is governed by a BSD-style license 4 * Use of this source code is governed by a BSD-style license
5 * that can be found in the LICENSE file in the root of the source 5 * that can be found in the LICENSE file in the root of the source
6 * tree. An additional intellectual property rights grant can be found 6 * tree. An additional intellectual property rights grant can be found
7 * in the file PATENTS. All contributing project authors may 7 * in the file PATENTS. All contributing project authors may
8 * be found in the AUTHORS file in the root of the source tree. 8 * be found in the AUTHORS file in the root of the source tree.
9 */ 9 */
10 10
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
63 android.hardware.Camera.CameraInfo info = getCameraInfo(getCameraIndex(devic eName)); 63 android.hardware.Camera.CameraInfo info = getCameraInfo(getCameraIndex(devic eName));
64 return info != null && info.facing == android.hardware.Camera.CameraInfo.CAM ERA_FACING_BACK; 64 return info != null && info.facing == android.hardware.Camera.CameraInfo.CAM ERA_FACING_BACK;
65 } 65 }
66 66
67 @Override 67 @Override
68 public List<CaptureFormat> getSupportedFormats(String deviceName) { 68 public List<CaptureFormat> getSupportedFormats(String deviceName) {
69 return getSupportedFormats(getCameraIndex(deviceName)); 69 return getSupportedFormats(getCameraIndex(deviceName));
70 } 70 }
71 71
72 @Override 72 @Override
73 public CameraVideoCapturer createCapturer(String deviceName, 73 public CameraVideoCapturer createCapturer(
74 CameraVideoCapturer.CameraEventsHandler eventsHandler) { 74 String deviceName, CameraVideoCapturer.CameraEventsHandler eventsHandler) {
75 return new VideoCapturerAndroid(deviceName, eventsHandler, captureToTexture) ; 75 return new VideoCapturerAndroid(deviceName, eventsHandler, captureToTexture) ;
76 } 76 }
77 77
78 private static android.hardware.Camera.CameraInfo getCameraInfo(int index) { 78 private static android.hardware.Camera.CameraInfo getCameraInfo(int index) {
79 android.hardware.Camera.CameraInfo info = new android.hardware.Camera.Camera Info(); 79 android.hardware.Camera.CameraInfo info = new android.hardware.Camera.Camera Info();
80 try { 80 try {
81 android.hardware.Camera.getCameraInfo(index, info); 81 android.hardware.Camera.getCameraInfo(index, info);
82 } catch (Exception e) { 82 } catch (Exception e) {
83 Logging.e(TAG, "getCameraInfo failed on index " + index, e); 83 Logging.e(TAG, "getCameraInfo failed on index " + index, e);
84 return null; 84 return null;
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
128 } 128 }
129 for (android.hardware.Camera.Size size : parameters.getSupportedPreviewSiz es()) { 129 for (android.hardware.Camera.Size size : parameters.getSupportedPreviewSiz es()) {
130 formatList.add(new CaptureFormat(size.width, size.height, minFps, maxFps )); 130 formatList.add(new CaptureFormat(size.width, size.height, minFps, maxFps ));
131 } 131 }
132 } catch (Exception e) { 132 } catch (Exception e) {
133 Logging.e(TAG, "getSupportedFormats() failed on camera index " + cameraId, e); 133 Logging.e(TAG, "getSupportedFormats() failed on camera index " + cameraId, e);
134 } 134 }
135 135
136 final long endTimeMs = SystemClock.elapsedRealtime(); 136 final long endTimeMs = SystemClock.elapsedRealtime();
137 Logging.d(TAG, "Get supported formats for camera index " + cameraId + " done ." 137 Logging.d(TAG, "Get supported formats for camera index " + cameraId + " done ."
138 + " Time spent: " + (endTimeMs - startTimeMs) + " ms."); 138 + " Time spent: " + (endTimeMs - startTimeMs) + " ms.");
139 return formatList; 139 return formatList;
140 } 140 }
141 141
142 // Convert from android.hardware.Camera.Size to Size. 142 // Convert from android.hardware.Camera.Size to Size.
143 static List<Size> convertSizes(List<android.hardware.Camera.Size> cameraSizes) { 143 static List<Size> convertSizes(List<android.hardware.Camera.Size> cameraSizes) {
144 final List<Size> sizes = new ArrayList<Size>(); 144 final List<Size> sizes = new ArrayList<Size>();
145 for (android.hardware.Camera.Size size : cameraSizes) { 145 for (android.hardware.Camera.Size size : cameraSizes) {
146 sizes.add(new Size(size.width, size.height)); 146 sizes.add(new Size(size.width, size.height));
147 } 147 }
148 return sizes; 148 return sizes;
(...skipping 25 matching lines...) Expand all
174 // Returns the name of the camera with camera index. Returns null if the 174 // Returns the name of the camera with camera index. Returns null if the
175 // camera can not be used. 175 // camera can not be used.
176 static String getDeviceName(int index) { 176 static String getDeviceName(int index) {
177 android.hardware.Camera.CameraInfo info = getCameraInfo(index); 177 android.hardware.Camera.CameraInfo info = getCameraInfo(index);
178 if (info == null) { 178 if (info == null) {
179 return null; 179 return null;
180 } 180 }
181 181
182 String facing = 182 String facing =
183 (info.facing == android.hardware.Camera.CameraInfo.CAMERA_FACING_FRONT) ? "front" : "back"; 183 (info.facing == android.hardware.Camera.CameraInfo.CAMERA_FACING_FRONT) ? "front" : "back";
184 return "Camera " + index + ", Facing " + facing 184 return "Camera " + index + ", Facing " + facing + ", Orientation " + info.or ientation;
185 + ", Orientation " + info.orientation;
186 } 185 }
187 } 186 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698