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

Unified Diff: media/base/android/java/src/org/chromium/media/VideoCapture.java

Issue 12604003: Android: cleans up hand-written JNI for video_capture_device_android.cc (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Nits Created 7 years, 9 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
« no previous file with comments | « no previous file | media/media.gyp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: media/base/android/java/src/org/chromium/media/VideoCapture.java
diff --git a/media/base/android/java/src/org/chromium/media/VideoCapture.java b/media/base/android/java/src/org/chromium/media/VideoCapture.java
index 4f66ef678e46e0725d831ffc86d36c467aae0696..0266558ca775fb32689f2756ab9bf1ece162e5d7 100644
--- a/media/base/android/java/src/org/chromium/media/VideoCapture.java
+++ b/media/base/android/java/src/org/chromium/media/VideoCapture.java
@@ -135,7 +135,8 @@ public class VideoCapture implements PreviewCallback, OnFrameAvailableListener {
}
}
if (minDiff == Integer.MAX_VALUE) {
- Log.e(TAG, "allocate: can not find a resolution whose width is multiple of 32");
+ Log.e(TAG, "allocate: can not find a resolution whose width " +
+ "is multiple of 32");
return false;
}
mCurrentCapability.mWidth = matchedWidth;
@@ -304,6 +305,44 @@ public class VideoCapture implements PreviewCallback, OnFrameAvailableListener {
@Override
public void onFrameAvailable(SurfaceTexture surfaceTexture) { }
+ private static class ChromiumCameraInfo {
+ private final int mId;
+ private final Camera.CameraInfo mCameraInfo;
+
+ private ChromiumCameraInfo(int index) {
+ mId = index;
+ mCameraInfo = new Camera.CameraInfo();
+ Camera.getCameraInfo(index, mCameraInfo);
+ }
+
+ @CalledByNative("ChromiumCameraInfo")
+ private static int getNumberOfCameras() {
+ return Camera.getNumberOfCameras();
+ }
+
+ @CalledByNative("ChromiumCameraInfo")
+ private static ChromiumCameraInfo getAt(int index) {
+ return new ChromiumCameraInfo(index);
+ }
+
+ @CalledByNative("ChromiumCameraInfo")
+ private int getId() {
+ return mId;
+ }
+
+ @CalledByNative("ChromiumCameraInfo")
+ private String getDeviceName() {
+ return "camera " + mId + ", facing " +
+ (mCameraInfo.facing ==
+ Camera.CameraInfo.CAMERA_FACING_FRONT ? "front" : "back");
+ }
+
+ @CalledByNative("ChromiumCameraInfo")
+ private int getOrientation() {
+ return mCameraInfo.orientation;
+ }
+ }
+
private native void nativeOnFrameAvailable(
int nativeVideoCaptureDeviceAndroid,
byte[] data,
« no previous file with comments | « no previous file | media/media.gyp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698