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 import android.view.Surface; | 9 import android.view.Surface; |
10 import android.view.WindowManager; | 10 import android.view.WindowManager; |
11 | 11 |
12 import org.chromium.base.annotations.CalledByNative; | 12 import org.chromium.base.annotations.CalledByNative; |
13 import org.chromium.base.annotations.JNINamespace; | 13 import org.chromium.base.annotations.JNINamespace; |
14 | 14 |
15 import java.nio.ByteBuffer; | 15 import java.nio.ByteBuffer; |
| 16 import java.util.ArrayList; |
16 import java.util.Collections; | 17 import java.util.Collections; |
17 import java.util.Comparator; | 18 import java.util.Comparator; |
18 import java.util.List; | 19 import java.util.List; |
19 | 20 |
20 /** | 21 /** |
21 * Video Capture Device base class, defines a set of methods that native code | 22 * Video Capture Device base class, defines a set of methods that native code |
22 * needs to use to configure, start capture, and to be reached by callbacks and | 23 * needs to use to configure, start capture, and to be reached by callbacks and |
23 * provides some neccesary data type(s) with accessors. | 24 * provides some neccesary data type(s) with accessors. |
24 **/ | 25 **/ |
25 @JNINamespace("media") | 26 @JNINamespace("media") |
(...skipping 177 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
203 return minFpsError + maxFpsError; | 204 return minFpsError + maxFpsError; |
204 } | 205 } |
205 | 206 |
206 @Override | 207 @Override |
207 public int compare(FramerateRange range1, FramerateRange range2) { | 208 public int compare(FramerateRange range1, FramerateRange range2) { |
208 return diff(range1) - diff(range2); | 209 return diff(range1) - diff(range2); |
209 } | 210 } |
210 }); | 211 }); |
211 } | 212 } |
212 | 213 |
| 214 protected static int[] integerArrayListToArray(ArrayList<Integer> intArrayLi
st) { |
| 215 int[] intArray = new int[intArrayList.size()]; |
| 216 for (int i = 0; i < intArrayList.size(); i++) { |
| 217 intArray[i] = intArrayList.get(i).intValue(); |
| 218 } |
| 219 return intArray; |
| 220 } |
| 221 |
213 // Method for VideoCapture implementations to call back native code. | 222 // Method for VideoCapture implementations to call back native code. |
214 public native void nativeOnFrameAvailable( | 223 public native void nativeOnFrameAvailable( |
215 long nativeVideoCaptureDeviceAndroid, byte[] data, int length, int r
otation); | 224 long nativeVideoCaptureDeviceAndroid, byte[] data, int length, int r
otation); |
216 | 225 |
217 public native void nativeOnI420FrameAvailable(long nativeVideoCaptureDeviceA
ndroid, | 226 public native void nativeOnI420FrameAvailable(long nativeVideoCaptureDeviceA
ndroid, |
218 ByteBuffer yBuffer, int yStride, ByteBuffer uBuffer, ByteBuffer vBuf
fer, | 227 ByteBuffer yBuffer, int yStride, ByteBuffer uBuffer, ByteBuffer vBuf
fer, |
219 int uvRowStride, int uvPixelStride, int width, int height, int rotat
ion, | 228 int uvRowStride, int uvPixelStride, int width, int height, int rotat
ion, |
220 long timestamp); | 229 long timestamp); |
221 | 230 |
222 // Method for VideoCapture implementations to signal an asynchronous error. | 231 // Method for VideoCapture implementations to signal an asynchronous error. |
223 public native void nativeOnError(long nativeVideoCaptureDeviceAndroid, Strin
g message); | 232 public native void nativeOnError(long nativeVideoCaptureDeviceAndroid, Strin
g message); |
224 | 233 |
225 // Method for VideoCapture implementations to send Photos back to. | 234 // Method for VideoCapture implementations to send Photos back to. |
226 public native void nativeOnPhotoTaken( | 235 public native void nativeOnPhotoTaken( |
227 long nativeVideoCaptureDeviceAndroid, long callbackId, byte[] data); | 236 long nativeVideoCaptureDeviceAndroid, long callbackId, byte[] data); |
228 | 237 |
229 // Method for VideoCapture implementations to report device started event. | 238 // Method for VideoCapture implementations to report device started event. |
230 public native void nativeOnStarted(long nativeVideoCaptureDeviceAndroid); | 239 public native void nativeOnStarted(long nativeVideoCaptureDeviceAndroid); |
231 } | 240 } |
OLD | NEW |