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

Side by Side Diff: media/base/android/java/src/org/chromium/media/VideoCaptureAndroid.java

Issue 602063002: Android Video Capture: Removed references to Android.Hardware.Camera from the factory and cleanup (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: qinmin@ nit and tiny style. Created 6 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 // 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 import android.util.Log; 9 import android.util.Log;
10 10
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after
72 } 72 }
73 } 73 }
74 return ImageFormat.YV12; 74 return ImageFormat.YV12;
75 } 75 }
76 } 76 }
77 77
78 private int mExpectedFrameSize; 78 private int mExpectedFrameSize;
79 private static final int NUM_CAPTURE_BUFFERS = 3; 79 private static final int NUM_CAPTURE_BUFFERS = 3;
80 private static final String TAG = "VideoCaptureAndroid"; 80 private static final String TAG = "VideoCaptureAndroid";
81 81
82 static int getNumberOfCameras() {
83 return android.hardware.Camera.getNumberOfCameras();
84 }
85
86 static String getName(int id) {
87 android.hardware.Camera.CameraInfo cameraInfo = VideoCapture.getCameraIn fo(id);
88 return "camera " + id + ", facing " + (cameraInfo.facing ==
89 android.hardware.Camera.CameraInfo.CAMERA_FACING_FRONT ? "front" : "back");
90 }
91
82 static CaptureFormat[] getDeviceSupportedFormats(int id) { 92 static CaptureFormat[] getDeviceSupportedFormats(int id) {
83 android.hardware.Camera camera; 93 android.hardware.Camera camera;
84 try { 94 try {
85 camera = android.hardware.Camera.open(id); 95 camera = android.hardware.Camera.open(id);
86 } catch (RuntimeException ex) { 96 } catch (RuntimeException ex) {
87 Log.e(TAG, "Camera.open: " + ex); 97 Log.e(TAG, "Camera.open: " + ex);
88 return null; 98 return null;
89 } 99 }
90 android.hardware.Camera.Parameters parameters = getCameraParameters(came ra); 100 android.hardware.Camera.Parameters parameters = getCameraParameters(came ra);
91 if (parameters == null) { 101 if (parameters == null) {
(...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after
198 mPreviewBufferLock.unlock(); 208 mPreviewBufferLock.unlock();
199 if (camera != null) { 209 if (camera != null) {
200 camera.addCallbackBuffer(data); 210 camera.addCallbackBuffer(data);
201 } 211 }
202 } 212 }
203 } 213 }
204 214
205 // TODO(wjia): investigate whether reading from texture could give better 215 // TODO(wjia): investigate whether reading from texture could give better
206 // performance and frame rate, using onFrameAvailable(). 216 // performance and frame rate, using onFrameAvailable().
207 } 217 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698