Home | History | Annotate | Download | only in com.example.android.common.media

Lines Matching defs:Camera

20 import android.hardware.Camera;
31 * Camera related utilities.
39 * Iterate over supported camera preview sizes to see which one best fits the
43 * @param sizes Supported camera preview sizes.
46 * @return Best match camera preview size to fit in the view.
48 public static Camera.Size getOptimalPreviewSize(List<Camera.Size> sizes, int w, int h) {
55 Camera.Size optimalSize = null;
58 // minimum difference between view and camera height.
67 for (Camera.Size size : sizes) {
80 for (Camera.Size size : sizes) {
91 * @return the default camera on the device. Return null if there is no camera on the device.
93 public static Camera getDefaultCameraInstance() {
94 return Camera.open();
99 * @return the default rear/back facing camera on the device. Returns null if camera is not
102 public static Camera getDefaultBackFacingCameraInstance() {
103 return getDefaultCamera(Camera.CameraInfo.CAMERA_FACING_BACK);
107 * @return the default front facing camera on the device. Returns null if camera is not
110 public static Camera getDefaultFrontFacingCameraInstance() {
111 return getDefaultCamera(Camera.CameraInfo.CAMERA_FACING_FRONT);
117 * @param position Physical position of the camera i.e Camera.CameraInfo.CAMERA_FACING_FRONT
118 * or Camera.CameraInfo.CAMERA_FACING_BACK.
119 * @return the default camera on the device. Returns null if camera is not available.
122 private static Camera getDefaultCamera(int position) {
124 int mNumberOfCameras = Camera.getNumberOfCameras();
126 // Find the ID of the back-facing ("default") camera
127 Camera.CameraInfo cameraInfo = new Camera.CameraInfo();
129 Camera.getCameraInfo(i, cameraInfo);
131 return Camera.open(i);