| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 package org.chromium.media; | 5 package org.chromium.media; |
| 6 | 6 |
| 7 import android.content.Context; | 7 import android.content.Context; |
| 8 import android.graphics.ImageFormat; | 8 import android.graphics.ImageFormat; |
| 9 | 9 |
| 10 import org.chromium.base.Log; | 10 import org.chromium.base.Log; |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 43 private int mExpectedFrameSize; | 43 private int mExpectedFrameSize; |
| 44 private static final int NUM_CAPTURE_BUFFERS = 3; | 44 private static final int NUM_CAPTURE_BUFFERS = 3; |
| 45 private static final String TAG = "cr.media"; | 45 private static final String TAG = "cr.media"; |
| 46 | 46 |
| 47 static int getNumberOfCameras() { | 47 static int getNumberOfCameras() { |
| 48 return android.hardware.Camera.getNumberOfCameras(); | 48 return android.hardware.Camera.getNumberOfCameras(); |
| 49 } | 49 } |
| 50 | 50 |
| 51 static int getCaptureApiType(int id) { | 51 static int getCaptureApiType(int id) { |
| 52 if (VideoCaptureCamera.getCameraInfo(id) == null) { | 52 if (VideoCaptureCamera.getCameraInfo(id) == null) { |
| 53 return CaptureApiType.API_TYPE_UNKNOWN; | 53 return VideoCaptureApiType.API_TYPE_UNKNOWN; |
| 54 } | 54 } |
| 55 return CaptureApiType.API1; | 55 return VideoCaptureApiType.ANDROID_API1; |
| 56 } | 56 } |
| 57 | 57 |
| 58 static String getName(int id) { | 58 static String getName(int id) { |
| 59 android.hardware.Camera.CameraInfo cameraInfo = VideoCaptureCamera.getCa
meraInfo(id); | 59 android.hardware.Camera.CameraInfo cameraInfo = VideoCaptureCamera.getCa
meraInfo(id); |
| 60 if (cameraInfo == null) return null; | 60 if (cameraInfo == null) return null; |
| 61 | 61 |
| 62 return "camera " + id + ", facing " | 62 return "camera " + id + ", facing " |
| 63 + (cameraInfo.facing == android.hardware.Camera.CameraInfo.CAMER
A_FACING_FRONT | 63 + (cameraInfo.facing == android.hardware.Camera.CameraInfo.CAMER
A_FACING_FRONT |
| 64 ? "front" | 64 ? "front" |
| 65 : "back"); | 65 : "back"); |
| (...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 165 mPreviewBufferLock.unlock(); | 165 mPreviewBufferLock.unlock(); |
| 166 if (camera != null) { | 166 if (camera != null) { |
| 167 camera.addCallbackBuffer(data); | 167 camera.addCallbackBuffer(data); |
| 168 } | 168 } |
| 169 } | 169 } |
| 170 } | 170 } |
| 171 | 171 |
| 172 // TODO(wjia): investigate whether reading from texture could give better | 172 // TODO(wjia): investigate whether reading from texture could give better |
| 173 // performance and frame rate, using onFrameAvailable(). | 173 // performance and frame rate, using onFrameAvailable(). |
| 174 } | 174 } |
| OLD | NEW |