| 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.content.pm.PackageManager; | 8 import android.content.pm.PackageManager; |
| 9 import android.hardware.Camera; | 9 import android.hardware.Camera; |
| 10 import android.util.Log; | 10 import android.util.Log; |
| (...skipping 30 matching lines...) Expand all Loading... |
| 41 mHeight = height; | 41 mHeight = height; |
| 42 } | 42 } |
| 43 } | 43 } |
| 44 | 44 |
| 45 static class ChromiumCameraInfo { | 45 static class ChromiumCameraInfo { |
| 46 private final int mId; | 46 private final int mId; |
| 47 private final Camera.CameraInfo mCameraInfo; | 47 private final Camera.CameraInfo mCameraInfo; |
| 48 // Special devices have more cameras than usual. Those devices are | 48 // Special devices have more cameras than usual. Those devices are |
| 49 // identified by model & device. Currently only the Tango is supported. | 49 // identified by model & device. Currently only the Tango is supported. |
| 50 // Note that these devices have no Camera.CameraInfo. | 50 // Note that these devices have no Camera.CameraInfo. |
| 51 private static final String[][] s_SPECIAL_DEVICE_LIST = { | 51 private static final String[][] SPECIAL_DEVICE_LIST = { |
| 52 {"Peanut", "peanut"}, | 52 {"Peanut", "peanut"}, |
| 53 }; | 53 }; |
| 54 private static final String TAG = "ChromiumCameraInfo"; | 54 private static final String TAG = "ChromiumCameraInfo"; |
| 55 | 55 |
| 56 private static int sNumberOfSystemCameras = -1; | 56 private static int sNumberOfSystemCameras = -1; |
| 57 | 57 |
| 58 private static boolean isSpecialDevice() { | 58 private static boolean isSpecialDevice() { |
| 59 for (String[] device : s_SPECIAL_DEVICE_LIST) { | 59 for (String[] device : SPECIAL_DEVICE_LIST) { |
| 60 if (device[0].contentEquals(android.os.Build.MODEL) && | 60 if (device[0].contentEquals(android.os.Build.MODEL) && |
| 61 device[1].contentEquals(android.os.Build.DEVICE)) { | 61 device[1].contentEquals(android.os.Build.DEVICE)) { |
| 62 return true; | 62 return true; |
| 63 } | 63 } |
| 64 } | 64 } |
| 65 return false; | 65 return false; |
| 66 } | 66 } |
| 67 | 67 |
| 68 private static boolean isSpecialCamera(int id) { | 68 private static boolean isSpecialCamera(int id) { |
| 69 return id >= sNumberOfSystemCameras; | 69 return id >= sNumberOfSystemCameras; |
| (...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 188 @CalledByNative | 188 @CalledByNative |
| 189 static int getCaptureFormatFramerate(VideoCapture.CaptureFormat format) { | 189 static int getCaptureFormatFramerate(VideoCapture.CaptureFormat format) { |
| 190 return format.getFramerate(); | 190 return format.getFramerate(); |
| 191 } | 191 } |
| 192 | 192 |
| 193 @CalledByNative | 193 @CalledByNative |
| 194 static int getCaptureFormatPixelFormat(VideoCapture.CaptureFormat format) { | 194 static int getCaptureFormatPixelFormat(VideoCapture.CaptureFormat format) { |
| 195 return format.getPixelFormat(); | 195 return format.getPixelFormat(); |
| 196 } | 196 } |
| 197 } | 197 } |
| OLD | NEW |