| 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.annotation.TargetApi; | 7 import android.annotation.TargetApi; |
| 8 import android.content.Context; | |
| 9 import android.graphics.ImageFormat; | 8 import android.graphics.ImageFormat; |
| 10 import android.graphics.Rect; | 9 import android.graphics.Rect; |
| 11 import android.graphics.SurfaceTexture; | 10 import android.graphics.SurfaceTexture; |
| 12 import android.opengl.GLES20; | 11 import android.opengl.GLES20; |
| 13 import android.os.Build; | 12 import android.os.Build; |
| 14 import android.util.SparseArray; | 13 import android.util.SparseArray; |
| 15 | 14 |
| 16 import org.chromium.base.Log; | 15 import org.chromium.base.Log; |
| 17 import org.chromium.base.annotations.JNINamespace; | 16 import org.chromium.base.annotations.JNINamespace; |
| 18 | 17 |
| (...skipping 230 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 249 for (android.hardware.Camera.Size size : supportedSizes) { | 248 for (android.hardware.Camera.Size size : supportedSizes) { |
| 250 formatList.add(new VideoCaptureFormat( | 249 formatList.add(new VideoCaptureFormat( |
| 251 size.width, size.height, (fpsRange[1] + 999) / 1000,
pixelFormat)); | 250 size.width, size.height, (fpsRange[1] + 999) / 1000,
pixelFormat)); |
| 252 } | 251 } |
| 253 } | 252 } |
| 254 } | 253 } |
| 255 camera.release(); | 254 camera.release(); |
| 256 return formatList.toArray(new VideoCaptureFormat[formatList.size()]); | 255 return formatList.toArray(new VideoCaptureFormat[formatList.size()]); |
| 257 } | 256 } |
| 258 | 257 |
| 259 VideoCaptureCamera(Context context, int id, long nativeVideoCaptureDeviceAnd
roid) { | 258 VideoCaptureCamera(int id, long nativeVideoCaptureDeviceAndroid) { |
| 260 super(context, id, nativeVideoCaptureDeviceAndroid); | 259 super(id, nativeVideoCaptureDeviceAndroid); |
| 261 } | 260 } |
| 262 | 261 |
| 263 @Override | 262 @Override |
| 264 public boolean allocate(int width, int height, int frameRate) { | 263 public boolean allocate(int width, int height, int frameRate) { |
| 265 Log.d(TAG, "allocate: requested (%d x %d) @%dfps", width, height, frameR
ate); | 264 Log.d(TAG, "allocate: requested (%d x %d) @%dfps", width, height, frameR
ate); |
| 266 try { | 265 try { |
| 267 mCamera = android.hardware.Camera.open(mId); | 266 mCamera = android.hardware.Camera.open(mId); |
| 268 } catch (RuntimeException ex) { | 267 } catch (RuntimeException ex) { |
| 269 Log.e(TAG, "allocate: Camera.open: " + ex); | 268 Log.e(TAG, "allocate: Camera.open: " + ex); |
| 270 return false; | 269 return false; |
| (...skipping 556 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 827 getCameraRotation()); | 826 getCameraRotation()); |
| 828 } | 827 } |
| 829 } finally { | 828 } finally { |
| 830 mPreviewBufferLock.unlock(); | 829 mPreviewBufferLock.unlock(); |
| 831 if (camera != null) { | 830 if (camera != null) { |
| 832 camera.addCallbackBuffer(data); | 831 camera.addCallbackBuffer(data); |
| 833 } | 832 } |
| 834 } | 833 } |
| 835 } | 834 } |
| 836 } | 835 } |
| OLD | NEW |